@csmart/ngc-smart-victim 0.1.5 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +13 -26
  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 +248 -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 +25 -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/intake.service.ts +82 -0
  17. package/src/lib/safetyPlan/serviceProvider.component.ts +94 -0
  18. package/src/lib/safetyPlan/victimSafetyPlan.component.css +27 -0
  19. package/src/lib/safetyPlan/victimSafetyPlan.component.html +85 -0
  20. package/src/lib/safetyPlan/victimSafetyPlan.component.ts +178 -0
  21. package/src/lib/safetyPlan/victimSafetyPlanDetail.component.html +234 -0
  22. package/src/lib/safetyPlan/victimSafetyPlanDetail.component.ts +492 -0
  23. package/src/lib/shared/app.shared.module.ts +118 -0
  24. package/src/lib/shared/directives/phone-mask.directive.ts +41 -0
  25. package/src/lib/shared/validators/date.validator.ts +73 -0
  26. package/src/lib/shared/validators/index.ts +1 -0
  27. package/src/lib/smart-victim-delete-confirm.component.ts +35 -0
  28. package/src/lib/smart-victim-detail/smart-victim-detail.component.css +43 -0
  29. package/src/lib/smart-victim-detail/smart-victim-detail.component.html +860 -0
  30. package/src/lib/smart-victim-detail/smart-victim-detail.component.spec.ts +25 -0
  31. package/src/lib/smart-victim-detail/smart-victim-detail.component.ts +1241 -0
  32. package/src/lib/smart-victim.component.css +192 -0
  33. package/src/lib/smart-victim.component.html +133 -0
  34. package/src/lib/smart-victim.component.spec.ts +25 -0
  35. package/src/lib/smart-victim.component.ts +323 -0
  36. package/src/lib/smart-victim.model.ts +301 -0
  37. package/src/lib/smart-victim.module.ts +116 -0
  38. package/src/lib/smart-victim.service.spec.ts +12 -0
  39. package/src/lib/smart-victim.service.ts +563 -0
  40. package/src/lib/victim-routing.module.ts +34 -0
  41. package/{lib/victimSearch/VictimSearchFilter.d.ts → src/lib/victimSearch/VictimSearchFilter.ts} +4 -2
  42. package/src/lib/victimSearch/victimSearchForm.component.html +35 -0
  43. package/src/lib/victimSearch/victimSearchForm.component.ts +41 -0
  44. package/src/public-api.ts +12 -0
  45. package/src/test.ts +22 -0
  46. package/tsconfig.lib.json +37 -0
  47. package/tsconfig.spec.json +17 -0
  48. package/tslint.json +17 -0
  49. package/bundles/csmart-ngc-smart-victim.umd.js +0 -6426
  50. package/bundles/csmart-ngc-smart-victim.umd.js.map +0 -1
  51. package/bundles/csmart-ngc-smart-victim.umd.min.js +0 -16
  52. package/bundles/csmart-ngc-smart-victim.umd.min.js.map +0 -1
  53. package/csmart-ngc-smart-victim.d.ts +0 -19
  54. package/csmart-ngc-smart-victim.metadata.json +0 -1
  55. package/esm2015/csmart-ngc-smart-victim.js +0 -25
  56. package/esm2015/lib/caseNote/caseNote.component.js +0 -349
  57. package/esm2015/lib/common-dialog/common-dialog.component.js +0 -46
  58. package/esm2015/lib/common-dialog/common-dialog.module.js +0 -32
  59. package/esm2015/lib/common-dialog/common-dialog.service.js +0 -63
  60. package/esm2015/lib/contact/contact.component.js +0 -228
  61. package/esm2015/lib/intake.service.js +0 -183
  62. package/esm2015/lib/safetyPlan/serviceProvider.component.js +0 -130
  63. package/esm2015/lib/safetyPlan/victimSafetyPlan.component.js +0 -257
  64. package/esm2015/lib/safetyPlan/victimSafetyPlanDetail.component.js +0 -556
  65. package/esm2015/lib/shared/app.shared.module.js +0 -81
  66. package/esm2015/lib/shared/directives/phone-mask.directive.js +0 -168
  67. package/esm2015/lib/shared/validators/date.validator.js +0 -108
  68. package/esm2015/lib/shared/validators/index.js +0 -7
  69. package/esm2015/lib/smart-victim-delete-confirm.component.js +0 -61
  70. package/esm2015/lib/smart-victim-detail/smart-victim-detail.component.js +0 -1405
  71. package/esm2015/lib/smart-victim.component.js +0 -476
  72. package/esm2015/lib/smart-victim.model.js +0 -631
  73. package/esm2015/lib/smart-victim.module.js +0 -84
  74. package/esm2015/lib/smart-victim.service.js +0 -792
  75. package/esm2015/lib/victim-routing.module.js +0 -40
  76. package/esm2015/lib/victimSearch/VictimSearchFilter.js +0 -20
  77. package/esm2015/lib/victimSearch/victimSearchForm.component.js +0 -59
  78. package/esm2015/public-api.js +0 -13
  79. package/esm5/csmart-ngc-smart-victim.js +0 -25
  80. package/esm5/lib/caseNote/caseNote.component.js +0 -372
  81. package/esm5/lib/common-dialog/common-dialog.component.js +0 -48
  82. package/esm5/lib/common-dialog/common-dialog.module.js +0 -36
  83. package/esm5/lib/common-dialog/common-dialog.service.js +0 -75
  84. package/esm5/lib/contact/contact.component.js +0 -281
  85. package/esm5/lib/intake.service.js +0 -194
  86. package/esm5/lib/safetyPlan/serviceProvider.component.js +0 -99
  87. package/esm5/lib/safetyPlan/victimSafetyPlan.component.js +0 -306
  88. package/esm5/lib/safetyPlan/victimSafetyPlanDetail.component.js +0 -628
  89. package/esm5/lib/shared/app.shared.module.js +0 -85
  90. package/esm5/lib/shared/directives/phone-mask.directive.js +0 -184
  91. package/esm5/lib/shared/validators/date.validator.js +0 -108
  92. package/esm5/lib/shared/validators/index.js +0 -7
  93. package/esm5/lib/smart-victim-delete-confirm.component.js +0 -51
  94. package/esm5/lib/smart-victim-detail/smart-victim-detail.component.js +0 -1497
  95. package/esm5/lib/smart-victim.component.js +0 -528
  96. package/esm5/lib/smart-victim.model.js +0 -541
  97. package/esm5/lib/smart-victim.module.js +0 -84
  98. package/esm5/lib/smart-victim.service.js +0 -1063
  99. package/esm5/lib/victim-routing.module.js +0 -44
  100. package/esm5/lib/victimSearch/VictimSearchFilter.js +0 -24
  101. package/esm5/lib/victimSearch/victimSearchForm.component.js +0 -70
  102. package/esm5/public-api.js +0 -13
  103. package/fesm2015/csmart-ngc-smart-victim.js +0 -5682
  104. package/fesm2015/csmart-ngc-smart-victim.js.map +0 -1
  105. package/fesm5/csmart-ngc-smart-victim.js +0 -6203
  106. package/fesm5/csmart-ngc-smart-victim.js.map +0 -1
  107. package/lib/caseNote/caseNote.component.d.ts +0 -45
  108. package/lib/common-dialog/common-dialog.component.d.ts +0 -11
  109. package/lib/common-dialog/common-dialog.module.d.ts +0 -2
  110. package/lib/common-dialog/common-dialog.service.d.ts +0 -8
  111. package/lib/contact/contact.component.d.ts +0 -37
  112. package/lib/intake.service.d.ts +0 -54
  113. package/lib/safetyPlan/serviceProvider.component.d.ts +0 -16
  114. package/lib/safetyPlan/victimSafetyPlan.component.d.ts +0 -49
  115. package/lib/safetyPlan/victimSafetyPlanDetail.component.d.ts +0 -57
  116. package/lib/shared/app.shared.module.d.ts +0 -2
  117. package/lib/shared/directives/phone-mask.directive.d.ts +0 -14
  118. package/lib/shared/validators/date.validator.d.ts +0 -9
  119. package/lib/shared/validators/index.d.ts +0 -1
  120. package/lib/smart-victim-delete-confirm.component.d.ts +0 -9
  121. package/lib/smart-victim-detail/smart-victim-detail.component.d.ts +0 -109
  122. package/lib/smart-victim.component.d.ts +0 -63
  123. package/lib/smart-victim.model.d.ts +0 -204
  124. package/lib/smart-victim.module.d.ts +0 -2
  125. package/lib/smart-victim.service.d.ts +0 -67
  126. package/lib/victim-routing.module.d.ts +0 -2
  127. package/lib/victimSearch/victimSearchForm.component.d.ts +0 -11
  128. package/public-api.d.ts +0 -4
