@csmart/ngc-smart-victim 1.18.17 → 1.18.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +4 -21
  4. package/src/lib/caseNote/caseNote.component.css +22 -0
  5. package/src/lib/caseNote/caseNote.component.html +188 -0
  6. package/src/lib/caseNote/caseNote.component.ts +265 -0
  7. package/src/lib/common-dialog/common-dialog.component.css +10 -0
  8. package/src/lib/common-dialog/common-dialog.component.html +23 -0
  9. package/src/lib/common-dialog/common-dialog.component.spec.ts +25 -0
  10. package/src/lib/common-dialog/common-dialog.component.ts +21 -0
  11. package/src/lib/common-dialog/common-dialog.module.ts +22 -0
  12. package/src/lib/common-dialog/common-dialog.service.ts +35 -0
  13. package/src/lib/contact/contact.component.css +22 -0
  14. package/src/lib/contact/contact.component.html +124 -0
  15. package/src/lib/contact/contact.component.ts +176 -0
  16. package/src/lib/email-notification.service.ts +42 -0
  17. package/src/lib/email.services.ts +51 -0
  18. package/src/lib/http.service.ts +34 -0
  19. package/src/lib/intake.service.ts +82 -0
  20. package/src/lib/loader.service.ts +11 -0
  21. package/src/lib/safetyPlan/serviceProvider.component.ts +94 -0
  22. package/src/lib/safetyPlan/victimSafetyPlan.component.css +27 -0
  23. package/src/lib/safetyPlan/victimSafetyPlan.component.html +85 -0
  24. package/src/lib/safetyPlan/victimSafetyPlan.component.ts +178 -0
  25. package/src/lib/safetyPlan/victimSafetyPlanDetail.component.html +234 -0
  26. package/src/lib/safetyPlan/victimSafetyPlanDetail.component.ts +492 -0
  27. package/src/lib/shared/app.shared.module.ts +111 -0
  28. package/src/lib/shared/validators/date.validator.ts +73 -0
  29. package/src/lib/shared/validators/index.ts +1 -0
  30. package/src/lib/smart-victim-delete-confirm.component.ts +35 -0
  31. package/src/lib/smart-victim-detail/smart-victim-detail.component.css +43 -0
  32. package/src/lib/smart-victim-detail/smart-victim-detail.component.html +876 -0
  33. package/src/lib/smart-victim-detail/smart-victim-detail.component.spec.ts +25 -0
  34. package/src/lib/smart-victim-detail/smart-victim-detail.component.ts +1459 -0
  35. package/src/lib/smart-victim.component.css +245 -0
  36. package/src/lib/smart-victim.component.html +132 -0
  37. package/src/lib/smart-victim.component.spec.ts +25 -0
  38. package/src/lib/smart-victim.component.ts +334 -0
  39. package/src/lib/smart-victim.model.ts +312 -0
  40. package/src/lib/smart-victim.module.ts +110 -0
  41. package/src/lib/smart-victim.service.spec.ts +12 -0
  42. package/src/lib/smart-victim.service.ts +576 -0
  43. package/src/lib/victim-routing.module.ts +36 -0
  44. package/{lib/victimSearch/VictimSearchFilter.d.ts → src/lib/victimSearch/VictimSearchFilter.ts} +9 -7
  45. package/src/lib/victimSearch/victimSearchForm.component.html +35 -0
  46. package/src/lib/victimSearch/victimSearchForm.component.ts +41 -0
  47. package/{public-api.d.ts → src/public-api.ts} +12 -7
  48. package/src/test.ts +16 -0
  49. package/tsconfig.lib.json +36 -0
  50. package/tsconfig.spec.json +17 -0
  51. package/tslint.json +17 -0
  52. package/esm2022/csmart-ngc-smart-victim.mjs +0 -5
  53. package/esm2022/lib/caseNote/caseNote.component.mjs +0 -194
  54. package/esm2022/lib/common-dialog/common-dialog.component.mjs +0 -23
  55. package/esm2022/lib/common-dialog/common-dialog.module.mjs +0 -34
  56. package/esm2022/lib/common-dialog/common-dialog.service.mjs +0 -33
  57. package/esm2022/lib/contact/contact.component.mjs +0 -140
  58. package/esm2022/lib/email.services.mjs +0 -42
  59. package/esm2022/lib/intake.service.mjs +0 -57
  60. package/esm2022/lib/safetyPlan/serviceProvider.component.mjs +0 -99
  61. package/esm2022/lib/safetyPlan/victimSafetyPlan.component.mjs +0 -116
  62. package/esm2022/lib/safetyPlan/victimSafetyPlanDetail.component.mjs +0 -340
  63. package/esm2022/lib/shared/app.shared.module.mjs +0 -215
  64. package/esm2022/lib/shared/validators/date.validator.mjs +0 -59
  65. package/esm2022/lib/shared/validators/index.mjs +0 -2
  66. package/esm2022/lib/smart-victim-delete-confirm.component.mjs +0 -44
  67. package/esm2022/lib/smart-victim-detail/smart-victim-detail.component.mjs +0 -1157
  68. package/esm2022/lib/smart-victim.component.mjs +0 -317
  69. package/esm2022/lib/smart-victim.model.mjs +0 -143
  70. package/esm2022/lib/smart-victim.module.mjs +0 -128
  71. package/esm2022/lib/smart-victim.service.mjs +0 -370
  72. package/esm2022/lib/victim-routing.module.mjs +0 -41
  73. package/esm2022/lib/victimSearch/VictimSearchFilter.mjs +0 -3
  74. package/esm2022/lib/victimSearch/victimSearchForm.component.mjs +0 -38
  75. package/esm2022/public-api.mjs +0 -11
  76. package/fesm2022/csmart-ngc-smart-victim.mjs +0 -3345
  77. package/fesm2022/csmart-ngc-smart-victim.mjs.map +0 -1
  78. package/index.d.ts +0 -5
  79. package/lib/caseNote/caseNote.component.d.ts +0 -51
  80. package/lib/common-dialog/common-dialog.component.d.ts +0 -14
  81. package/lib/common-dialog/common-dialog.module.d.ts +0 -8
  82. package/lib/common-dialog/common-dialog.service.d.ts +0 -11
  83. package/lib/contact/contact.component.d.ts +0 -40
  84. package/lib/email.services.d.ts +0 -11
  85. package/lib/intake.service.d.ts +0 -57
  86. package/lib/safetyPlan/serviceProvider.component.d.ts +0 -19
  87. package/lib/safetyPlan/victimSafetyPlan.component.d.ts +0 -54
  88. package/lib/safetyPlan/victimSafetyPlanDetail.component.d.ts +0 -62
  89. package/lib/shared/app.shared.module.d.ts +0 -33
  90. package/lib/shared/validators/date.validator.d.ts +0 -9
  91. package/lib/shared/validators/index.d.ts +0 -1
  92. package/lib/smart-victim-delete-confirm.component.d.ts +0 -12
  93. package/lib/smart-victim-detail/smart-victim-detail.component.d.ts +0 -129
  94. package/lib/smart-victim.component.d.ts +0 -69
  95. package/lib/smart-victim.model.d.ts +0 -210
  96. package/lib/smart-victim.module.d.ts +0 -49
  97. package/lib/smart-victim.service.d.ts +0 -71
  98. package/lib/victim-routing.module.d.ts +0 -7
  99. package/lib/victimSearch/victimSearchForm.component.d.ts +0 -14
