Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common-UI
Submodule Common-UI updated 30 files
+128 βˆ’0 CODE_OF_CONDUCT.md
+674 βˆ’0 LICENSE
+8 βˆ’4 README.md
+93 βˆ’0 src/registrar/abha-components/abha-consent-form/abha-consent-form.component.css
+73 βˆ’0 src/registrar/abha-components/abha-consent-form/abha-consent-form.component.html
+21 βˆ’0 src/registrar/abha-components/abha-consent-form/abha-consent-form.component.spec.ts
+82 βˆ’0 src/registrar/abha-components/abha-consent-form/abha-consent-form.component.ts
+6 βˆ’1 src/registrar/abha-components/abha-enter-otp-component/abha-enter-otp-component.component.html
+101 βˆ’31 src/registrar/abha-components/abha-enter-otp-component/abha-enter-otp-component.component.ts
+1 βˆ’1 src/registrar/abha-components/abha-generation-success-component/abha-generation-success-component.component.ts
+6 βˆ’4 src/registrar/abha-components/abha-mobile-component/abha-mobile-component.component.ts
+7 βˆ’7 src/registrar/abha-components/abha-verify-success-component/abha-verify-success-component.component.ts
+14 βˆ’1 src/registrar/abha-components/download-search-abha/download-search-abha.component.css
+95 βˆ’58 src/registrar/abha-components/download-search-abha/download-search-abha.component.html
+116 βˆ’19 src/registrar/abha-components/download-search-abha/download-search-abha.component.ts
+52 βˆ’2 src/registrar/abha-components/generate-abha-component/generate-abha-component.component.css
+57 βˆ’57 src/registrar/abha-components/generate-abha-component/generate-abha-component.component.html
+71 βˆ’49 src/registrar/abha-components/generate-abha-component/generate-abha-component.component.ts
+2 βˆ’2 src/registrar/abha-components/health-id-display-modal/health-id-display-modal.component.html
+19 βˆ’15 src/registrar/abha-components/health-id-display-modal/health-id-display-modal.component.ts
+41 βˆ’34 src/registrar/beneficiary-details/beneficiary-details.component.ts
+3 βˆ’1 src/registrar/family-tagging/family-tagging-details/family-tagging-details.component.ts
+2 βˆ’0 src/registrar/registration.module.ts
+2 βˆ’2 src/registrar/registration/abha-information/abha-information.component.html
+48 βˆ’28 src/registrar/registration/abha-information/abha-information.component.ts
+16 βˆ’1 src/registrar/registration/location-information/location-information.component.ts
+14 βˆ’1 src/registrar/registration/registration.component.ts
+3 βˆ’1 src/registrar/search-family/search-family.component.ts
+5 βˆ’11 src/registrar/search/search.component.ts
+10 βˆ’2 src/registrar/services/registrar.service.ts
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.tm-ui</groupId>
<artifactId>tm-ui</artifactId>
<version>3.0.0</version>
<version>3.4.0</version>
<name>TM-UI</name>
<description>Piramal - tm: Module ui</description>
<packaging>war</packaging>
Expand Down Expand Up @@ -94,7 +94,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<version>3.4.0</version>
<executions>
<execution>
<id>npm-install</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@
<tr style="color: #595959; font-size: 14px">
<td>{{ beneficiary?.beneficiaryName }}</td>
</tr>
<ng-container *ngIf="beneficiary?.fatherName">
<tr style="font-size: 14px; color: #000000">
<th id="fatherName">
{{ current_language_set?.bendetails?.fatherName }}:
</th>
</tr>
<tr style="color: #595959; font-size: 14px">
<td>{{ beneficiary?.fatherName }}</td>
</tr>
</ng-container>
<ng-container *ngIf="beneficiary?.lastName">
<tr style="font-size: 14px; color: #000000">
<th id="lastName">
{{ current_language_set?.bendetails?.lastName }}:
</th>
</tr>
<tr style="color: #595959; font-size: 14px">
<td>{{ beneficiary?.lastName }}</td>
</tr>
</ng-container>
Comment on lines +32 to +41
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Verification agent