@@ -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,133 @@
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" > {{formatPhoneNumber(row.homePhone)}} </mat-cell>
67
+ </ng-container>
68
+ </div>
69
+
70
+ <div *ngIf="showOffenderNameColumn">
71
+ <ng-container matColumnDef="offenderName">
72
+ <mat-header-cell *matHeaderCellDef>Offender Name</mat-header-cell>
73
+ <mat-cell *matCellDef="let row" > {{row.offenderName}} </mat-cell>
74
+ </ng-container>
75
+ </div>
76
+
77
+ <ng-container matColumnDef="victimId">
78
+ <mat-header-cell *matHeaderCellDef ></mat-header-cell>
79
+ <mat-cell *matCellDef="let row" >
80
+
81
+ <!-- <div *ngIf="accessByModule">
82
+ <mat-checkbox></mat-checkbox>
83
+ </div> -->
84
+
85
+ <div *ngIf="showEdit">
86
+ <button class="edit-btn" mat-icon-button color="primary" matTooltip="View/Edit Victim"
87
+ accessControl
88
+ [accessControlConfig]="updateAccessControlConfig"
89
+ (click)="editVictimDetail(row)">
90
+ <i class="material-icons">mode_edit</i>
91
+ </button>
92
+ </div>
93
+
94
+
95
+
96
+ &nbsp;&nbsp;
97
+
98
+ <div *ngIf="showCaseNote">
99
+ <button type="button" matTooltip="CaseNote" mat-raised-button color="primary"
100
+ accessControl
101
+ [accessControlConfig]="updateAccessControlConfig"
102
+ (click)="goToCaseNote(row.victimId)">
103
+ <span class="glyphicon glyphicon-pencil" ></span>&nbsp;Case Note
104
+ </button>
105
+ </div>
106
+ &nbsp;&nbsp;
107
+
108
+ <div *ngIf="showSafetyPlan">
109
+ <button type="button" matTooltip="safety plan" mat-raised-button color="primary"
110
+ accessControl
111
+ [accessControlConfig]="updateAccessControlConfig"
112
+ (click)="goToSaftyPlan(row.victimId)">
113
+ <span class="glyphicon glyphicon-pencil" ></span>&nbsp;Safety Plan
114
+ </button>
115
+ </div>
116
+ &nbsp;&nbsp;
117
+
118
+ </mat-cell>
119
+ </ng-container>
120
+
121
+ <mat-header-row *matHeaderRowDef="displayedColumns" class="example-header-row"></mat-header-row>
122
+ <mat-row *matRowDef="let row; columns: displayedColumns" class="example-row"></mat-row>
123
+ </mat-table>
124
+
125
+ <mat-paginator #paginator [pageSize]="10" [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
126
+ </mat-card-content>
127
+ </mat-card>
128
+ </div>
129
+
130
+ <div>
131
+ <b>{{msg}}</b>
132
+ </div>
133
+ </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,323 @@
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
+ var data = this.route.snapshot.data;
142
+ var myPath = this.router.url.slice(-10);
143
+
144
+ console.log("smart-victim ngOnInit");
145
+ console.log(this.intakeFlag);
146
+ console.log(myPath);
147
+
148
+ if (this.intakeFlag || myPath == "victimHome") {
149
+ this.isIntake = true;
150
+ }
151
+
152
+ this.displayedColumns = ["lastName", "firstName"];
153
+
154
+ if (
155
+ this.showRelationshipColumn == true ||
156
+ myPath == "victimList" ||
157
+ myPath == "victimHome"
158
+ ) {
159
+ this.displayedColumns.push("relationship");
160
+ }
161
+ if (this.showOffenderNameColumn == true) {
162
+ this.displayedColumns.push("offenderName");
163
+ }
164
+
165
+ if (
166
+ this.showOffenderPhoneColumn == true ||
167
+ myPath == "victimList" ||
168
+ myPath == "victimHome"
169
+ ) {
170
+ this.displayedColumns.push("homePhone");
171
+ }
172
+
173
+ this.displayedColumns.push("victimId");
174
+
175
+ if (this.showSearchForm == true) {
176
+ this.showListFlag = false;
177
+ }
178
+
179
+ console.log("this.showSearchForm");
180
+ console.log(this.showSearchForm);
181
+ console.log("myPath");
182
+ console.log(myPath);
183
+
184
+ if (
185
+ this.showSearchForm == false ||
186
+ myPath == "victimList" ||
187
+ myPath == "victimHome"
188
+ ) {
189
+ var myOffenderId;
190
+ if (this.offenderId) {
191
+ myOffenderId = this.offenderId;
192
+ } else {
193
+ console.log("back from previous page");
194
+ this.showAdd = true;
195
+ this.showRelationshipColumn = true;
196
+ //this.displayedColumns.push("relationship");
197
+ this.showOffenderPhoneColumn = true;
198
+ // this.displayedColumns.push("homePhone");
199
+ this.accessByModule = "true";
200
+ this.showEdit = "true";
201
+ this.showCaseNote = "true";
202
+ this.showSafetyPlan = "true";
203
+
204
+ myOffenderId = data.selectedOffender.offenderId;
205
+ }
206
+
207
+ const victimListFilter: VictimListFilter = {
208
+ offenderId: myOffenderId,
209
+ lastName: null,
210
+ firstName: null,
211
+ pdid: null,
212
+ birthDate: null,
213
+ };
214
+
215
+ console.log("victimListFilter in smar-victim componenet");
216
+ console.log(victimListFilter);
217
+
218
+ this.victimService
219
+ .getVictimListByFilter(victimListFilter)
220
+ .subscribe((data: Victim[]) => {
221
+ this.victimListDataSource.data = data;
222
+
223
+ this.victims = data;
224
+
225
+ data.forEach((d) => {
226
+ if (d.homePhone == null || d.homePhone == "") {
227
+ d.homePhone = d.cellPhone;
228
+ }
229
+ if (d.homePhone == null || d.homePhone == "") {
230
+ d.homePhone = d.workPhone;
231
+ }
232
+ });
233
+ console.log("victim data at line 179");
234
+ console.log(this.victims);
235
+ console.log("showListFlag");
236
+ console.log(this.showListFlag);
237
+ this.showListFlag = true;
238
+ if (data.length == 0) {
239
+ this.msg = "No Record Found!";
240
+ }
241
+ });
242
+ } else {
243
+ console.log("find filter");
244
+ console.log(this.victimListFilter);
245
+
246
+ if (this.showListFlag === true) {
247
+ if (this.victimListFilter != null) {
248
+ this.victimService
249
+ .getVictimListByFilter(this.victimListFilter)
250
+ .subscribe((data: Victim[]) => {
251
+ this.victimListDataSource.data = data;
252
+ this.victims = data;
253
+ console.log("victim data at line 201");
254
+ console.log(data);
255
+ });
256
+ }
257
+ }
258
+ }
259
+ }
260
+
261
+ formatPhoneNumber(phoneNumberString) {
262
+ if (!phoneNumberString) return "";
263
+ var cleaned = ("" + phoneNumberString).replace(/\D/g, "");
264
+ var match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
265
+ if (match) {
266
+ return "(" + match[1] + ") " + match[2] + "-" + match[3];
267
+ }
268
+ return "";
269
+ }
270
+
271
+ saveIntake() {
272
+ if (!this.isIntake) {
273
+ return;
274
+ }
275
+ const intakeStep = <IntakeStepStatusModel>{
276
+ intakeStepId: IntakeStep.VictimInformation,
277
+ offenderId: this.offenderId,
278
+ modifiedBy: this.staffId,
279
+ };
280
+ this.intakeService
281
+ .updateIntakeSteps(this.offenderId, intakeStep)
282
+ .subscribe((res) => {
283
+ console.log("save intake step.");
284
+ this.snackBar.open("Status Saved.", "", {
285
+ duration: 3000,
286
+ });
287
+ //this.router.navigate(['/warrant '], { queryParams: { intake: 1 } });
288
+
289
+ this.document.location.href = `${this.smartWarrantUrl}/warrant`;
290
+ });
291
+ }
292
+
293
+ goToCaseNote(victimId: number) {
294
+ this.router.navigate(["casenote", victimId]);
295
+ }
296
+
297
+ goToSaftyPlan(victimId: number) {
298
+ this.router.navigate(["saftyPlan", victimId]);
299
+ }
300
+
301
+ getVictimList(filter: VictimListFilter) {
302
+ this.victimListFilter = filter;
303
+ console.log("this.victimListFilter inside getVictimList");
304
+ console.log(this.victimListFilter);
305
+ this.doSpin = true;
306
+ this.victimService.getVictimListByFilter(filter).subscribe(
307
+ (data: Victim[]) => {
308
+ this.victimListDataSource.data = data;
309
+
310
+ this.doSpin = !this.doSpin;
311
+
312
+ if (data.length > 0) {
313
+ this.showListFlag = true;
314
+ } else {
315
+ this.msg = "No record found!";
316
+ }
317
+ },
318
+ (err) => {
319
+ this.doSpin = !this.doSpin;
320
+ }
321
+ );
322
+ }
323
+ }