Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIR processing to KHIS #1775

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
27 changes: 27 additions & 0 deletions src/app/etl-api/khis-air-resource.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Injectable } from '@angular/core';
import { AppSettingsService } from '../app-settings/app-settings.service';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';

@Injectable({
providedIn: 'root'
})
export class KhisAirModuleResourceService {
constructor(
private http: HttpClient,
private appSettingsService: AppSettingsService
) {}

private getMoh731KHisToAirUrl(): string {
return (
this.appSettingsService.getEtlRestbaseurl().trim() + 'extract-moh-731'
);
}

public postMOH731ExtractedData(payload: any): Observable<any> | null {
if (!payload) {
return null;
}
return this.http.post(this.getMoh731KHisToAirUrl(), payload);
}
}
3 changes: 3 additions & 0 deletions src/app/hiv-care-lib/hiv-care-lib.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ import { AhdMonthlyReportPatientlistComponent } from './ahd-monthly-report/ahd-m
import { PlhivNcdV2ReportBaseComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-base/plhiv-ncd-v2-report-base.component';
import { PlhivNcdV2ReportPatientListComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-patient-list/plhiv-ncd-v2-report-patient-list.component';
import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v2-report-view/plhiv-ncd-v2-report-view.component';
import { Moh731AirComponent } from './moh-731-report/moh-731-air.components';

@NgModule({
imports: [
Expand Down Expand Up @@ -184,6 +185,7 @@ import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v
exports: [
Moh731TabularComponent,
Moh731PatientListComponent,
Moh731AirComponent,
Moh731ReportFiltersComponent,
DateTimePickerModule,
EtlApi,
Expand Down Expand Up @@ -258,6 +260,7 @@ import { PlhivNcdV2ReportViewComponent } from './plhiv-ncd-v2-report/plhiv-ncd-v
Moh731PatientListComponent,
Moh731ReportBaseComponent,
Moh731ReportFiltersComponent,
Moh731AirComponent,
MOHReportComponent,
HivSummaryIndicatorBaseComponent,
HivSummaryTabularComponent,
Expand Down
109 changes: 109 additions & 0 deletions src/app/hiv-care-lib/moh-731-report/moh-731-air.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/* moh-731-air.component.scss */
.panel {
margin: 20px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.panel-heading {
background-color: #f5f5f5;
border-color: #ddd;

.panel-title {
margin-top: 7px;

.date-range {
font-size: 12px;
color: #777;
margin-left: 10px;
}
}
}

.table {
margin-bottom: 0;

th.sortable {
cursor: pointer;
user-select: none;

&:hover {
background-color: #f5f5f5;
}

.glyphicon {
font-size: 12px;
margin-left: 5px;
color: #777;
}
}
}

.label {
display: inline-block;
min-width: 60px;
padding: 5px 10px;
border-radius: 3px;
text-align: center;
}

.sortable {
cursor: pointer;
}

.label-success {
background-color: #5cb85c;
color: white;
}

.label-warning {
background-color: #f0ad4e;
color: white;
}

.label-danger {
background-color: #d9534f;
color: white;
}

.label-default {
background-color: #777;
color: white;
}

.loader {
padding: 20px;
text-align: center;
color: #666;

.fa-spinner {
margin-right: 10px;
}
}

.clickable {
cursor: pointer;

&:hover {
background-color: #f5f5f5;
}
}

.released-indicator {
color: #5cb85c;

.fa-check-circle {
margin-right: 5px;
}
}

@media (max-width: 768px) {
.panel-heading {
.panel-title {
margin-bottom: 10px;
}

.input-group {
margin-top: 10px;
}
}
}
122 changes: 122 additions & 0 deletions src/app/hiv-care-lib/moh-731-report/moh-731-air.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<!-- moh-731-air.component.html -->
<div class="panel panel-default">
<div class="row" style="margin-top: 4px; padding: 0px">
<button
type="button"
*ngIf="!parentIsBusy"
class="btn btn-success pull-right"
(click)="processDataToKHIS()"
>
Sync To KHIS
</button>
</div>
<div class="panel-heading">
<div class="row">
<div class="col-md-6">
<h3 class="panel-title">
AIR View
<span class="date-range" *ngIf="startDate && endDate">
({{ startDate | date }} - {{ endDate | date }})
</span>
</h3>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-search"></i>
</span>
<input
type="text"
class="form-control"
placeholder="Search..."
[(ngModel)]="searchTerm"
/>
</div>
</div>
</div>
</div>

<div class="panel-body">
<!-- Loading indicator -->
<div class="loader text-center" *ngIf="isLoading">
<i class="fa fa-spinner fa-spin"></i> Loading air data...
</div>

<!-- Table view -->
<div class="table-responsive" *ngIf="!isLoading">
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th
*ngFor="let def of sectionDefs"
(click)="sortBy(def.name)"
class="sortable"
>
{{ def.label }}
<span [class]="getSortIcon(def.name)"></span>
</th>
</tr>
</thead>
<tbody>
<tr
*ngFor="let item of filterData()"
(click)="onIndicatorClick(item)"
[class.clickable]="true"
>
<!-- Dynamically generate cells based on sectionDefs -->
<td *ngFor="let def of sectionDefs">
<span *ngIf="def.type !== 'status'">{{ item[def.name] }}</span>
<span
*ngIf="def.type === 'status'"
class="label"
[ngClass]="getStatusClass(item[def.name])"
>
{{ item[def.name] }}
</span>
<span *ngIf="def.type === 'action'">
<button
*ngIf="item.status === 'pending'"
class="btn btn-warning btn-sm"
(click)="retrySync(item)"
[disabled]="item.status === 'synced'"
>
Retry Sync
</button>
<button
*ngIf="item.status === 'error'"
class="btn btn-danger btn-sm"
(click)="resolveError(item)"
[disabled]="item.status === 'synced'"
>
Error
</button>
<span
*ngIf="item.status === 'synced'"
class="text-success disabled"
>
Synced
</span>
</span>
</td>
</tr>
<tr *ngIf="filterData().length === 0">
<td [attr.colspan]="sectionDefs.length" class="text-center">
No data found
</td>
</tr>
</tbody>
</table>
</div>
</div>

<div class="panel-footer">
<div class="row">
<div class="col-md-6">Showing {{ filterData().length }} entries</div>
<div class="col-md-6 text-right">
<span *ngIf="isReleased" class="released-indicator">
<i class="fa fa-check-circle"></i> Released
</span>
</div>
</div>
</div>
</div>
Loading
Loading