🧩 Analysis chain

Confirm i18n key availability for bendetails.lastName across all locales

Template references current_language_set?.bendetails?.lastName. Please verify corresponding entries exist in all shipped locale JSONs to avoid a blank header at runtime.

Run this to confirm:


🏁 Script executed:

#!/bin/bash
# Check translation keys for lastName across assets
fd -a '.*\.json$' src/assets | xargs -I{} rg -n '"bendetails"\s*:\s*\{[^}]*"lastName"' -n {}

Length of output: 98


🏁 Script executed:

#!/usr/bin/env python3
import json, glob, sys

errors = False
# Search all JSON files under src/assets
for path in glob.glob("src/assets/**/*.json", recursive=True):
    try:
        with open(path, encoding="utf-8") as f:
            data = json.load(f)
    except json.JSONDecodeError as e:
        echo "Error parsing {path}: {e}" >&2
        errors = True
        continue

    # Check for 'bendetails' object
    if "bendetails" not in data or not isinstance(data["bendetails"], dict):
        print(f"{path}: missing or invalid 'bendetails' object")
        errors = True
    else:
        # Check for 'lastName' key inside 'bendetails'
        if "lastName" not in data["bendetails"]:
            print(f"{path}: missing 'bendetails.lastName' key")
            errors = True

if errors:
    sys.exit(1)

Length of output: 481


🏁 Script executed:

#!/bin/bash
set -e

# Iterate over all JSON locale files
find src/assets -type f -name '*.json' | while read -r file; do
  # Use Python to validate presence of bendetails.lastName
  python3 - "$file" << 'PYCODE'
import json, sys

path = sys.argv[1]
try:
    data = json.load(open(path, encoding="utf-8"))
except Exception as e:
    print(f"{path}: failed to parse JSON ({e})")
    sys.exit(1)

if not isinstance(data.get("bendetails"), dict):
    print(f"{path}: missing or invalid 'bendetails' object")
    sys.exit(1)

if "lastName" not in data["bendetails"]:
    print(f"{path}: missing 'bendetails.lastName' key")
    sys.exit(1)
PYCODE
done

echo "βœ“ All locale files contain bendetails.lastName"

Length of output: 172


#!/bin/bash

# Verify that bendetails.lastName exists in all locale JSONs under src/assets
python3 - << 'PYCODE'
import json, glob, sys

errors = False
# Gather all JSON files in src/assets, excluding git-version metadata
locale_files = [f for f in glob.glob('src/assets/**/*.json', recursive=True) if 'git-version' not in f]

if not locale_files:
    print("Error: No locale JSON files found under src/assets")
    sys.exit(1)

for path in sorted(locale_files):
    try:
        with open(path, encoding='utf-8') as fp:
            data = json.load(fp)
    except Exception as e:
        print(f"{path}: failed to parse JSON ({e})")
        errors = True
        continue

    # Ensure 'bendetails' is an object
    if not isinstance(data.get("bendetails"), dict):
        print(f"{path}: missing or invalid 'bendetails' object")
        errors = True
    else:
        # Check for 'lastName' key
        if "lastName" not in data["bendetails"]:
            print(f"{path}: missing 'bendetails.lastName' key")
            errors = True

if errors:
    sys.exit(1)
else:
    print("βœ“ All locale JSON files contain bendetails.lastName")
PYCODE

🏁 Script executed:

#!/bin/bash
set -e

fail=0
# Iterate over all JSON files under src/assets, excluding git-version metadata
find src/assets -type f -name '*.json' ! -name '*git-version.json' | while read -r file; do
  # Validate JSON and check for bendetails.lastName
  python3 - << EOF
import json, sys
path = "$file"
try:
    data = json.load(open(path, encoding="utf-8"))
