@csmart/ngc-smart-victim 1.18.7 → 1.18.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +6 -22
  4. package/src/lib/caseNote/caseNote.component.css +20 -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 +20 -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 +869 -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 +1384 -0
  35. package/src/lib/smart-victim.component.css +192 -0
  36. package/src/lib/smart-victim.component.html +138 -0
  37. package/src/lib/smart-victim.component.spec.ts +25 -0
  38. package/src/lib/smart-victim.component.ts +329 -0
  39. package/src/lib/smart-victim.model.ts +301 -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 +557 -0
  43. package/src/lib/victim-routing.module.ts +35 -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 +22 -0
  49. package/tsconfig.lib.json +37 -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 -1104
  68. package/esm2022/lib/smart-victim.component.mjs +0 -316
  69. package/esm2022/lib/smart-victim.model.mjs +0 -133
  70. package/esm2022/lib/smart-victim.module.mjs +0 -128
  71. package/esm2022/lib/smart-victim.service.mjs +0 -352
  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 -3263
  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 -205
  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,192 @@
1
+
2
+ div.services {
3
+ max-width: 500px;
4
+ margin: auto;
5
+ border: 3px solid #73AD21;
6
+ }
7
+
8
+ .rTable {
9
+ display: block;
10
+ width: 100%;
11
+ }
12
+ .rTableHeading, .rTableBody, .rTableFoot, .rTableRow{
13
+ clear: both;
14
+ }
15
+ .rTableHead, .rTableFoot{
16
+ background-color: #DDD;
17
+ font-weight: bold;
18
+ }
19
+ .rTableCell, .rTableHead {
20
+ border: 0px ;
21
+ float: left;
22
+ padding: 1px;
23
+ width: 28%;
24
+ }
25
+ .rTable:after {
26
+ visibility: hidden;
27
+ display: block;
28
+ font-size: 0;
29
+ content: " ";
30
+ clear: both;
31
+ height: 0;
32
+ }
33
+
34
+ .victimSearch{
35
+ display: grid;
36
+ grid-template-columns: 1fr 1fr 1fr;
37
+ grid-column-gap: 10px;
38
+ }
39
+
40
+ .edit-btn{
41
+ margin-right: 4px;
42
+ }
43
+ .main-container{
44
+ display: flex;
45
+ margin-top: 8px;
46
+ }
47
+
48
+ .add-action{
49
+ display: flex;
50
+ justify-content: flex-end;
51
+ margin-bottom: 8px;
52
+ }
53
+
54
+ .example-headers-align .mat-expansion-panel-header-title,
55
+ .example-headers-align .mat-expansion-panel-header-description {
56
+ flex-basis: 0;
57
+ }
58
+
59
+ .example-headers-align .mat-expansion-panel-header-description {
60
+ justify-content: space-between;
61
+ align-items: center;
62
+ }
63
+
64
+ mat-form-field {
65
+ margin-right: 12px;
66
+ }
67
+
68
+ .actions{
69
+ display: flex;
70
+ justify-content: space-around;
71
+ }
72
+
73
+
74
+ .Row
75
+ {
76
+ display: table;
77
+ width: 100%; /*Optional*/
78
+ table-layout: fixed; /*Optional*/
79
+
80
+ }
81
+ .Column
82
+ {
83
+ display: table-cell;
84
+
85
+ }
86
+
87
+ .sp-form textarea {
88
+ float: left;
89
+ margin-top: 20px;
90
+ margin-bottom: 10px;
91
+ width: 462px;
92
+ height: 70px;
93
+ overflow: auto;
94
+ box-sizing:border-box
95
+
96
+ }
97
+
98
+ .mat-column-lastName {
99
+ word-wrap: break-word !important;
100
+ white-space: unset !important;
101
+ flex: 0 0 15% !important;
102
+ width: 15% !important;
103
+ overflow-wrap: break-word;
104
+ word-wrap: break-word;
105
+
106
+ word-break: break-word;
107
+
108
+ -ms-hyphens: auto;
109
+ -moz-hyphens: auto;
110
+ -webkit-hyphens: auto;
111
+ hyphens: auto;
112
+ }
113
+
114
+ .mat-column-firstName {
115
+ word-wrap: break-word !important;
116
+ white-space: unset !important;
117
+ flex: 0 0 15% !important;
118
+ width: 15% !important;
119
+ overflow-wrap: break-word;
120
+ word-wrap: break-word;
121
+
122
+ word-break: break-word;
123
+
124
+ -ms-hyphens: auto;
125
+ -moz-hyphens: auto;
126
+ -webkit-hyphens: auto;
127
+ hyphens: auto;
128
+ }
129
+
130
+ .mat-column-relationship {
131
+ word-wrap: break-word !important;
132
+ white-space: unset !important;
133
+ flex: 0 0 15% !important;
134
+ width: 15% !important;
135
+ overflow-wrap: break-word;
136
+ word-wrap: break-word;
137
+
138
+ word-break: break-word;
139
+
140
+ -ms-hyphens: auto;
141
+ -moz-hyphens: auto;
142
+ -webkit-hyphens: auto;
143
+ hyphens: auto;
144
+ }
145
+
146
+ .mat-column-homePhone {
147
+ word-wrap: break-word !important;
148
+ white-space: unset !important;
149
+ flex: 0 0 15% !important;
150
+ width: 15% !important;
151
+ overflow-wrap: break-word;
152
+ word-wrap: break-word;
153
+
154
+ word-break: break-word;
155
+
156
+ -ms-hyphens: auto;
157
+ -moz-hyphens: auto;
158
+ -webkit-hyphens: auto;
159
+ hyphens: auto;
160
+ }
161
+
162
+ .mat-column-offenderName {
163
+ word-wrap: break-word !important;
164
+ white-space: unset !important;
165
+ flex: 0 0 15% !important;
166
+ width: 15% !important;
167
+ overflow-wrap: break-word;
168
+ word-wrap: break-word;
169
+
170
+ word-break: break-word;
171
+
172
+ -ms-hyphens: auto;
173
+ -moz-hyphens: auto;
174
+ -webkit-hyphens: auto;
175
+ hyphens: auto;
176
+ }
177
+
178
+ .mat-column-victimId {
179
+ word-wrap: break-word !important;
180
+ white-space: unset !important;
181
+ flex: 0 0 25% !important;
182
+ width: 25% !important;
183
+ overflow-wrap: break-word;
184
+ word-wrap: break-word;
185
+
186
+ word-break: break-word;
187
+
188
+ -ms-hyphens: auto;
189
+ -moz-hyphens: auto;
190
+ -webkit-hyphens: auto;
191
+ hyphens: auto;
192
+ }
@@ -0,0 +1,138 @@
1
+ <div *ngIf="showSearchForm">
2
+ <app-victim-search-form
3
+ (onSearch)="getVictimList($event)">
4
+ </app-victim-search-form>
5
+ </div>
6
+
7
+ <div *ngIf="showDetail">
8
+ <csmart-victim-detail [victimDetail]="victimDetail"
9
+ [staffId]="staffId"
10
+ [offenderId] ="offenderId"
11
+ [isIntake]="isIntake"
12
+ (onSave)="save($event)"
13
+ (onCancel)="cancel()" >
14
+ </csmart-victim-detail>
15
+ </div>
16
+ <div class="main-container">
17
+
18
+ <div class="add-action" *ngIf="showAdd">
19
+ <button mat-raised-button color="primary"
20
+ accessControl
21
+ [accessControlConfig]="createAccessControlConfig"
22
+ (click)="addRecord()">
23
+ <mat-icon>add</mat-icon>
24
+ Add Victim
25
+ </button>
26
+ &nbsp;&nbsp;
27
+
28
+ <div *ngIf="isIntake">
29
+ <button
30
+ mat-raised-button
31
+ color="primary"
32
+ accessControl
33
+ [accessControlConfig]="updateAccessControlConfig"
34
+ (click)="saveIntake()">
35
+ Continue
36
+ </button>
37
+ </div>
38
+
39
+ </div>
40
+ <div *ngIf="showListFlag">
41
+ <mat-card id="divVictim" >
42
+ <mat-card-content >
43
+ <mat-table #table [dataSource]="victimListDataSource" >
44
+
45
+ <ng-container matColumnDef="lastName">
46
+ <mat-header-cell *matHeaderCellDef>Victim Last Name</mat-header-cell>
47
+ <mat-cell *matCellDef="let row" > {{row.lastName}} </mat-cell>
48
+ </ng-container>
49
+
50
+
51
+ <ng-container matColumnDef="firstName">
52
+ <mat-header-cell *matHeaderCellDef >Victim First Name</mat-header-cell>
53
+ <mat-cell *matCellDef="let row" > {{row.firstName}} </mat-cell>
54
+ </ng-container>
55
+
56
+ <div *ngIf="showRelationshipColumn">
57
+ <ng-container matColumnDef="relationship">
58
+ <mat-header-cell *matHeaderCellDef >Relationship to Offender</mat-header-cell>
59
+ <mat-cell *matCellDef="let row" > {{row.relationship}} </mat-cell>
60
+ </ng-container>
61
+ </div>
62
+
63
+ <div *ngIf="showOffenderPhoneColumn">
64
+ <ng-container matColumnDef="homePhone">
65
+ <mat-header-cell *matHeaderCellDef >Phone Number</mat-header-cell>
66
+ <mat-cell *matCellDef="let row" >
67
+ Home phone: {{formatPhoneNumber(row.homePhone)}}<br>
68
+ Cell Phone: {{formatPhoneNumber(row.cellPhone)}}<br>
69
+ Work Phone: {{formatPhoneNumber(row.workPhone)}}
70
+
71
+ </mat-cell>
72
+ </ng-container>
73
+ </div>
74
+
75
+ <div *ngIf="showOffenderNameColumn">
76
+ <ng-container matColumnDef="offenderName">
77
+ <mat-header-cell *matHeaderCellDef>Offender Name</mat-header-cell>
78
+ <mat-cell *matCellDef="let row" > {{row.offenderName}} </mat-cell>
79
+ </ng-container>
80
+ </div>
81
+
82
+ <ng-container matColumnDef="victimId">
83
+ <mat-header-cell *matHeaderCellDef ></mat-header-cell>
84
+ <mat-cell *matCellDef="let row" >
85
+
86
+ <!-- <div *ngIf="accessByModule">
87
+ <mat-checkbox></mat-checkbox>
88
+ </div> -->
89
+
90
+ <div *ngIf="showEdit">
91
+ <button class="edit-btn" mat-icon-button color="primary" matTooltip="View/Edit Victim"
92
+ accessControl
93
+ [accessControlConfig]="updateAccessControlConfig"
94
+ (click)="editVictimDetail(row)">
95
+ <i class="material-icons">mode_edit</i>
96
+ </button>
97
+ </div>
98
+
99
+
100
+
101
+ &nbsp;&nbsp;
102
+
103
+ <div *ngIf="showCaseNote">
104
+ <button type="button" matTooltip="CaseNote" mat-raised-button color="primary"
105
+ accessControl
106
+ [accessControlConfig]="updateAccessControlConfig"
107
+ (click)="goToCaseNote(row.victimId)">
108
+ <span class="glyphicon glyphicon-pencil" ></span>&nbsp;Case Note
109
+ </button>
110
+ </div>
111
+ &nbsp;&nbsp;
112
+
113
+ <div *ngIf="showSafetyPlan">
114
+ <button type="button" matTooltip="safety plan" mat-raised-button color="primary"
115
+ accessControl
116
+ [accessControlConfig]="updateAccessControlConfig"
117
+ (click)="goToSaftyPlan(row.victimId)">
118
+ <span class="glyphicon glyphicon-pencil" ></span>&nbsp;Safety Plan
119
+ </button>
120
+ </div>
121
+ &nbsp;&nbsp;
122
+
123
+ </mat-cell>
124
+ </ng-container>
125
+
126
+ <mat-header-row *matHeaderRowDef="displayedColumns" class="example-header-row"></mat-header-row>
127
+ <mat-row *matRowDef="let row; columns: displayedColumns" class="example-row"></mat-row>
128
+ </mat-table>
129
+
130
+ <mat-paginator #paginator [pageSize]="10" [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
131
+ </mat-card-content>
132
+ </mat-card>
133
+ </div>
134
+
135
+ <div>
136
+ <b>{{msg}}</b>
137
+ </div>
138
+ </div>
@@ -0,0 +1,25 @@
1
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { NgcSmartVictimComponent } from './smart-victim.component';
4
+
5
+ describe('NgcSmartVictimComponent', () => {
6
+ let component: NgcSmartVictimComponent;
7
+ let fixture: ComponentFixture<NgcSmartVictimComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [ NgcSmartVictimComponent ]
12
+ })
13
+ .compileComponents();
14
+ }));
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(NgcSmartVictimComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,329 @@
1
+ import { DOCUMENT, DatePipe } from '@angular/common';
2
+ import { Component, OnInit, OnChanges, ViewChild, Input, Output, AfterViewInit, Inject} from '@angular/core';
3
+ import { ActivatedRoute,Router } from '@angular/router';
4
+ import { MatTableDataSource} from '@angular/material/table';
5
+ import { MatSort } from '@angular/material/sort';
6
+ import { MAT_DIALOG_DATA, MatDialogRef, MatDialog } from '@angular/material/dialog';
7
+ import {
8
+ SelectedOffender,
9
+ LoginStaff,
10
+ SmartAccessControlConfig,
11
+ AccessType,
12
+ } from "@csmart/ngc-smart-core";
13
+ import { NgcSmartVictimService } from './smart-victim.service';
14
+ import { ElementsVictim, VictimListFilter, Victim, SMART_WARRANT_URL } from './smart-victim.model';
15
+ import { SmartVictimDeleteConfirmComponent } from './smart-victim-delete-confirm.component';
16
+ //import { SmartVictimDetailComponent } from './smart-victim-detail/smart-victim-detail.component';
17
+
18
+ import {
19
+ IntakeStepStatusModel,
20
+ IntakeStep,
21
+ IntakeServicesComponent,
22
+ } from './intake.service';
23
+ import { MatPaginator } from '@angular/material/paginator';
24
+ import { MatSnackBar } from '@angular/material/snack-bar';
25
+ @Component({
26
+ selector: "csmart-victim",
27
+ templateUrl: "./smart-victim.component.html",
28
+ styleUrls: ["./smart-victim.component.css"],
29
+ })
30
+ export class NgcSmartVictimComponent implements OnInit, OnChanges, AfterViewInit {
31
+ @Input() offenderId: number;
32
+ @Input() staffId: number;
33
+ @Input() staffRole: string;
34
+ @Input() showCaseNote: string;
35
+ @Input() showSafetyPlan: string;
36
+ //@Input() showAdd: string;
37
+ @Input() showAdd: boolean;
38
+ @Input() showEdit: string;
39
+ @Input() showRelationshipColumn: boolean;
40
+ @Input() showOffenderNameColumn: boolean;
41
+ @Input() showOffenderPhoneColumn: boolean;
42
+ @Input() showSearchForm: boolean;
43
+ @Input() accessByModule: string;
44
+ @Input() intakeFlag: string;
45
+ @Input() appModuleId = '';
46
+ @Input() activatedRoute: ActivatedRoute = null;
47
+
48
+ @ViewChild(MatPaginator) paginator: MatPaginator;
49
+ @ViewChild(MatSort) sort: MatSort;
50
+ // @ViewChild(SmartVictimDetailComponent) child;
51
+
52
+ displayedColumns: string[];
53
+ victims: Victim[] = [];
54
+ victimDetail = <Victim>{};
55
+ showDetail = false;
56
+ victimListFilter: VictimListFilter = new VictimListFilter();
57
+ victimListDataSource = new MatTableDataSource();
58
+ doSpin: boolean = false;
59
+ showListFlag: boolean = false;
60
+ msg: string = "";
61
+ isIntake = false;
62
+
63
+ updateAccessControlConfig: SmartAccessControlConfig;
64
+ createAccessControlConfig: SmartAccessControlConfig;
65
+ deleteAccessControlConfig: SmartAccessControlConfig;
66
+ constructor(
67
+ private dialog: MatDialog,
68
+ private victimService: NgcSmartVictimService,
69
+ private router: Router,
70
+ private route: ActivatedRoute,
71
+ private snackBar: MatSnackBar,
72
+ private intakeService: IntakeServicesComponent,
73
+ @Inject(SMART_WARRANT_URL) private smartWarrantUrl: string,
74
+ @Inject(DOCUMENT) private document: any
75
+ ) {}
76
+
77
+ // private onChange(filter: VictimListFilter) {
78
+ // console.log('filter in onchange');
79
+ // console.log(filter);
80
+ // this.getVictimList(filter);
81
+ // }
82
+
83
+ applyFilter(filterValue: string) {
84
+ this.victimListDataSource.filter = filterValue.trim().toLowerCase();
85
+ }
86
+ addRecord() {
87
+ this.showDetail = true;
88
+ this.showAdd = false;
89
+ this.victimDetail = null;
90
+ this.showListFlag = false;
91
+ }
92
+
93
+ editVictimDetail(record) {
94
+ console.log("victim edit record");
95
+ console.log(record);
96
+ console.log(record.victimId);
97
+ this.victimDetail = record;
98
+ this.showDetail = true;
99
+ this.showAdd = false;
100
+ this.showListFlag = false;
101
+ }
102
+
103
+ save(detail: Victim) {
104
+ this.showDetail = false;
105
+ this.showAdd = true;
106
+ this.showListFlag = true;
107
+ }
108
+
109
+ cancel() {
110
+ this.showDetail = false;
111
+ this.victimDetail = <Victim>{};
112
+ }
113
+
114
+ ngAfterViewInit() {
115
+ this.victimListDataSource.paginator = this.paginator;
116
+ this.victimListDataSource.sort = this.sort;
117
+ }
118
+
119
+ ngOnChanges() {
120
+ this.updateAccessControlConfig = {
121
+ accessType: AccessType.UPDATE,
122
+ appModuleId: this.appModuleId,
123
+ roleId: null,
124
+ route: this.activatedRoute.snapshot,
125
+ };
126
+ this.createAccessControlConfig = {
127
+ accessType: AccessType.CREATE,
128
+ appModuleId: this.appModuleId,
129
+ roleId: null,
130
+ route: this.activatedRoute.snapshot,
131
+ };
132
+ this.deleteAccessControlConfig = {
133
+ accessType: AccessType.DELETE,
134
+ appModuleId: this.appModuleId,
135
+ roleId: null,
136
+ route: this.activatedRoute.snapshot,
137
+ };
138
+ }
139
+
140
+ ngOnInit() {
141
+ const queryParams = this.route.snapshot.queryParams;
142
+ if(queryParams['routeTo']) {
143
+ this.router.navigate([queryParams['routeTo']]);
144
+ }
145
+ var data = this.route.snapshot.data;
146
+ var myPath = this.router.url.slice(-10);
147
+
148
+
149
+ console.log("offender id at smart-victim");
150
+ console.log(this.offenderId);
151
+ console.log("staff id at smart-victim");
152
+ console.log(this.staffId);
153
+ console.log("insakeFlag at smart-victim");
154
+ console.log(this.intakeFlag);
155
+
156
+
157
+ console.log("smart-victim ngOnInit");
158
+ console.log(this.intakeFlag);
159
+ console.log(myPath);
160
+
161
+ if (this.intakeFlag == "true") {
162
+ this.isIntake = true;
163
+ }
164
+
165
+ this.displayedColumns = ["lastName", "firstName"];
166
+
167
+ if (
168
+ this.showRelationshipColumn == true ||
169
+ myPath == "victimList" ||
170
+ myPath == "victimHome"
171
+ ) {
172
+ this.displayedColumns.push("relationship");
173
+ }
174
+ if (this.showOffenderNameColumn == true) {
175
+ this.displayedColumns.push("offenderName");
176
+ }
177
+
178
+ if (
179
+ this.showOffenderPhoneColumn == true ||
180
+ myPath == "victimList" ||
181
+ myPath == "victimHome"
182
+ ) {
183
+ this.displayedColumns.push("homePhone");
184
+ }
185
+
186
+ this.displayedColumns.push("victimId");
187
+
188
+ if (this.showSearchForm == true) {
189
+ this.showListFlag = false;
190
+ }
191
+
192
+ console.log("this.showSearchForm");
193
+ console.log(this.showSearchForm);
194
+ console.log("myPath");
195
+ console.log(myPath);
196
+
197
+ if (
198
+ this.showSearchForm == false ||
199
+ myPath == "victimList" ||
200
+ myPath == "victimHome"
201
+ ) {
202
+ var myOffenderId;
203
+ if (this.offenderId) {
204
+ myOffenderId = this.offenderId;
205
+ } else {
206
+ console.log("back from previous page");
207
+ this.showAdd = true;
208
+ this.showRelationshipColumn = true;
209
+ //this.displayedColumns.push("relationship");
210
+ this.showOffenderPhoneColumn = true;
211
+ // this.displayedColumns.push("homePhone");
212
+ this.accessByModule = "true";
213
+ this.showEdit = "true";
214
+ this.showCaseNote = "true";
215
+ this.showSafetyPlan = "true";
216
+
217
+ myOffenderId = data.selectedOffender.offenderId;
218
+ }
219
+
220
+ const victimListFilter: VictimListFilter = {
221
+ offenderId: myOffenderId,
222
+ lastName: null,
223
+ firstName: null,
224
+ pdid: null,
225
+ birthDate: null,
226
+ };
227
+
228
+ console.log("victimListFilter in smar-victim componenet");
229
+ console.log(victimListFilter);
230
+
231
+ this.victimService
232
+ .getVictimListByFilter(victimListFilter)
233
+ .subscribe((data: Victim[]) => {
234
+ this.victims = data;
235
+ this.victimListDataSource.data = data;
236
+
237
+ console.log("victim data at line 245");
238
+ console.log(this.victims);
239
+ console.log("showListFlag");
240
+ console.log(this.showListFlag);
241
+ this.showListFlag = true;
242
+ if (data.length == 0) {
243
+ this.msg = "No Record Found!";
244
+ }
245
+ });
246
+ } else {
247
+ console.log("find filter");
248
+ console.log(this.victimListFilter);
249
+
250
+ if (this.showListFlag === true) {
251
+ if (this.victimListFilter != null) {
252
+ this.victimService
253
+ .getVictimListByFilter(this.victimListFilter)
254
+ .subscribe((data: Victim[]) => {
255
+ this.victims = data;
256
+ this.victimListDataSource.data = data;
257
+
258
+ console.log("victim data at line 279");
259
+ console.log(data);
260
+ });
261
+ }
262
+ }
263
+ }
264
+ }
265
+ // phone number format on the victim list
266
+ formatPhoneNumber(phoneNumberString) {
267
+ if (!phoneNumberString) return "";
268
+ var cleaned = ("" + phoneNumberString).replace(/\D/g, "");
269
+ var match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
270
+ if (match) {
271
+ return "(" + match[1] + ") " + match[2] + "-" + match[3];
272
+ }
273
+ return "";
274
+ }
275
+
276
+ saveIntake() {
277
+ if (!this.isIntake) {
278
+ return;
279
+ }
280
+ const intakeStep = <IntakeStepStatusModel>{
281
+ intakeStepId: IntakeStep.VictimInformation,
282
+ offenderId: this.offenderId,
283
+ modifiedBy: this.staffId,
284
+ };
285
+ this.intakeService
286
+ .updateIntakeSteps(this.offenderId, intakeStep)
287
+ .subscribe((res) => {
288
+ console.log("save intake step.");
289
+ this.snackBar.open("Status Saved.", "", {
290
+ duration: 3000,
291
+ });
292
+ //this.router.navigate(['/warrant '], { queryParams: { intake: 1 } });
293
+
294
+ this.document.location.href =
295
+ `${this.smartWarrantUrl}/?offenderId=${this.offenderId}&intakeFlag=${this.isIntake}&routeTo=warrant`;
296
+ });
297
+ }
298
+
299
+ goToCaseNote(victimId: number) {
300
+ this.router.navigate(["casenote", victimId, this.offenderId]);
301
+ }
302
+
303
+ goToSaftyPlan(victimId: number) {
304
+ this.router.navigate(["saftyPlan", victimId]);
305
+ }
306
+
307
+ getVictimList(filter: VictimListFilter) {
308
+ this.victimListFilter = filter;
309
+ console.log("this.victimListFilter inside getVictimList");
310
+ console.log(this.victimListFilter);
311
+ this.doSpin = true;
312
+ this.victimService.getVictimListByFilter(filter).subscribe(
313
+ (data: Victim[]) => {
314
+ this.doSpin = !this.doSpin;
315
+
316
+ if (data.length > 0) {
317
+ this.showListFlag = true;
318
+ this.victimListDataSource.data = data;
319
+
320
+ } else {
321
+ this.msg = "No record found!";
322
+ }
323
+ },
324
+ (err) => {
325
+ this.doSpin = !this.doSpin;
326
+ }
327
+ );
328
+ }
329
+ }