@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
package/karma.conf.js ADDED
@@ -0,0 +1,32 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage-istanbul-reporter'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
17
+ },
18
+ coverageIstanbulReporter: {
19
+ dir: require('path').join(__dirname, '../../coverage/ngc-smart-victim'),
20
+ reports: ['html', 'lcovonly'],
21
+ fixWebpackSourcePaths: true
22
+ },
23
+ reporters: ['progress', 'kjhtml'],
24
+ port: 9876,
25
+ colors: true,
26
+ logLevel: config.LOG_INFO,
27
+ autoWatch: true,
28
+ browsers: ['Chrome'],
29
+ singleRun: false,
30
+ restartOnFileChange: true
31
+ });
32
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ngc-smart-victim",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,26 +1,13 @@
1
- {
2
- "name": "@csmart/ngc-smart-victim",
3
- "version": "0.1.5",
4
- "peerDependencies": {
5
- "@angular/common": "^7.0.0",
6
- "@angular/core": "^7.0.0",
7
- "@angular/material": "^7.0.0",
8
- "@angular/animations": "^7.0.0",
9
- "@angular/cdk": "^7.0.0",
10
- "@angular/forms": "^7.0.0",
11
- "@csmart/ngc-smart-address": "^7.1.47"
12
- },
13
- "main": "bundles/csmart-ngc-smart-victim.umd.js",
14
- "module": "fesm5/csmart-ngc-smart-victim.js",
15
- "es2015": "fesm2015/csmart-ngc-smart-victim.js",
16
- "esm5": "esm5/csmart-ngc-smart-victim.js",
17
- "esm2015": "esm2015/csmart-ngc-smart-victim.js",
18
- "fesm5": "fesm5/csmart-ngc-smart-victim.js",
19
- "fesm2015": "fesm2015/csmart-ngc-smart-victim.js",
20
- "typings": "csmart-ngc-smart-victim.d.ts",
21
- "metadata": "csmart-ngc-smart-victim.metadata.json",
22
- "sideEffects": false,
23
- "dependencies": {
24
- "tslib": "^1.9.0"
25
- }
26
- }
1
+ {
2
+ "name": "@csmart/ngc-smart-victim",
3
+ "version": "0.1.8",
4
+ "peerDependencies": {
5
+ "@angular/common": "^7.0.0",
6
+ "@angular/core": "^7.0.0",
7
+ "@angular/material": "^7.0.0",
8
+ "@angular/animations": "^7.0.0",
9
+ "@angular/cdk": "^7.0.0",
10
+ "@angular/forms": "^7.0.0",
11
+ "@csmart/ngc-smart-address": "^7.1.47"
12
+ }
13
+ }
@@ -0,0 +1,20 @@
1
+ .container{
2
+ width:800px;
3
+ margin: 16px;
4
+ display: grid;
5
+ grid-template-columns: repeat(1, 1fr);
6
+ grid-gap: 10px;
7
+ grid-auto-rows: minmax(50px, auto);
8
+ justify-items: stretch;
9
+ }
10
+
11
+ .mat-select-content{
12
+ width:300px;
13
+ }
14
+
15
+ .mat-select-inner{
16
+ width:290px;
17
+ }
18
+ .textarea-content{
19
+ width:500px;
20
+ }
@@ -0,0 +1,188 @@
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" >Case Note</h4>
10
+ </mat-toolbar>
11
+ <br>
12
+ <div class="row" >
13
+ <div [hidden]="hiddenAddNewFlag">
14
+ &nbsp;&nbsp;<button mat-raised-button color="primary" (click)="onAddNew()" [disabled]="addDisableFlag">Add Case Note</button>
15
+
16
+ &nbsp;&nbsp;<button mat-raised-button color="primary" (click)="back()">Back</button>
17
+ </div>
18
+ </div>
19
+
20
+ <div [hidden]="hiddenDetailFlag" >
21
+ <mat-card >
22
+ <div class='container'>
23
+ <form [formGroup]="caseNoteForm" #caseNoteDetailForm="ngForm" >
24
+
25
+ <div>
26
+ <mat-label>Victim Name:</mat-label>
27
+ {{victimName}}
28
+ </div>
29
+
30
+
31
+ <div>
32
+ <mat-form-field>
33
+ <mat-label>Date of Case Note: </mat-label>
34
+ <input matInput formControlName="caseNoteDate"
35
+ (click)="caseNoteDate.open()"
36
+ [matDatepicker]="caseNoteDate"
37
+ placeholder="Choose a start date"
38
+ [(ngModel)]="editCaseNote.caseNoteDate" required>
39
+ <mat-datepicker-toggle matSuffix [for]="caseNoteDate"></mat-datepicker-toggle>
40
+ <mat-datepicker #caseNoteDate></mat-datepicker>
41
+
42
+ <div class="help-block" *ngIf="caseNoteForm.get('caseNoteDate').errors
43
+ && (caseNoteForm.get('caseNoteDate').dirty || caseNoteForm.get('caseNoteDate').touched)">
44
+ <mat-error>case note date is <strong>required</strong></mat-error>
45
+ </div>
46
+
47
+ <div class="help-block"
48
+ *ngIf="caseNoteForm.get('caseNoteDate').hasError('date')
49
+ && (caseNoteForm.get('caseNoteDate').dirty || caseNoteForm.get('caseNoteDate').touched)">
50
+ <mat-error>future case note Date is <strong>not allowed</strong></mat-error>
51
+ </div>
52
+
53
+ </mat-form-field>
54
+
55
+ </div>
56
+
57
+
58
+
59
+ <div>
60
+ <mat-form-field>
61
+ <mat-label>Contact Type:</mat-label>
62
+ <mat-select placeholder="contactType" formControlName="contactType" required [(ngModel)]="editCaseNote.contactTypeId">
63
+ <mat-option *ngFor=" let contactType of contactTypes" [value]="contactType.contactTypeId" >{{contactType.name}}</mat-option>
64
+ </mat-select>
65
+
66
+ <div class="help-block" *ngIf="caseNoteForm.get('contactType').errors
67
+ && (caseNoteForm.get('contactType').dirty || caseNoteForm.get('contactType').touched)">
68
+ <mat-error>comment is <strong>required</strong></mat-error>
69
+ </div>
70
+ </mat-form-field>
71
+ </div>
72
+
73
+ <div>
74
+ <mat-form-field class="mat-select-content">
75
+ <mat-label>Contact Purpose:</mat-label>
76
+ <mat-select formControlName="contactPurpose" required [(ngModel)]="editCaseNote.victimContactPurposeId" class="mat-select-inner">
77
+ <mat-option *ngFor=" let contactPurpose of contactPurposes" [value]="contactPurpose.victimContactPurposeId" >{{contactPurpose.name}}</mat-option>
78
+ </mat-select>
79
+
80
+ <div class="help-block" *ngIf="caseNoteForm.get('contactPurpose').errors
81
+ && (caseNoteForm.get('contactPurpose').dirty || caseNoteForm.get('contactPurpose').touched)">
82
+ <mat-error>comment is <strong>required</strong></mat-error>
83
+ </div>
84
+
85
+ </mat-form-field>
86
+ </div>
87
+
88
+ <div>
89
+
90
+ <mat-form-field style="width: 400px;">
91
+ <mat-label>Comment:</mat-label>
92
+ <textarea
93
+ class="textarea-content"
94
+ matInput
95
+ placeholder=""
96
+ required formControlName="comment"
97
+ [(ngModel)]="editCaseNote.comment"
98
+ cdkTextareaAutosize
99
+ #autosize="cdkTextareaAutosize"
100
+ cdkAutosizeMinRows="8"
101
+ cdkAutosizeMaxRows="12">
102
+ </textarea>
103
+
104
+ <div class="help-block" *ngIf="caseNoteForm.get('comment').errors
105
+ && (caseNoteForm.get('comment').dirty || caseNoteForm.get('comment').touched)">
106
+ <mat-error>comment is <strong>required</strong></mat-error>
107
+ </div>
108
+ </mat-form-field>
109
+ </div>
110
+
111
+ <div>
112
+ <button mat-raised-button color="primary" (click)="saveCaseNote()" [disabled]="!caseNoteDetailForm.form.valid" >Save</button>
113
+
114
+ &nbsp;&nbsp;<button mat-raised-button color="primary" (click)="hiddenDetailFlag = true;addDisableFlag = false; this.hiddenAddNewFlag = false;">Cancel</button>
115
+ </div>
116
+
117
+ </form>
118
+ </div>
119
+ </mat-card>
120
+
121
+ </div>
122
+ <br>
123
+ <mat-table #table [dataSource]="caseNoteDataSource" class="example-table">
124
+ <ng-container matColumnDef="caseNoteDate">
125
+ <mat-header-cell *matHeaderCellDef class="example-header-cell">Case Note Date</mat-header-cell>
126
+ <mat-cell *matCellDef="let row" class="example-cell"> {{row.caseNoteDate | date}} </mat-cell>
127
+ </ng-container>
128
+
129
+
130
+ <ng-container matColumnDef="contactType">
131
+ <mat-header-cell *matHeaderCellDef class="example-header-cell">Contact Type</mat-header-cell>
132
+ <mat-cell *matCellDef="let row" class="example-cell"> {{row.contactType}} </mat-cell>
133
+ </ng-container>
134
+
135
+
136
+ <ng-container matColumnDef="contactPurpose">
137
+ <mat-header-cell *matHeaderCellDef class="example-header-cell">Contact Purpose</mat-header-cell>
138
+ <mat-cell *matCellDef="let row" class="example-cell"> {{row.contactPurpose}} </mat-cell>
139
+ </ng-container>
140
+ <ng-container matColumnDef="comment">
141
+ <mat-header-cell *matHeaderCellDef class="example-header-cell">Comment</mat-header-cell>
142
+ <mat-cell *matCellDef="let row" class="example-cell"> {{row.comment}} </mat-cell>
143
+ </ng-container>
144
+
145
+ <ng-container matColumnDef="victimCaseNoteId">
146
+ <mat-header-cell *matHeaderCellDef class="example-header-cell"></mat-header-cell>
147
+ <mat-cell *matCellDef="let row" class="example-cell">
148
+
149
+ <button
150
+ class="sac-cso-read sac-vsp-read"
151
+ mat-icon-button
152
+ color="primary"
153
+ matTooltip="Edit Case Note"
154
+ (click)="onEditCaseNote(row.victimCaseNoteId)">
155
+ <i class="material-icons">mode_edit</i>
156
+ </button>
157
+
158
+ &nbsp;&nbsp;
159
+
160
+
161
+
162
+ <button
163
+ class="sac-vsp-read"
164
+ matTooltip="Delete Case Note"
165
+ mat-icon-button
166
+ color="primary"
167
+ (click)="onDeleteCaseNote(row.victimCaseNoteId)">
168
+ <i class="material-icons">delete</i>
169
+ </button>
170
+
171
+
172
+
173
+
174
+ </mat-cell>
175
+ </ng-container>
176
+
177
+ <mat-header-row *matHeaderRowDef="['caseNoteDate', 'contactType', 'contactPurpose', 'comment', 'victimCaseNoteId']" class="example-header-row"></mat-header-row>
178
+ <mat-row *matRowDef="let row; columns:['caseNoteDate', 'contactType', 'contactPurpose', 'comment', 'victimCaseNoteId'];" class="example-row"></mat-row>
179
+ </mat-table>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+ </mat-card-content>
188
+ </mat-card>
@@ -0,0 +1,248 @@
1
+ import { Component, OnInit,Inject,OnChanges, Input, Output, EventEmitter,AfterViewInit } from '@angular/core';
2
+ import { NgcSmartVictimService } from '../smart-victim.service';
3
+ import { FormControl, FormGroup, FormBuilder,Validators} from '@angular/forms';
4
+ import { CommonDialogService} from '.././common-dialog/common-dialog.service';
5
+ import { MatSnackBar } from '@angular/material/snack-bar';
6
+ import { SelectedOffender, LoginStaff } from '@csmart/ngc-smart-core';
7
+ import { Router, ActivatedRoute } from '@angular/router';
8
+ import { CaseNote} from '../smart-victim.model';
9
+ import { SmartAuthService } from '@csmart/ngc-smart-core';
10
+ import { dateValidator, passDateValidator } from '../shared/validators';
11
+ import { MatTableDataSource } from '@angular/material/table';
12
+
13
+
14
+
15
+ @Component({
16
+
17
+ templateUrl: './caseNote.component.html',
18
+ styleUrls: ['./caseNote.component.css'],
19
+ providers: [CommonDialogService]
20
+
21
+ })
22
+ export class CaseNoteComponent implements OnInit,AfterViewInit {
23
+
24
+ // @Input() isIntake: boolean;
25
+ offenderId: number;
26
+ loginStaff: LoginStaff;
27
+
28
+ hiddenDetailFlag:boolean;
29
+ caseNoteList: CaseNote[];
30
+ caseNote: CaseNote;
31
+ editCaseNote: CaseNote = <CaseNote>{};
32
+ errorMessage: string;
33
+ contactTypes: any[];
34
+ contactPurposes: any[];
35
+ result: any;
36
+ victimName: string;
37
+ staffId: number;
38
+ victimId: number;
39
+ private sub: any;
40
+ caseNoteDataSource= new MatTableDataSource();
41
+ addDisableFlag: boolean;
42
+ hiddenAddNewFlag: boolean;
43
+ caseNoteForm: FormGroup;
44
+
45
+ constructor(
46
+ private formBuilder: FormBuilder,
47
+ private _victimServicesComponent: NgcSmartVictimService,
48
+ private commonDialogService: CommonDialogService,
49
+ public snackBar: MatSnackBar,
50
+ private route: ActivatedRoute,
51
+ private router: Router,
52
+ private smartAuthService: SmartAuthService,
53
+
54
+ ) {
55
+ this.initForm();
56
+ }
57
+ private initForm() {
58
+ this.caseNoteForm = this.formBuilder.group({
59
+ caseNoteDate: new FormControl('', Validators.compose([
60
+ Validators.required,dateValidator()])),
61
+ contactType: new FormControl('',Validators.required),
62
+ contactPurpose: new FormControl('',Validators.required),
63
+ comment: new FormControl('',Validators.required)
64
+ });
65
+
66
+ this.caseNoteForm.markAsPristine();
67
+ this.caseNoteForm.markAsUntouched();
68
+
69
+ }
70
+ ngAfterViewInit() {
71
+ this.smartAuthService.setPermission('Victim', this.route.snapshot);
72
+ }
73
+
74
+ ngOnInit() {
75
+ var data = this.route.snapshot.data;
76
+ this.loginStaff = data.loginStaff;
77
+ this.staffId = this.loginStaff.staffId;
78
+
79
+
80
+ this.sub = this.route.params.subscribe(params => {
81
+ this.victimId = params['victimId'];
82
+
83
+ });
84
+
85
+ this.addDisableFlag= false;
86
+ this.hiddenDetailFlag = true;
87
+ this.hiddenAddNewFlag = false;
88
+
89
+
90
+ this._victimServicesComponent.getVictim(this.victimId).subscribe(
91
+ (items: any) => {
92
+ this.victimName = items.firstName + ', ' + items.lastName;
93
+ }
94
+ );
95
+
96
+ this._victimServicesComponent.getContactTypes().subscribe(
97
+ (items: any) => {
98
+ this.contactTypes = items;
99
+ }
100
+ );
101
+
102
+ this._victimServicesComponent.getVictimContactPurposes().subscribe(
103
+ (items: any) => {
104
+ this.contactPurposes = items;
105
+ }
106
+ );
107
+
108
+
109
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
110
+ caseNoteList => {
111
+ console.log('caseNoteList');
112
+ console.log(caseNoteList);
113
+ this.caseNoteList = caseNoteList;
114
+ this.caseNoteDataSource.data = this.caseNoteList;
115
+ }
116
+ );
117
+
118
+
119
+
120
+
121
+ // this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
122
+ // (itms: any) => {
123
+ // const ELEMENT_DATA: Element[] = itms;
124
+ // this.caseNoteDataSource.data = ELEMENT_DATA;
125
+ // })
126
+ }
127
+ onEditCaseNote(victimCaseNoteId: number){
128
+
129
+ this.hiddenDetailFlag =false;
130
+ this.hiddenAddNewFlag = true;
131
+
132
+ this.addDisableFlag = true;
133
+ this.editCaseNote = this.caseNoteList.find(x => x.victimCaseNoteId === victimCaseNoteId);
134
+
135
+ }
136
+
137
+ onDeleteCaseNote(victimCaseNoteId: number){
138
+ this.commonDialogService
139
+ .confirm('', 'Do you want to delete this case note?', 'Yes', 'No')
140
+ .subscribe(res => {this.result = res;
141
+ if (this.result) {
142
+ this._victimServicesComponent.deleteCaseNote(victimCaseNoteId, this.staffId)
143
+ .subscribe(result => {
144
+ this.snackBar.open('delete Successfully !', '', { duration: 3000,});
145
+
146
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
147
+ caseNoteList => {
148
+ this.caseNoteList = caseNoteList;
149
+ this.caseNoteDataSource.data = this.caseNoteList;
150
+ }
151
+ );
152
+ }
153
+ );
154
+ }
155
+
156
+ });
157
+ }
158
+ onAddNew(){
159
+
160
+ this.hiddenDetailFlag = false;
161
+ this.editCaseNote.victimCaseNoteId = 0;
162
+
163
+ const caseNoteDateControl = this.caseNoteForm.get('caseNoteDate');
164
+ caseNoteDateControl.setValue(null);
165
+ caseNoteDateControl.setErrors(null);
166
+ caseNoteDateControl.markAsPristine();
167
+ caseNoteDateControl.markAsPristine();
168
+
169
+
170
+ const contactTypeControl = this.caseNoteForm.get('contactType');
171
+ contactTypeControl.setValue(null);
172
+ contactTypeControl.setErrors(null);
173
+ contactTypeControl.markAsPristine();
174
+ contactTypeControl.markAsUntouched();
175
+
176
+
177
+ const contactPurposeControl = this.caseNoteForm.get('contactPurpose');
178
+ contactPurposeControl.setValue(null);
179
+ contactPurposeControl.setErrors(null);
180
+ contactPurposeControl.markAsPristine();
181
+ contactPurposeControl.markAsUntouched();
182
+
183
+
184
+ const commentControl = this.caseNoteForm.get('comment');
185
+ commentControl.setValue(null);
186
+ commentControl.setErrors(null);
187
+ commentControl.markAsPristine();
188
+ commentControl.markAsUntouched();
189
+
190
+ }
191
+ back(){
192
+ this.router.navigate(['victimHome']);
193
+
194
+ }
195
+
196
+ saveCaseNote(){
197
+
198
+ if (this.editCaseNote.victimCaseNoteId === undefined || this.editCaseNote.victimCaseNoteId === 0) {
199
+
200
+ const castNote: CaseNote = {
201
+ victimId:this.victimId,
202
+ victimCaseNoteId: 0,
203
+ caseNoteDate: this.editCaseNote.caseNoteDate,
204
+ contactTypeId: this.editCaseNote.contactTypeId,
205
+ contactType: null,
206
+ victimContactPurposeId: this.editCaseNote.victimContactPurposeId,
207
+ victimContactPurpose: null,
208
+ comment: this.editCaseNote.comment,
209
+ modifiedBy: this.staffId,
210
+ victimFirstName: null,
211
+ victimLastName: null
212
+
213
+ };
214
+ this._victimServicesComponent.addCaseNote(castNote).subscribe(
215
+ result => {
216
+ this.snackBar.open('Saved Successfully !', '', {
217
+ duration: 3000,
218
+ });
219
+ this.hiddenDetailFlag = true;
220
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
221
+ caseNoteList => {
222
+ this.caseNoteList = caseNoteList;
223
+ this.caseNoteDataSource.data = this.caseNoteList;
224
+ }
225
+ );
226
+ }
227
+ );
228
+ } else {
229
+ this._victimServicesComponent.updateCaseNote(this.editCaseNote).subscribe(
230
+ result => {
231
+ this.snackBar.open('Update Successfully !', '', {
232
+ duration: 3000,
233
+ });
234
+ this.hiddenDetailFlag = true;
235
+ this.hiddenAddNewFlag = false;
236
+ this.addDisableFlag = false;
237
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
238
+ caseNoteList => {
239
+ this.caseNoteList = caseNoteList;
240
+ this.caseNoteDataSource.data = this.caseNoteList;
241
+ }
242
+ );
243
+ }
244
+ );
245
+ }
246
+ }
247
+
248
+ }
@@ -0,0 +1,10 @@
1
+ .md-dialog-container{
2
+ position:fixed;
3
+ top:0 !important;
4
+ overflow:hidden;
5
+ }
6
+
7
+ .inner
8
+ {
9
+ display: inline-block;
10
+ }
@@ -0,0 +1,23 @@
1
+
2
+
3
+ <mat-card class="example-card">
4
+ <mat-card-content>
5
+ <p>{{ title }}</p>
6
+ <p>{{ message }}</p>
7
+ <br>
8
+
9
+ <div class="inner">
10
+ <button type="button" mat-raised-button color="primary"
11
+ (click)="commondialogRef.close(true)">{{cmdYesTitle}}</button>
12
+ </div>
13
+ &nbsp;&nbsp;
14
+
15
+ <div *ngIf="cmdYesTitle!=='Ok'" class="inner">
16
+ <button type="button" mat-raised-button color="primary"
17
+ (click)="commondialogRef.close()">{{cmdNoTitle}}</button>
18
+
19
+ </div>
20
+
21
+
22
+ </mat-card-content>
23
+ </mat-card>
@@ -0,0 +1,25 @@
1
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { CommonDialogComponent } from './common-dialog.component';
4
+
5
+ describe('CommonDialogComponent', () => {
6
+ let component: CommonDialogComponent;
7
+ let fixture: ComponentFixture<CommonDialogComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [ CommonDialogComponent ]
12
+ })
13
+ .compileComponents();
14
+ }));
15
+
16
+ beforeEach(() => {
17
+ fixture = TestBed.createComponent(CommonDialogComponent);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+ });
@@ -0,0 +1,21 @@
1
+ import { Component, OnInit } from '@angular/core';
2
+ import {MatDialog, MatDialogRef} from '@angular/material/dialog';
3
+
4
+ @Component({
5
+ selector: 'app-common-dialog',
6
+ templateUrl: './common-dialog.component.html',
7
+ styleUrls: ['./common-dialog.component.css']
8
+ })
9
+ export class CommonDialogComponent implements OnInit {
10
+ public title: string;
11
+ public message: string;
12
+ public cmdYesTitle: string ="Yes";
13
+ public cmdNoTitle: string = "No";
14
+
15
+ constructor(public commondialogRef: MatDialogRef<CommonDialogComponent>) { }
16
+
17
+ ngOnInit() {
18
+
19
+ }
20
+
21
+ }
@@ -0,0 +1,25 @@
1
+
2
+ import { NgModule } from '@angular/core';
3
+ import { SharedModule } from '../shared/app.shared.module';
4
+
5
+ import { CommonDialogComponent } from './common-dialog.component';
6
+
7
+ @NgModule({
8
+ imports: [
9
+ // MaterialModule.forRoot(),
10
+ SharedModule
11
+ ],
12
+ exports: [
13
+ CommonDialogComponent,
14
+ ],
15
+ declarations: [
16
+ CommonDialogComponent,
17
+ ],
18
+ providers: [
19
+ CommonDialogComponent,
20
+ ],
21
+ entryComponents: [
22
+ CommonDialogComponent,
23
+ ],
24
+ })
25
+ export class CommonDialogModule { }