generated from PackagrIO/goweb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new way to register widgets with Gridstack (comes from widgetModule directly)
- Loading branch information
Showing
24 changed files
with
803 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"id": "updated", | ||
"schema_version": "1.0", | ||
"title": "Updated Dashboard", | ||
"description": "An example dashboard to show-off the power of Fasten widgets", | ||
"widgets": [ | ||
{ | ||
"title_text": "Records Summary", | ||
"description_text": "Track key metrics for your chronic disease (eg. Diabetes). The data within this widget is not reflective of your health record, and is only present for demonstrational purposes.", | ||
"x": 0, | ||
"y": 0, | ||
"width": 8, | ||
"height": 6, | ||
"item_type": "records-summary-widget" | ||
} | ||
] | ||
} |
This file contains 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
This file contains 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
185 changes: 185 additions & 0 deletions
185
frontend/src/app/widgets/records-summary-widget/records-summary-widget.component.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
<ng-container [ngTemplateOutlet]="loading ? showLoading : (!loading && isEmpty) ? showEmpty : showChart"></ng-container> | ||
|
||
<ng-template #showLoading> | ||
<loading-widget></loading-widget> | ||
</ng-template> | ||
|
||
<ng-template #showEmpty> | ||
<empty-widget></empty-widget> | ||
</ng-template> | ||
|
||
<ng-template #showChart> | ||
<div class="card card-dashboard-sixteen"> | ||
<div class="card-header"> | ||
<h6 class="card-title">Medical Records</h6> | ||
</div><!-- card-header --> | ||
<div class="card-body"> | ||
|
||
<div class="row"> | ||
<div class="col-6"> | ||
<div class="table-responsive"> | ||
<table class="table mg-b-0"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/allergies.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Allergies</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">7</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/clinicalnotes.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Clinical Notes</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">85</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/careplans.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Care Plans</h6> | ||
<small class="tx-11 tx-gray-500">Appointments<br/>Medical Conditions<br/>Health Goals<br/>Orders</small> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">83</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/careteam.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Care Team</h6> | ||
<small class="tx-11 tx-gray-500">Primary Care Provider<br/>Provider Details</small> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">8</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/demographics.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Demographic Information</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">3</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/labresults.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Lab Results</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">3</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<div class="table-responsive"> | ||
<table class="table mg-b-0"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/healthgoals.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Health Goals</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">2</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/conditions.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Health Issues</h6> | ||
<small class="tx-11 tx-gray-500">Conditions</small> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">6</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/immunizations.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Immunizations</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">9</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/implants.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Implants</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">22</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/medications.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Medications</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">22</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div class="az-img-user"><img src="assets/icons/procedures.svg" alt=""></div> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">Procedures</h6> | ||
</td> | ||
<td> | ||
<h6 class="mg-b-0 tx-inverse">22</h6> | ||
<small class="tx-11 tx-gray-500">Records</small> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div><!-- card-body --> | ||
</div> | ||
</ng-template><!-- card --> |
Empty file.
23 changes: 23 additions & 0 deletions
23
frontend/src/app/widgets/records-summary-widget/records-summary-widget.component.spec.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { RecordsSummaryWidgetComponent } from './records-summary-widget.component'; | ||
|
||
describe('RecordsSummaryWidgetComponent', () => { | ||
let component: RecordsSummaryWidgetComponent; | ||
let fixture: ComponentFixture<RecordsSummaryWidgetComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ RecordsSummaryWidgetComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(RecordsSummaryWidgetComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
frontend/src/app/widgets/records-summary-widget/records-summary-widget.component.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {NgChartsModule} from 'ng2-charts'; | ||
import {CommonModule} from '@angular/common'; | ||
import {MomentModule} from 'ngx-moment'; | ||
import {LoadingWidgetComponent} from '../loading-widget/loading-widget.component'; | ||
import {EmptyWidgetComponent} from '../empty-widget/empty-widget.component'; | ||
import {DashboardWidgetComponent} from '../dashboard-widget/dashboard-widget.component'; | ||
import {DashboardWidgetConfig} from '../../models/widget/dashboard-widget-config'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [CommonModule, LoadingWidgetComponent, EmptyWidgetComponent], | ||
selector: 'records-summary-widget', | ||
templateUrl: './records-summary-widget.component.html', | ||
styleUrls: ['./records-summary-widget.component.scss'] | ||
}) | ||
export class RecordsSummaryWidgetComponent extends DashboardWidgetComponent implements OnInit { | ||
|
||
// constructor() { } | ||
|
||
ngOnInit(): void { | ||
//manually define the widget config, rather than pull from the configuration file | ||
this.widgetConfig = { | ||
id: 'records-summary-widget', | ||
item_type: 'records-summary-widget', | ||
description_text: 'Displays a summary of patient records', | ||
width: 4, | ||
height: 5, | ||
title_text: 'Medical Records', | ||
queries: [] | ||
|
||
} as DashboardWidgetConfig | ||
super.ngOnInit(); | ||
this.loading = false | ||
this.isEmpty = false | ||
} | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
frontend/src/app/widgets/records-summary-widget/records-summary-widget.stories.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { Meta, StoryObj } from '@storybook/angular'; | ||
import {RecordsSummaryWidgetComponent} from './records-summary-widget.component'; | ||
import {applicationConfig, moduleMetadata} from '@storybook/angular'; | ||
import {HttpClient, HttpClientModule} from '@angular/common/http'; | ||
import {HTTP_CLIENT_TOKEN} from '../../dependency-injection'; | ||
import {importProvidersFrom} from '@angular/core'; | ||
import {CommonModule} from '@angular/common'; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction | ||
const meta: Meta<RecordsSummaryWidgetComponent> = { | ||
title: 'Widget/RecordsSummaryWidget', | ||
component: RecordsSummaryWidgetComponent, | ||
decorators: [ | ||
applicationConfig({ | ||
providers: [ | ||
{ | ||
provide: HttpClient, | ||
useClass: HttpClient | ||
}, | ||
{ | ||
provide: HTTP_CLIENT_TOKEN, | ||
useClass: HttpClient, | ||
}, | ||
importProvidersFrom(HttpClientModule) | ||
] | ||
}), | ||
moduleMetadata({ | ||
imports: [CommonModule, HttpClientModule], | ||
}) | ||
], | ||
tags: ['autodocs'], | ||
render: (args: RecordsSummaryWidgetComponent) => ({ | ||
props: { | ||
backgroundColor: null, | ||
...args, | ||
}, | ||
}), | ||
argTypes: { | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<RecordsSummaryWidgetComponent>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/angular/writing-stories/args | ||
export const Example: Story = { | ||
args: { | ||
} | ||
}; | ||
|
Oops, something went wrong.