Skip to content

Commit b2687b3

Browse files
event actions (#488)
* event actions * events actions * ckeditor * ckeditor * fix * ..
1 parent 6f1fcd4 commit b2687b3

21 files changed

+9873
-32908
lines changed

package-lock.json

Lines changed: 9563 additions & 32904 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@ngx-translate/core": "^13.0.0",
3434
"@ngx-translate/http-loader": "^6.0.0",
3535
"alertifyjs": "^1.13.1",
36+
"ckeditor4-angular": "^3.1.0",
3637
"concurrently": "^5.3.0",
3738
"date-fns": "^2.27.0",
3839
"echarts": "^5.2.2",

src/app/_constants/enums.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,19 @@ export enum ActionStatus {
10041004
IN_PROGRESS = 'enum.ActionStatus.IN_PROGRESS',
10051005
}
10061006

1007+
export enum ActionMeasure {
1008+
PROHIBITION_OF_ENTRY_AND_WORK_CASES = 'enum.ActionMeasure.PROHIBITION_OF_ENTRY_AND_WORK_CASES',
1009+
SAMPLE_COLLECTION = 'enum.ActionMeasure.SAMPLE_COLLECTION',
1010+
FORWARDING_TO_NATIONAL_REFERENCE_CENTER = 'enum.ActionMeasure.FORWARDING_TO_NATIONAL_REFERENCE_CENTER',
1011+
CONTACT_FOLLOW_UP = 'enum.ActionMeasure.CONTACT_FOLLOW_UP',
1012+
VERIFICATION_OF_VACCINATION_IMMUNIZATION = 'enum.ActionMeasure.VERIFICATION_OF_VACCINATION_IMMUNIZATION',
1013+
POST_EXPOSURE_PROPHYLAXIS_VACCINATION = 'enum.ActionMeasure.POST_EXPOSURE_PROPHYLAXIS_VACCINATION',
1014+
CLOSURE_OF_FACILITY = 'enum.ActionMeasure.CLOSURE_OF_FACILITY',
1015+
PROHIBITION_OF_ENTRY_AND_WORK_CONTACTS = 'enum.ActionMeasure.PROHIBITION_OF_ENTRY_AND_WORK_CONTACTS',
1016+
POPULATION_INFORMATION = 'enum.ActionMeasure.POPULATION_INFORMATION',
1017+
OTHER = 'enum.ActionMeasure.OTHER',
1018+
}
1019+
10071020
export enum EventCriteriaDateType {
10081021
EVENT_DATE = 'enum.EventCriteriaDateType.EVENT_DATE',
10091022
REPORT_DATE = 'enum.EventCriteriaDateType.REPORT_DATE',

src/app/_constants/form-data.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ export const FORM_DATA_TEXTAREA = {
7777
className: 'size-full',
7878
};
7979

80+
export const FORM_DATA_EDITTEXTAREA = {
81+
...FORM_DATA_BASE,
82+
controlType: 'edittextarea',
83+
className: 'size-full',
84+
};
85+
8086
export const FORM_DATA_NULL = {
8187
...FORM_DATA_BASE,
8288
controlType: 'null',
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import {
2+
FORM_DATA_DATETIME,
3+
FORM_DATA_EDITTEXTAREA,
4+
FORM_DATA_INPUT,
5+
FORM_DATA_NULL,
6+
FORM_DATA_RADIO,
7+
FORM_DATA_SELECT,
8+
} from '../../_constants/form-data';
9+
import { ActionMeasure, ActionPriority, ActionStatus } from '../../_constants/enums';
10+
import { EnumToKeyValuePipe } from '../../_pipes/enum-to-key-value/enum-to-key-value.pipe';
11+
12+
const pipe = new EnumToKeyValuePipe();
13+
const actionPriorityOptions = pipe.transform(ActionPriority);
14+
const actionMeasureOptions = pipe.transform(ActionMeasure);
15+
const actionStatusOptions = pipe.transform(ActionStatus);
16+
17+
export const FORM_DATA_EVENT_ACTIONS_ADD_EDIT = [
18+
{
19+
id: 'event',
20+
title: 'captions.Action.event',
21+
fields: [
22+
{
23+
...FORM_DATA_NULL,
24+
key: 'disease',
25+
label: 'strings.promptDisease',
26+
},
27+
],
28+
},
29+
{
30+
id: 'action ',
31+
title: 'captions.Action',
32+
fields: [
33+
{
34+
...FORM_DATA_DATETIME,
35+
key: 'date',
36+
label: 'timeHeading',
37+
},
38+
{
39+
...FORM_DATA_SELECT,
40+
key: 'priority',
41+
label: 'captions.Action.priority',
42+
options: actionPriorityOptions,
43+
newLine: true,
44+
className: 'size-large',
45+
},
46+
{
47+
...FORM_DATA_SELECT,
48+
key: 'measure',
49+
label: 'captions.Action.actionMeasure',
50+
options: actionMeasureOptions,
51+
className: 'size-large',
52+
newLine: true,
53+
},
54+
{
55+
...FORM_DATA_INPUT,
56+
key: 'title',
57+
label: 'captions.Action.title',
58+
className: 'size-large',
59+
newLine: true,
60+
},
61+
{
62+
...FORM_DATA_RADIO,
63+
key: 'actionStatus',
64+
newLine: true,
65+
options: actionStatusOptions,
66+
},
67+
{
68+
...FORM_DATA_EDITTEXTAREA,
69+
key: 'description',
70+
newLine: true,
71+
},
72+
],
73+
},
74+
];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<app-dynamic-form
2+
[formId]="formId"
3+
[formElements]="myFormElements"
4+
[resourceService]="eventService"
5+
></app-dynamic-form>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* stylelint-disable */
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
4+
import { EventActionsAddEditModalComponent } from './event-actions-add-edit-modal.component';
5+
6+
describe('EventActionsAddEditModalComponent', () => {
7+
let component: EventActionsAddEditModalComponent;
8+
let fixture: ComponentFixture<EventActionsAddEditModalComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
declarations: [EventActionsAddEditModalComponent],
13+
imports: [HttpClientTestingModule],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(EventActionsAddEditModalComponent);
19+
component = fixture.componentInstance;
20+
fixture.detectChanges();
21+
});
22+
23+
it('should create', () => {
24+
expect(component).toBeTruthy();
25+
});
26+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Component, Input, OnInit } from '@angular/core';
2+
import { FormBase } from '../../shared/dynamic-form/types/form-element-base';
3+
import * as data from './event-actions-add-edit-modal-form-data';
4+
import { FormElementControlService } from '../../_services/form-element-control.service';
5+
import { ADD_EDIT_FORM_ID } from '../../app.constants';
6+
import { EventService } from '../../_services/api/event.service';
7+
import { ActionDto } from '../../_models/actionDto';
8+
9+
@Component({
10+
selector: 'app-event-actions-add-edit-modal',
11+
templateUrl: './event-actions-add-edit-modal.component.html',
12+
styleUrls: ['./event-actions-add-edit-modal.component.scss'],
13+
})
14+
export class EventActionsAddEditModalComponent implements OnInit {
15+
@Input() selectedResource: ActionDto;
16+
myFormElements: FormBase<any>[] = [];
17+
formId = ADD_EDIT_FORM_ID;
18+
19+
constructor(
20+
public eventService: EventService,
21+
private formElementControlService: FormElementControlService
22+
) {}
23+
24+
ngOnInit(): void {
25+
if (this.selectedResource) {
26+
this.myFormElements = this.formElementControlService.setValuesForDynamicForm(
27+
this.selectedResource,
28+
JSON.parse(JSON.stringify(data.FORM_DATA_EVENT_ACTIONS_ADD_EDIT))
29+
);
30+
} else {
31+
this.myFormElements = JSON.parse(JSON.stringify(data.FORM_DATA_EVENT_ACTIONS_ADD_EDIT));
32+
}
33+
}
34+
}

src/app/events/event-components/event-actions/event-actions.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</mat-select>
1818
</mat-form-field>
1919
</form>
20-
<button mat-flat-button color="primary">Create</button>
20+
<button mat-flat-button color="primary" (click)="openCreateEventActionModal()">Create</button>
2121
</div>
2222

2323
<ul *ngIf="data.length" class="event-actions-list">

0 commit comments

Comments
 (0)