Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
getFormValueChanged();
trackFieldInteraction('Medicine Form Selection')
"
required
>
<mat-option
*ngFor="let item of drugFormMaster"
Expand Down Expand Up @@ -98,7 +97,6 @@
(keyup)="filterMedicine(tempDrugName)"
(blur)="reEnterMedicine()"
(focus)="trackFieldInteraction('Medicine Name Input')"
required
[matAutocomplete]="autoGroup"
/>
<mat-autocomplete
Expand Down Expand Up @@ -129,7 +127,6 @@
[(ngModel)]="currentPrescription.dose"
[disabled]="!currentPrescription.drugID"
(selectionChange)="trackFieldInteraction('Dosage Selection')"
required
>
<mat-option
*ngFor="let item of filteredDrugDoseMaster"
Expand All @@ -152,7 +149,6 @@
[(ngModel)]="currentPrescription.frequency"
[disabled]="!currentPrescription.drugID"
(selectionChange)="trackFieldInteraction('Frequency Selection')"
required
>
<mat-option
*ngFor="let item of drugFrequencyMaster"
Expand Down Expand Up @@ -225,7 +221,6 @@
[(ngModel)]="currentPrescription.qtyPrescribed"
[disabled]="!currentPrescription.drugID"
(selectionChange)="trackFieldInteraction('Quantity Selection')"
required
>
<mat-option
*ngFor="let item of drugDurationMaster | slice: 0 : 5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,61 @@ export class PrescriptionComponent implements OnInit, DoCheck, OnDestroy {
}

submitForUpload() {
const validationErrors = this.validateCurrentPrescription();

if (validationErrors.length > 0) {
const errorMessage =
'Please fill the following required fields:\n' +
validationErrors.map((e, i) => `${i + 1}. ${e}`).join('\n');
this.confirmationService.alert(errorMessage, 'error');
return;
}

this.addMedicine();
this.clearCurrentaddDetails();
}

validateCurrentPrescription(): string[] {
const errors: string[] = [];

if (!this.currentPrescription.formName) {
errors.push('Medicine Form');
}
if (!this.currentPrescription.drugName || !this.tempDrugName) {
errors.push('Medicine Name');
}
if (!this.currentPrescription.dose) {
errors.push('Dosage');
}
if (!this.currentPrescription.frequency) {
errors.push('Frequency');
}

// Conditional validations
if (
this.currentPrescription.frequency &&
this.currentPrescription.frequency !== 'SOS'
) {
if (!this.currentPrescription.duration) {
errors.push('Duration');
}
if (!this.currentPrescription.unit) {
errors.push('Unit');
}
}

// Quantity required for non-liquid forms
if (
this.currentPrescription.formID &&
this.currentPrescription.formID > 2 &&
!this.currentPrescription.qtyPrescribed
) {
errors.push('Quantity');
}

return errors;
}

addMedicine() {
const medicine: FormArray = <FormArray>(
this.drugPrescriptionForm.controls['prescribedDrugs']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ <h4>
name="form"
[(ngModel)]="tempform"
(selectionChange)="getFormValueChanged()"
required
>
<mat-option
*ngFor="let item of drugFormMaster"
Expand All @@ -751,7 +750,6 @@ <h4>
[(ngModel)]="tempDrugName"
(keyup)="filterMedicine(tempDrugName)"
(blur)="reEnterMedicine()"
required
[matAutocomplete]="autoGroup"
/>
<mat-autocomplete
Expand Down Expand Up @@ -784,7 +782,6 @@ <h4>
name="dose"
[(ngModel)]="currentPrescription.dose"
[disabled]="!currentPrescription.drugID"
required
>
<mat-option
*ngFor="let item of filteredDrugDoseMaster"
Expand All @@ -805,7 +802,6 @@ <h4>
name="frequency"
[(ngModel)]="currentPrescription.frequency"
[disabled]="!currentPrescription.drugID"
required
>
<mat-option
*ngFor="let item of drugFrequencyMaster"
Expand All @@ -829,7 +825,6 @@ <h4>
name="duration"
[(ngModel)]="currentPrescription.duration"
[disabled]="!currentPrescription.drugID"
required
>
<mat-option
*ngFor="let item of drugDurationMaster"
Expand All @@ -850,7 +845,6 @@ <h4>
name="unit"
[(ngModel)]="currentPrescription.unit"
[disabled]="!currentPrescription.drugID"
required
>
<mat-option
*ngFor="let item of drugDurationUnitMaster"
Expand Down Expand Up @@ -878,7 +872,6 @@ <h4>
name="quantity"
[(ngModel)]="currentPrescription.qtyPrescribed"
[disabled]="!currentPrescription.drugID"
required
>
<mat-option
*ngFor="let item of drugDurationMaster | slice: 0 : 5"
Expand Down
61 changes: 41 additions & 20 deletions src/app/app-modules/nurse-doctor/workarea/workarea.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2930,6 +2930,7 @@ export class WorkareaComponent
}
}
}