@@ -0,0 +1,35 @@
1
+ import { Observable } from 'rxjs';
2
+ import { CommonDialogComponent } from './common-dialog.component';
3
+ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
4
+ import { Injectable } from '@angular/core';
5
+
6
+ @Injectable()
7
+ export class CommonDialogService {
8
+
9
+ constructor(private dialog: MatDialog) { }
10
+
11
+ public confirm(title: string, message: string, cmdYesTitle: string, cmdNoTitle: string): Observable<boolean> {
12
+
13
+ let dialogRef: MatDialogRef<CommonDialogComponent>;
14
+
15
+ dialogRef = this.dialog.open(CommonDialogComponent);
16
+ dialogRef.componentInstance.title = title;
17
+ dialogRef.componentInstance.message = message;
18
+ dialogRef.componentInstance.cmdYesTitle = cmdYesTitle;
19
+ dialogRef.componentInstance.cmdNoTitle = cmdNoTitle;
20
+ return dialogRef.afterClosed();
21
+ }
22
+
23
+ public warning(title: string, message: string, cmdOkTitle: string, ): Observable<boolean> {
24
+
25
+ let dialogRef: MatDialogRef<CommonDialogComponent>;
26
+
27
+ dialogRef = this.dialog.open(CommonDialogComponent);
28
+ dialogRef.componentInstance.title = title;
29
+ dialogRef.componentInstance.message = message;
30
+ dialogRef.componentInstance.cmdYesTitle = cmdOkTitle;
31
+
32
+ return dialogRef.afterClosed();
33
+ }
34
+
35
+ }
@@ -0,0 +1,22 @@
1
+
2
+ mat-form-field {
3
+ width: 50%;
4
+ }
5
+ .container{
6
+ margin: 16px;
7
+ display: grid;
8
+ grid-template-columns: repeat(1, 1fr);
9
+ grid-gap: 10px;
10
+ grid-auto-rows: minmax(50px, auto);
11
+ justify-items: stretch;
12
+ }
13
+
14
+ /* TODO(mdc-migration): The following rule targets internal classes of select that may no longer apply for the MDC version. */
15
+ .mat-select-content{
16
+ width:300px;
17
+ }
18
+
19
+ /* TODO(mdc-migration): The following rule targets internal classes of select that may no longer apply for the MDC version. */
20
+ .mat-select-inner{
21
+ width:290px;
22
+ }
@@ -0,0 +1,124 @@
1
+
2
+ <mat-card>
3
+ <mat-card-header>
4
+
5
+ </mat-card-header>
6
+ <mat-card-content>
7
+
8
+ <mat-toolbar color="primary">
9
+ <h4 class="card-header" >Contact detail</h4>
10
+ </mat-toolbar>
11
+ <br>
12
+
13
+
14
+
15
+ <mat-card>
16
+ <div class='container'>
17
+ <form [formGroup]="contactForm" #contactDetailForm="ngForm" >
18
+
19
+
20
+
21
+ <div>
22
+ <mat-form-field>
23
+ <mat-label>Contact Date:</mat-label>
24
+ <input matInput formControlName="contactDate"
25
+ (click)="contactDate.open()"
26
+ [matDatepicker]="contactDate"
27
+ placeholder="Choose a contact date"
28
+ [(ngModel)]="editContact.contactDate" required>
29
+ <mat-datepicker-toggle matSuffix [for]="contactDate"></mat-datepicker-toggle>
30
+ <mat-datepicker #contactDate></mat-datepicker>
31
+ </mat-form-field>
32
+
33
+ <div class="validation-errors">
34
+ <div
35
+ class="help-block"
36
+ *ngIf="
37
+ contactForm
38
+ .get('contactDate')
39
+ .hasError('required') &&
40
+ (contactForm.get('contactDate').dirty ||
41
+ contactForm.get('contactDate').touched)">
42
+ <mat-error>Contact date is
43
+ <strong>required</strong></mat-error>
44
+ </div>
45
+ <div
46
+ class="help-block"
47
+ *ngIf="
48
+ contactForm.get('contactDate').hasError('date') &&
49
+ (contactForm.get('contactDate').dirty ||
50
+ contactForm.get('contactDate').touched)">
51
+ <mat-error >future Date is <strong>not allowed</strong> for contact date</mat-error>
52
+ </div>
53
+ </div>
54
+ </div>
55
+
56
+
57
+
58
+ <div>
59
+ <mat-form-field>
60
+ <mat-label>Contact Method:</mat-label>
61
+ <mat-select placeholder="contactMethod" formControlName="contactMethod" required [(ngModel)]="editContact.victimContactMethodId">
62
+ <mat-option *ngFor=" let contactMethod of contactMethods" [value]="contactMethod.victimContactMethodId" >{{contactMethod.name}}</mat-option>
63
+ </mat-select>
64
+ </mat-form-field>
65
+ </div>
66
+
67
+ <div>
68
+ <mat-form-field class="mat-select-content">
69
+ <mat-label>Contact By:</mat-label>
70
+ <mat-select formControlName="contactBy" required [(ngModel)]="editContact.contactedBy" class="mat-select-inner">
71
+ <mat-option *ngFor=" let item of staff" [value]="item.staffId" >{{ item.fullName}}</mat-option>
72
+ </mat-select>
73
+ </mat-form-field>
74
+ </div>
75
+
76
+ <div>
77
+
78
+ <mat-form-field>
79
+ <mat-label>Comments </mat-label>
80
+ <textarea
81
+ matInput
82
+ placeholder=""
83
+ required formControlName="comment"
84
+ [(ngModel)]="editContact.comment"
85
+ cdkTextareaAutosize
86
+ #autosize="cdkTextareaAutosize"
87
+ cdkAutosizeMinRows="1"
88
+ cdkAutosizeMaxRows="5">
89
+ </textarea>
90
+ </mat-form-field>
91
+ </div>
92
+
93
+ <div>
94
+ <mat-form-field>
95
+ <mat-label>Next Contact Date: </mat-label>
96
+ <input matInput formControlName="nextContactDate"
97
+ (click)="nextContactDate.open()"
98
+ [matDatepicker]="nextContactDate"
99
+ placeholder="Choose a next contact date"
100
+ [(ngModel)]="editContact.nextContactDate" required>
101
+ <mat-datepicker-toggle matSuffix [for]="nextContactDate"></mat-datepicker-toggle>
102
+ <mat-datepicker #nextContactDate></mat-datepicker>
103
+ </mat-form-field>
104
+ </div>
105
+
106
+ <div>
107
+ <!-- <button mat-stroked-button color="primary" (click)="saveContact()" [disabled]="!contactForm.form.valid" >Save</button> -->
108
+ <button mat-stroked-button color="primary" (click)="saveContact()" [disabled]="!contactForm.valid" >Save</button>
109
+ &nbsp;&nbsp;<button mat-stroked-button color="primary" >Cancel</button>
110
+ &nbsp;&nbsp;<button mat-stroked-button color="primary" (click)="back()" >Back</button>
111
+ </div>
112
+
113
+ </form>
114
+ </div>
115
+ </mat-card>
116
+
117
+
118
+ <br>
119
+
120
+
121
+
122
+
123
+ </mat-card-content>
124
+ </mat-card>
@@ -0,0 +1,176 @@
1
+ import { Component, OnInit,Inject,OnChanges, Input, Output, EventEmitter,AfterViewInit } from '@angular/core';
2
+ import { NgcSmartVictimService } from '../smart-victim.service';
3
+ import { UntypedFormControl, UntypedFormGroup, FormBuilder,Validators } from '@angular/forms';
4
+ import { CommonDialogService} from '.././common-dialog/common-dialog.service';
5
+ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
6
+ import { SelectedOffender, LoginStaff } from '@csmart/ngc-smart-core';
7
+ import { Router, ActivatedRoute } from '@angular/router';
8
+ import { Contact} from '../smart-victim.model';
9
+ import { SmartAuthService } from '@csmart/ngc-smart-core';
10
+ import { dateValidator,passDateValidator,dateLessThan } from '../shared/validators';
11
+ import { MatSnackBar } from '@angular/material/snack-bar';
12
+
13
+ @Component({
14
+ templateUrl: './contact.component.html',
15
+ styleUrls: ['./contact.component.css'],
16
+ })
17
+ export class ContactComponent implements OnInit,AfterViewInit {
18
+
19
+ offenderId: number;
20
+ loginStaff: LoginStaff;
21
+ contact: Contact;
22
+ editContact: Contact = <Contact>{};
23
+ errorMessage: string;
24
+ contactMethods: any[];
25
+ contactBy: any[];
26
+ result: any;
27
+ victimName: string;
28
+ staffId: number;
29
+ victimId: number;
30
+ hiddenAddNewFlag: boolean;
31
+ contactForm: UntypedFormGroup;
32
+ private sub: any;
33
+ staff: any = {};
34
+
35
+ constructor(
36
+
37
+ private _victimServicesComponent: NgcSmartVictimService,
38
+ //private commonDialogService: CommonDialogService,
39
+ public snackBar: MatSnackBar,
40
+ private route: ActivatedRoute,
41
+ private router: Router,
42
+ private smartAuthService: SmartAuthService,
43
+
44
+ ) {
45
+ this.contactForm = new UntypedFormGroup({
46
+ //contactDate: new FormControl(),
47
+ contactDate:new UntypedFormControl('', Validators.compose([
48
+ dateValidator() ])),
49
+
50
+ contactMethod: new UntypedFormControl(),
51
+ contactBy: new UntypedFormControl(),
52
+ comment: new UntypedFormControl(),
53
+ nextContactDate: new UntypedFormControl()
54
+ });
55
+ }
56
+
57
+ ngAfterViewInit() {
58
+ this.smartAuthService.setPermission('Victim', this.route.snapshot);
59
+ }
60
+
61
+ ngOnInit() {
62
+ var data = this.route.snapshot.data;
63
+ this.loginStaff = data.loginStaff;
64
+ this.staffId = this.loginStaff.staffId;
65
+
66
+ this.staff = [
67
+ {
68
+ staffId: this.loginStaff.staffId,
69
+ fullName: this.loginStaff.firstName + ' ' + this.loginStaff.lastName,
70
+ },
71
+ ];
72
+
73
+
74
+ this.sub = this.route.params.subscribe(params => {
75
+ this.victimId = params['victimId'];
76
+ console.log('my this.victimId');
77
+ console.log(this.victimId);
78
+
79
+ });
80
+
81
+
82
+ this._victimServicesComponent.getContactMethods().subscribe(
83
+ (items: any) => {
84
+ this.contactMethods = items;
85
+ console.log('this.contactMethods');
86
+ console.log(this.contactMethods);
87
+ }
88
+ );
89
+
90
+ // this._victimServicesComponent.getContactBys().subscribe(
91
+ // (items: any) => {
92
+ // this.contactBy= items;
93
+ // }
94
+ // );
95
+
96
+
97
+ // this._victimServicesComponent.getContacts(this.victimId).subscribe(
98
+ // caseNoteList => {
99
+
100
+ // this.caseNoteList = caseNoteList;
101
+
102
+ // }
103
+ // );
104
+
105
+ }
106
+ onEditContact(victimContactId: number){
107
+
108
+ // this.hiddenDetailFlag =false;
109
+ // this.hiddenAddNewFlag = true;
110
+
111
+ // this.addDisableFlag = true;
112
+ // this.editCaseNote = this.caseNoteList.find(x => x.victimCaseNoteId === victimCaseNoteId);
113
+
114
+ }
115
+
116
+ // onDeleteCaseNote(victimCaseNoteId: number){
117
+ // this.commonDialogService
118
+ // .confirm('', 'Do you want to delete this case note?', 'Yes', 'No')
119
+ // .subscribe(res => {this.result = res;
120
+ // if (this.result) {
121
+ // this._victimServicesComponent.deleteCaseNote(victimCaseNoteId, this.staffId)
122
+ // .subscribe(result => {
123
+ // this.snackBar.open('delete Successfully !', '', { duration: 3000,});
124
+
125
+ // this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
126
+ // caseNoteList => {
127
+ // this.caseNoteList = caseNoteList;
128
+
129
+ // }
130
+ // );
131
+ // }
132
+ // );
133
+ // }
134
+
135
+ // });
136
+ // }
137
+ onAddNew(){
138
+
139
+ // this.editCas.caseNoteDate = null;
140
+ // this.editCaseNote.contactTypeId = null;
141
+ // this.editCaseNote.victimContactPurposeId = null;
142
+ // this.editCaseNote.comment = null;
143
+ }
144
+ back(){
145
+
146
+
147
+ this.router.navigate(['victimDetail', this.victimId ]);
148
+ }
149
+
150
+ saveContact(){
151
+
152
+ const contact: Contact = {
153
+ victimId:this.victimId,
154
+ victimContactId: 0,
155
+ contactDate: this.editContact.contactDate,
156
+ victimContactMethodId: this.editContact.victimContactMethodId,
157
+ contactMethod: null,
158
+ contactedByName: null,
159
+ contactedBy: this.editContact.contactedBy,
160
+ comment: this.editContact.comment,
161
+ nextContactDate: this.editContact.nextContactDate,
162
+ modifiedBy: this.staffId,
163
+
164
+ };
165
+ this._victimServicesComponent.addContact(contact).subscribe(
166
+ result => {
167
+ this.snackBar.open('Saved Successfully !', '', {
168
+ duration: 3000,
169
+ });
170
+
171
+ this.router.navigate(['victimDetail', this.victimId ]);
172
+ }
173
+ );
174
+ }
175
+
176
+ }
@@ -0,0 +1,42 @@
1
+ import { HttpClient } from "@angular/common/http";
2
+ import { Observable } from "rxjs";
3
+ import { map } from "rxjs/operators";
4
+ import { Injectable } from "@angular/core";
5
+ import { environment } from "../environments/environment";
6
+
7
+ @Injectable()
8
+ export class EmailNotificationService {
9
+ constructor(private http: HttpClient) {}
10
+
11
+ createEmail(
12
+ emailTemplateId: string,
13
+ parameters: string,
14
+ modifiedBy: number
15
+ ): Observable<any> {
16
+ const mutationString = `
17
+ mutation {
18
+ createEmail(
19
+ input: {
20
+ emailTemplateId: "${emailTemplateId}"
21
+ parameters: "${parameters}"
22
+ modifiedBy: ${modifiedBy}
23
+ }
24
+ ) {
25
+ message
26
+ data {
27
+ emailQueueId
28
+ recipient
29
+ }
30
+ }
31
+ }
32
+ `;
33
+
34
+ return this.http
35
+ .post<any>(environment.smartApiUrl, { query: mutationString })
36
+ .pipe(
37
+ map(({ data }) => {
38
+ return data.createEmail;
39
+ })
40
+ );
41
+ }
42
+ }
@@ -0,0 +1,51 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Apollo } from 'apollo-angular';
3
+ import { Observable } from 'rxjs';
4
+ import gql from 'graphql-tag';
5
+
6
+ @Injectable({
7
+ providedIn: 'root',
8
+ })
9
+ export class EmailService {
10
+ constructor(private apollo: Apollo) {}
11
+
12
+ createCaseNoteEmail(
13
+ templateId: string,
14
+ offenderId: number,
15
+ modifiedBy: number,
16
+ ) : Observable<any> {
17
+
18
+ return this.createEmail(
19
+ templateId,
20
+ `{\\"offenderId\\": ${offenderId}}`,
21
+ modifiedBy,
22
+ );
23
+
24
+ }
25
+
26
+
27
+ createEmail(
28
+ emailTemplateId: string,
29
+ parameters: string,
30
+ modifiedBy: number,
31
+ ): Observable<any> {
32
+ const mutation = `mutation {
33
+ createEmail(input: {
34
+ emailTemplateId: "${emailTemplateId}"
35
+ parameters: "${parameters}"
36
+ modifiedBy: ${modifiedBy}
37
+ }) {
38
+ message
39
+ data {
40
+ emailQueueId
41
+ }
42
+ }
43
+ }`;
44
+ console.log(mutation);
45
+ return this.apollo.mutate({
46
+ mutation: gql`
47
+ ${mutation}
48
+ `,
49
+ });
50
+ }
51
+ }
@@ -0,0 +1,34 @@
1
+
2
+ import { throwError as observableThrowError, Observable, throwError } from 'rxjs';
3
+ import { Injectable } from '@angular/core';
4
+ import { HttpClient, HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
5
+ import { catchError, finalize, map } from 'rxjs/operators';
6
+ import { LoaderService } from './loader.service';
7
+
8
+ export enum ResponseContentType {
9
+ Blob, Json
10
+ }
11
+
12
+ @Injectable()
13
+ export class HttpService {
14
+
15
+ constructor(private http: HttpClient,
16
+ private loaderService: LoaderService
17
+ ) { }
18
+
19
+ private handleError(error: HttpErrorResponse) {
20
+ return throwError(() => new Error(error.message));
21
+ }
22
+ private showLoader(): void {
23
+ this.loaderService.display(true);
24
+ }
25
+ private hideLoader(): void {
26
+ this.loaderService.display(false);
27
+ }
28
+ public sendEmailTemplate(emailTemplateId: string, data: any, staffId: number) : Observable<any> {
29
+ return this.sendEmail({ emailTemplateId: emailTemplateId, emailParams: JSON.stringify(data), staffId: staffId, CaseDocumentIds: '' });
30
+ }
31
+ private sendEmail(data: any) : Observable<any> {
32
+ return this.http.post('https://smart-service-offender-uat.azurewebsites.net/v1/', + '/Emails/', data).pipe();
33
+ }
34
+ }
@@ -0,0 +1,82 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { map, filter } from 'rxjs/operators';
4
+ import { Injectable,Inject } from '@angular/core';
5
+ import { SMART_OFFENDER_SERVICE_URL} from './smart-victim.model';
6
+
7
+
8
+ const headers = new Headers({ 'Content-Type': 'application/json' });
9
+ @Injectable({
10
+ providedIn: 'root'
11
+ })
12
+ export class IntakeServicesComponent {
13
+ //serviceData = environment.smartOffenderServiceUrl;
14
+ constructor(private http: HttpClient,
15
+ @Inject(SMART_OFFENDER_SERVICE_URL) private smartOffenderServiceUrl: string,
16
+ ) {}
17
+ getIntakeByOffender(offenderId: any): Observable<Intake> {
18
+ return this.http
19
+ .get<Intake>(this.smartOffenderServiceUrl + 'IntakeBasic/offender/' + offenderId)
20
+ .pipe();
21
+ }
22
+
23
+ updateIntakeSteps(
24
+ offenderId: number,
25
+ intakeStepStatus: IntakeStepStatusModel,
26
+ ) {
27
+ return this.http.put(
28
+ this.smartOffenderServiceUrl + '/IntakeStepStatus/' + offenderId,
29
+ intakeStepStatus,
30
+ );
31
+ }
32
+ }
33
+
34
+ export interface Intake {
35
+ intakeId: number;
36
+ offenderId: number;
37
+ intakeOffenderReportStatusId?: any;
38
+ startDate: string;
39
+ endDate?: any;
40
+ assignmentId?: any;
41
+ modifiedBy: number;
42
+ }
43
+
44
+ export interface IntakeStepStatus {
45
+ intakeStepStatusId: number;
46
+ intakeId: number;
47
+ intakeStepId: string;
48
+ completedDate: Date;
49
+ modifiedBy: number;
50
+ }
51
+
52
+ export interface IntakeStepStatusModel
53
+ {
54
+ offenderId: number;
55
+ intakeStepId: string;
56
+ modifiedBy: number;
57
+ }
58
+
59
+ export class IntakeStep{
60
+ public static PhysicalInformation = "PHYSIN";
61
+ public static Photo = "PHOTOS";
62
+ public static HousingInformation = "HOUSE";
63
+ public static DocketInformation = "DOCKET";
64
+ public static Alias = "ALIAS";
65
+ public static IntakeBasicInformation = "INTKBI";
66
+ public static ContactInformation = "CONTCT";
67
+ public static DeceasedInformation = "DEATH";
68
+ public static DriversLicense = "DRVLIC";
69
+ public static EmploymentInformation = "EMPLOY";
70
+ public static GangAffiliation = "GANG";
71
+ public static HealthInsurance = "HLTHINS";
72
+ public static Identification = "IDNTFCTN";
73
+ public static InternetIdentifier = "INTERNETID";
74
+ public static MilitaryService = "MLTSVC";
75
+ public static School = "SCHOOL";
76
+ public static SelectiveService = "SLCTVSVC";
77
+ public static Vehicle = "VEHICLE";
78
+ public static VictimInformation = "VICTIM";
79
+ public static WarrantInformation = "WARRNT";
80
+ public static RunningRecord = "RUNREC";
81
+ public static Signature = "SIGN";
82
+ }
@@ -0,0 +1,11 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { BehaviorSubject } from 'rxjs';
3
+
4
+ @Injectable()
5
+ export class LoaderService {
6
+ public status: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
7
+
8
+ display(value: boolean) {
9
+ this.status.next(value);
10
+ }
11
+ }
@@ -0,0 +1,94 @@
1
+ import { Component, OnInit, Inject } from '@angular/core';
2
+ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
3
+ import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
4
+ import { ProvidersDialogData} from '../smart-victim.model';
5
+ import { NgcSmartVictimService } from '../smart-victim.service';
6
+
7
+
8
+ @Component({
9
+ selector: 'app-service-provider',
10
+ template: `
11
+ <h1 mat-dialog-title> {{data.serviceType}}</h1>
12
+ <div mat-dialog-content class="main" [formGroup]="spForm">
13
+ <mat-form-field>
14
+ <mat-label>service provider</mat-label>
15
+
16
+ <mat-select formControlName="voteeProviderId">
17
+ <mat-option
18
+ *ngFor="let providerOption of programProviders"
19
+ [value]="providerOption.victimProgramProviderId">{{ providerOption.victimProgramProvider }}
20
+ </mat-option>
21
+ </mat-select>
22
+
23
+ </mat-form-field>
24
+
25
+ </div>
26
+ <div mat-dialog-actions class="actions">
27
+ <button mat-stroked-button color="primary" (click)="cancel()" cdkFocusInitial>
28
+ Cancel Change
29
+ </button>
30
+ <button mat-stroked-button color="primary" [mat-dialog-close]="spForm.value" >
31
+ Save Change
32
+ </button>
33
+ </div>
34
+ `,
35
+ styles: [
36
+ `
37
+ .main {
38
+ width: 100%;
39
+ display: flex;
40
+ flex-direction: column;
41
+ }
42
+
43
+ .actions{
44
+ display: flex;
45
+ }
46
+ `,
47
+ ],
48
+ })
49
+
50
+
51
+
52
+ export class SeriveProviderComponent implements OnInit {
53
+ spForm: UntypedFormGroup;
54
+ programProviders:[];
55
+
56
+ constructor(
57
+ private formBuilder: UntypedFormBuilder,
58
+ public dialogRef: MatDialogRef<SeriveProviderComponent>,
59
+ private _victimServicesComponent: NgcSmartVictimService,
60
+ @Inject(MAT_DIALOG_DATA) public data: ProvidersDialogData,
61
+ ) {
62
+
63
+
64
+ this.spForm = this.formBuilder.group({
65
+ voteeProviderId: [''],
66
+
67
+ });
68
+ }
69
+
70
+ cancel() {
71
+ this.dialogRef.close();
72
+ }
73
+
74
+ ngOnInit() {
75
+ console.log('data.providerCollections')
76
+ console.log(this.data);
77
+ console.log(this.data.serviceTypeId);
78
+
79
+ this._victimServicesComponent.getvVictimServiceTypeProgramProviders().subscribe(
80
+ (items: any) => {
81
+ this.programProviders = items.filter( (y) => (y.victimServiceTypeId === this.data.serviceTypeId));
82
+ console.log('this.programProviders');
83
+ console.log(this.programProviders);
84
+ }
85
+ );
86
+
87
+ this.spForm.get('voteeProviderId').valueChanges.subscribe(voteeProviderId => {
88
+ console.log('voteeProviderId in service provider component.')
89
+ console.log(voteeProviderId)
90
+
91
+
92
+ })
93
+ }
94
+ }