except Exception as e:
    print(f"{path}: failed to parse JSON ({e})")
    sys.exit(1)

# Ensure 'bendetails' is a dict with 'lastName'
if not isinstance(data.get("bendetails"), dict) or "lastName" not in data["bendetails"]:
    print(f"{path}: missing bendetails.lastName key")
    sys.exit(1)
EOF
  if [ $? -ne 0 ]; then
    fail=1
  fi
done

if [ $fail -eq 0 ]; then
  echo "βœ“ All locale JSON files contain bendetails.lastName"
  exit 0
else
  exit 1
fi

Length of output: 173


Add missing bendetails.lastName translation to locale files

We ran a validation across all JSON assets and found that the key bendetails.lastName is missing in the following file, which will lead to a blank header at runtime:

  • src/assets/language.json: missing bendetails.lastName

Please add the appropriate translation entry under the bendetails object in this file (and any other locales as needed) to ensure the label renders correctly.

πŸ€– Prompt for AI Agents
In
src/app/app-modules/core/components/beneficiary-details/beneficiary-details.component.html
around lines 32 to 41, the template references
current_language_set?.bendetails?.lastName but the key bendetails.lastName is
missing from the locale file; open src/assets/language.json and add a "lastName"
entry under the "bendetails" object with the appropriate translated string (and
mirror the same key/value into any other locale JSON files used by the app),
then save and run the localization/validation step to confirm the key is
present.

<ng-container *ngIf="beneficiary?.preferredPhoneNum">
<tr style="font-size: 14px; color: #000000">
<th id="phoneNo">{{ current_language_set?.bendetails?.phoneNo }}:</th>
</tr>
<tr style="color: #595959; font-size: 14px">
<td>{{ beneficiary?.preferredPhoneNum }}</td>
</tr>
</ng-container>
<tr style="font-size: 14px; color: #000000">
<th id="gender">
{{ current_language_set?.bendetails?.gender }} /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,28 @@ <h4>{{ current_language_set?.casesheet?.provisionalDiag }}*</h4>
<div
class="col-12 row"
*ngFor="
let diagnosis of getProvisionalDiagnosisList();
let diagnosis of provisionalDiagnosisControls;
let i = index;
let isLast = last
"
>
<ng-container [formGroupName]="i">
<div class="col-9">
<mat-form-field class="input-full-width">
<input
matInput
allowText="inputFieldValidator"
appDiagnosisSearch
[diagnosisListForm]="diagnosis"
required
name="viewDiagnosisProvided"
formControlName="viewProvisionalDiagnosisProvided"
maxlength="100"
minlength="3"
required
[previousSelected]="
generalDiagnosisForm.value.provisionalDiagnosisList
"
/>
<mat-icon
class="search-btn cursorPointer"
matSuffix
appDiagnosisSearch
[diagnosisListForm]="diagnosis"
[previousSelected]="
generalDiagnosisForm.value.provisionalDiagnosisList
"
>search</mat-icon
>
<div class="col-xs-12 col-sm-8 col-md-9">
<mat-form-field class="input-full-width" appearance="fill">
<mat-label>{{ current_language_set?.casesheet?.provisionalDiag }}</mat-label>
<input matInput type="text" autocomplete="off" name="viewProvisionalDiagnosisProvided"
formControlName="viewProvisionalDiagnosisProvided" minlength="3" maxlength="100" required #diagnosisInput
[matAutocomplete]="autoDiagnosis" (keyup)="onDiagnosisInputKeyup(diagnosisInput.value, i)" />
</mat-form-field>

<mat-autocomplete #autoDiagnosis="matAutocomplete" autoActiveFirstOption [displayWith]="displayDiagnosis"
(optionSelected)="onDiagnosisSelected($event.option.value, i)">
<mat-option *ngFor="let diag of suggestedDiagnosisList[i]" [value]="diag">
{{ diag.term }}
</mat-option>
</mat-autocomplete>
</div>