if (required.length) {
this.confirmationService.notify(
this.current_language_set.alerts.info.belowFields,
Expand Down Expand Up @@ -3584,7 +3585,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -3820,13 +3822,15 @@ export class WorkareaComponent
labTestOrders.length > 0
) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info
?.datafillSuccessfully ?? 'Data saved successfully',
'success',
);
this.navigateToSpecialistWorklist();
} else {
this.getHealthIDDetails(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info
?.datafillSuccessfully ?? 'Data saved successfully',
);
}
} else {
Expand All @@ -3838,13 +3842,15 @@ export class WorkareaComponent
this.schedulerData !== null)
) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info
?.datafillSuccessfully ?? 'Data saved successfully',
'success',
);
this.navigateToDoctorWorklist();
} else {
this.getHealthIDDetails(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info
?.datafillSuccessfully ?? 'Data saved successfully',
);
}
}
Expand Down Expand Up @@ -3998,7 +4004,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -4074,7 +4081,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -4107,7 +4115,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -4143,7 +4152,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -4204,13 +4214,15 @@ export class WorkareaComponent
this.schedulerData !== null)
) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info
?.datafillSuccessfully ?? 'Data saved successfully',
'success',
);
this.navigateToDoctorWorklist();
} else {
this.getHealthIDDetails(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info
?.datafillSuccessfully ?? 'Data saved successfully',
);
}
}
Expand Down Expand Up @@ -4284,7 +4296,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -4318,7 +4331,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -4361,13 +4375,15 @@ export class WorkareaComponent
this.testsPrescribed.laboratoryList.length > 0
) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToSpecialistWorklist();
} else {
this.getHealthIDDetails(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
);
}
}
Expand All @@ -4385,13 +4401,15 @@ export class WorkareaComponent
(this.schedulerData !== undefined && this.schedulerData !== null)
) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToDoctorWorklist();
} else {
this.getHealthIDDetails(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
);
}
}
Expand Down Expand Up @@ -5526,7 +5544,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -5559,7 +5578,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down Expand Up @@ -5589,7 +5609,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
this.current_language_set.alerts.info.datafillSuccessfully,
this.current_language_set?.alerts?.info?.datafillSuccessfully ??
'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
Expand Down
6 changes: 3 additions & 3 deletions src/assets/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"district": "District / Village",
"registrationDate": "Registration Date",
"image": "Image",
"advanceSearch": "Advance Search",
"advanceSearch": "Advanced Search",
"externalSearch": "Higher Health Facility Search",
"status": "Status",
"visitCategory": "Visit Category / Visit No",
Expand Down Expand Up @@ -308,7 +308,7 @@
"toTime": "To Time",
"Kindlyuploadthefiles": "Kindly upload the files",
"clearslots":"Clear Slot",
"advanceBeneficiarySearch": "Advance Beneficiary Search",
"advanceBeneficiarySearch": "Advanced Beneficiary Search",
"externalBeneficiarySearch": "External Beneficiary Search",
"firstNameisrequired": "First Name is required",
"pleaseprovideatleast2character": "Please provide atleast 2 character",
Expand Down Expand Up @@ -2145,4 +2145,4 @@
}


}
}
2 changes: 1 addition & 1 deletion src/assets/language.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"district": "District / Village",
"registrationDate": "Registration Date",
"image": "Image",
"advanceSearch": "Advance Search",
"advanceSearch": "Advanced Search",
"status": "Status",
"visitCategory": "Visit Category / Visit No",
"tcDate": "TC Date",
Expand Down
Loading