<div class="col-xs-12 col-sm-3 m-t-10">
<button
mat-mini-fab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
implements OnInit, OnChanges, DoCheck
{
utils = new GeneralUtils(this.fb, this.sessionstorage);
suggestedDiagnosisList: any = [];

@Input()
generalDiagnosisForm!: FormGroup;
Expand All @@ -56,12 +57,14 @@
current_language_set: any;
designation: any;
specialist!: boolean;

constructor(
private fb: FormBuilder,
public httpServiceService: HttpServiceService,
private doctorService: DoctorService,
private confirmationService: ConfirmationService,
readonly sessionstorage: SessionStorageService,
private masterdataService: MasterdataService

Check failure on line 67 in src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts

View workflow job for this annotation

GitHub Actions / lint-and-audit / lint-and-audit

Insert `,`
) {}

Comment on lines 61 to 69
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Prettier failure: trailing comma in constructor params

CI flagged β€œInsert ,” at line 67. Add a trailing comma after the last constructor param in multiline form.

   constructor(
     private fb: FormBuilder,
     public httpServiceService: HttpServiceService,
     private doctorService: DoctorService,
     private confirmationService: ConfirmationService,
     readonly sessionstorage: SessionStorageService,
-    private masterdataService: MasterdataService
+    private masterdataService: MasterdataService,
   ) {}
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
constructor(
private fb: FormBuilder,
public httpServiceService: HttpServiceService,
private doctorService: DoctorService,
private confirmationService: ConfirmationService,
readonly sessionstorage: SessionStorageService,
private masterdataService: MasterdataService
) {}
constructor(
private fb: FormBuilder,
public httpServiceService: HttpServiceService,
private doctorService: DoctorService,
private confirmationService: ConfirmationService,
readonly sessionstorage: SessionStorageService,
private masterdataService: MasterdataService,
) {}
🧰 Tools
πŸͺ› GitHub Check: lint-and-audit / lint-and-audit

[failure] 67-67:
Insert ,

πŸͺ› GitHub Actions: ESLint and NPM Audit

[error] 67-67: prettier/prettier: Insert , at line 67, column 49.

πŸ€– Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts
around lines 61 to 69, Prettier flagged a missing trailing comma on the last
constructor parameter; update the multiline constructor parameter list by adding
a trailing comma after the final parameter (private masterdataService:
MasterdataService,) so the formatter passes.

ngOnInit() {
Expand Down Expand Up @@ -186,8 +189,7 @@
(<FormGroup>diagnosisArrayList.at(i)).controls[
'viewProvisionalDiagnosisProvided'
].disable();
if (diagnosisArrayList.length < savedDiagnosisData.length)
this.addDiagnosis();
this.addDiagnosis();
}
}
}
Expand All @@ -204,13 +206,11 @@
);
}
}
getProvisionalDiagnosisList(): AbstractControl[] | null {
const provisionalDiagnosisListControl = this.generalDiagnosisForm.get(
'provisionalDiagnosisList',
get provisionalDiagnosisControls(): AbstractControl[] {
return (
(this.generalDiagnosisForm.get('provisionalDiagnosisList') as FormArray)
?.controls || []
);
return provisionalDiagnosisListControl instanceof FormArray
? provisionalDiagnosisListControl.controls
: null;
}

removeDiagnosisFromList(
Expand Down Expand Up @@ -252,4 +252,35 @@
return true;
}
}

onDiagnosisInputKeyup(value: string, index: number) {
if (value.length >= 3) {
this.masterdataService
.searchDiagnosisBasedOnPageNo(value, index)
.subscribe((results: any) => {
Comment on lines +256 to +260
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Verification agent

🧩 Analysis chain

Confirm MasterdataService signature for searchDiagnosisBasedOnPageNo

As with NCD care, verify the second argument is intended to be row index.


🏁 Script executed:

#!/bin/bash
# Inspect MasterdataService signature
fd 'masterdata\.service\.(ts|js)$' src | xargs -I{} rg -n 'searchDiagnosisBasedOnPageNo\s*\(' {}

Length of output: 169


Ensure correct usage of page number in searchDiagnosisBasedOnPageNo
The MasterdataService.searchDiagnosisBasedOnPageNo signature is:

searchDiagnosisBasedOnPageNo(searchTerm: any, pageNo: any) { … }

(confirmed by the output of your inspection at line 166 of masterdata.service.ts).

In your component call:

onDiagnosisInputKeyup(value: string, index: number) {
  if (value.length >= 3) {
    this.masterdataService
      .searchDiagnosisBasedOnPageNo(value, index)
      .subscribe(…);

the second argument (index) will be treated as the page number, not a row index. Please:

  • Verify whether you really intend to pass the current row’s index as the pagination page number.
  • If so, rename the parameter (and any related variables) from index to pageNo for clarity.
  • Otherwise, compute or supply the correct page number to this method.

This change will prevent confusion about what the method expects and ensure pagination behaves as intended.

πŸ€– Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts
around lines 256-260, the method call passes the local parameter named index
into MasterdataService.searchDiagnosisBasedOnPageNo which treats the second
argument as a page number; confirm intent and either (a) if you really mean to
use the row index as the page number, rename the parameter and all related
variables from index to pageNo to make this explicit, or (b) if you meant to
pass a pagination value, compute or fetch the correct page number and pass that
instead of the row index, updating variable names for clarity.

this.suggestedDiagnosisList[index] = results?.data?.sctMaster;
});
} else {
this.suggestedDiagnosisList[index] = [];
}
}

displayDiagnosis(diagnosis: any): string {
return typeof diagnosis === 'string' ? diagnosis : diagnosis?.term || '';
}

onDiagnosisSelected(selected: any, index: number) {
// this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected);
const diagnosisFormArray = this.generalDiagnosisForm.get(
'provisionalDiagnosisList'

Check failure on line 275 in src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/general-opd-diagnosis/general-opd-diagnosis.component.ts

View workflow job for this annotation

GitHub Actions / lint-and-audit / lint-and-audit

Insert `,`
) as FormArray;
const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup;

// Set the nested and top-level fields
diagnosisFormGroup.patchValue({
viewProvisionalDiagnosisProvided: selected,
conceptID: selected?.conceptID || null,
term: selected?.term || null,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,40 +118,29 @@ <h4>{{ current_language_set?.casesheet?.provisionalDiag }}</h4>
<ng-container formArrayName="provisionalDiagnosisList">
<div
*ngFor="
let diagnosis of getProvisionalDiagnosisList();
let diagnosis of provisionalDiagnosisControls;
let i = index;
let isLast = last
"
>
<ng-container [formGroupName]="i">
<div class="row">
<div class="col-xs-12 col-sm-9">
<mat-form-field class="input-full-width">
<input
matInput
allowText="inputFieldValidator"
appDiagnosisSearch
[diagnosisListForm]="diagnosis"
name="viewDiagnosisProvided"
formControlName="viewProvisionalDiagnosisProvided"
maxlength="100"
minlength="3"
[previousSelected]="
generalDiagnosisForm.value.provisionalDiagnosisList
"
/>
<mat-icon
class="search-btn cursorPointer"
matSuffix
appDiagnosisSearch
[diagnosisListForm]="diagnosis"
[previousSelected]="
generalDiagnosisForm.value?.provisionalDiagnosisList
"
>search</mat-icon
>
</mat-form-field>
</div>
<div class="col-xs-12 col-sm-8 col-md-9">
<mat-form-field class="input-full-width" appearance="fill">
<mat-label>{{ current_language_set?.casesheet?.provisionalDiag }}</mat-label>
<input matInput type="text" autocomplete="off" name="viewProvisionalDiagnosisProvided"
formControlName="viewProvisionalDiagnosisProvided" minlength="3" maxlength="100" required #diagnosisInput
[matAutocomplete]="autoDiagnosis" (keyup)="onDiagnosisInputKeyup(diagnosisInput.value, i)" />
</mat-form-field>

<mat-autocomplete #autoDiagnosis="matAutocomplete" autoActiveFirstOption [displayWith]="displayDiagnosis"
(optionSelected)="onDiagnosisSelected($event.option.value, i)">
<mat-option *ngFor="let diag of suggestedDiagnosisList[i]" [value]="diag">
{{ diag.term }}
</mat-option>
</mat-autocomplete>
</div>

<div class="col-xs-12 col-sm-3 m-t-10">
<button
mat-mini-fab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
visitCategory: any;
attendantType: any;
enableNCDCondition = false;
suggestedDiagnosisList: any = [];


Check failure on line 64 in src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts

View workflow job for this annotation

GitHub Actions / lint-and-audit / lint-and-audit

Delete `⏎`
constructor(
private fb: FormBuilder,
private masterdataService: MasterdataService,
Expand Down Expand Up @@ -178,8 +181,7 @@
(<FormGroup>diagnosisArrayList.at(i)).controls[
'viewProvisionalDiagnosisProvided'
].disable();
if (diagnosisArrayList.length < savedDiagnosisData.length)
this.addDiagnosis();
this.addDiagnosis();
}
}
}
Expand All @@ -197,13 +199,11 @@
}
}

getProvisionalDiagnosisList(): AbstractControl[] | null {
const provisionalDiagnosisListControl = this.generalDiagnosisForm.get(
'provisionalDiagnosisList',
get provisionalDiagnosisControls(): AbstractControl[] {
return (
(this.generalDiagnosisForm.get('provisionalDiagnosisList') as FormArray)
?.controls || []
);
return provisionalDiagnosisListControl instanceof FormArray
? provisionalDiagnosisListControl.controls
: null;
}

removeDiagnosisFromList(
Expand Down Expand Up @@ -268,4 +268,35 @@
value,
);
}

onDiagnosisInputKeyup(value: string, index: number) {
if (value.length >= 3) {
this.masterdataService
.searchDiagnosisBasedOnPageNo(value, index)
.subscribe((results: any) => {
Comment on lines +272 to +276
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Verification agent

🧩 Analysis chain

Confirm MasterdataService signature for searchDiagnosisBasedOnPageNo

Second argument reads like a page number; here it’s the row index. Ensure the method expects row index (or ignores it). Otherwise, pass an actual pageNo and track row index locally.


🏁 Script executed:

#!/bin/bash
# Inspect MasterdataService signature and param names
fd 'masterdata\.service\.(ts|js)$' src | xargs -I{} rg -n 'searchDiagnosisBasedOnPageNo\s*\(' {}

Length of output: 169


Fix incorrect argument usage for searchDiagnosisBasedOnPageNo

The MasterdataService.searchDiagnosisBasedOnPageNo method signature is

searchDiagnosisBasedOnPageNo(searchTerm: any, pageNo: any) { … }

but here you’re passing the row index as pageNo, which will lead to unexpected paging behavior.

Please update the component to:

  • Track the row’s index separately (e.g. in a local variable or within the results array)
  • Pass a proper page number to searchDiagnosisBasedOnPageNo (e.g. the current page counter, starting at 1)

Example diff in
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts (around lines 272–276):

 onDiagnosisInputKeyup(value: string, index: number) {
   if (value.length >= 3) {
-    this.masterdataService
-      .searchDiagnosisBasedOnPageNo(value, index)
+    // Use the actual page number (e.g. this.currentPage), not the row index
+    this.masterdataService
+      .searchDiagnosisBasedOnPageNo(value, this.currentPage)
       .subscribe((results: any) => {
         // handle results; use `index` only for row-specific logic
πŸ€– Prompt for AI Agents
In
src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts
around lines 272–276, the call to searchDiagnosisBasedOnPageNo(value, index)
incorrectly passes the row index as the pageNo; change this to pass a proper
page number (e.g. 1 or a maintained page counter) and keep the row index only
for UI bookkeeping. Update onDiagnosisInputKeyup to capture the row index in a
local variable or attach it to the input's model, call
searchDiagnosisBasedOnPageNo(searchTerm, pageNo) with a real page counter
(initialize to 1 and increment only when loading next pages), and ensure results
are merged back into the correct row using the preserved row index.

this.suggestedDiagnosisList[index] = results?.data?.sctMaster;
});
} else {
this.suggestedDiagnosisList[index] = [];
}
}

displayDiagnosis(diagnosis: any): string {
return typeof diagnosis === 'string' ? diagnosis : diagnosis?.term || '';
}

onDiagnosisSelected(selected: any, index: number) {
// this.patientQuickConsultForm.get(['provisionalDiagnosisList', index])?.setValue(selected);
const diagnosisFormArray = this.generalDiagnosisForm.get(
'provisionalDiagnosisList'

Check failure on line 291 in src/app/app-modules/nurse-doctor/case-record/general-case-record/diagnosis/ncd-care-diagnosis/ncd-care-diagnosis.component.ts

View workflow job for this annotation

GitHub Actions / lint-and-audit / lint-and-audit

Insert `,`
) as FormArray;
const diagnosisFormGroup = diagnosisFormArray.at(index) as FormGroup;

// Set the nested and top-level fields
diagnosisFormGroup.patchValue({
viewProvisionalDiagnosisProvided: selected,
conceptID: selected?.conceptID || null,
term: selected?.term || null,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,27 @@ <h4 *ngIf="!enableProvisionalDiag">
<ng-container formArrayName="provisionalDiagnosisList">
<div
*ngFor="
let diagnosis of getProvisionalDiagnosisList();
let diagnosis of provisionalDiagnosisControls;
let i = index;
let isLast = last
"
>
<ng-container [formGroupName]="i">
<div class="col-9">
<mat-form-field class="input-full-width">
<input
matInput
allowText="inputFieldValidator"
appDiagnosisSearch
[diagnosisListForm]="diagnosis"
name="viewDiagnosisProvided"
formControlName="viewProvisionalDiagnosisProvided"
maxlength="100"
minlength="3"
[previousSelected]="
generalDiagnosisForm.value.provisionalDiagnosisList
"
/>
<mat-icon
class="search-btn cursorPointer"
matSuffix
appDiagnosisSearch
[diagnosisListForm]="diagnosis"
[previousSelected]="
generalDiagnosisForm.value.provisionalDiagnosisList
"
>search</mat-icon
>
</mat-form-field>
</div>
<div class="col-xs-12 col-sm-8 col-md-9">
<mat-form-field class="input-full-width" appearance="fill">
<mat-label>{{ current_language_set?.casesheet?.provisionalDiag }}</mat-label>
<input matInput type="text" autocomplete="off" name="viewProvisionalDiagnosisProvided"
formControlName="viewProvisionalDiagnosisProvided" minlength="3" maxlength="100" required #diagnosisInput
[matAutocomplete]="autoDiagnosis" (keyup)="onDiagnosisInputKeyup(diagnosisInput.value, i)" />
</mat-form-field>

<mat-autocomplete #autoDiagnosis="matAutocomplete" autoActiveFirstOption [displayWith]="displayDiagnosis"
(optionSelected)="onDiagnosisSelected($event.option.value, i)">
<mat-option *ngFor="let diag of suggestedDiagnosisList[i]" [value]="diag">
{{ diag.term }}
</mat-option>
</mat-autocomplete>
</div>
<div class="col-xs-12 col-sm-3 m-t-10">
<button
mat-mini-fab
Expand Down
Loading
Loading