@csmart/ngc-smart-victim 1.18.6 → 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
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,22 +1,6 @@
1
- {
2
- "name": "@csmart/ngc-smart-victim",
3
- "version": "1.18.6",
4
- "peerDependencies": {},
5
- "module": "fesm2022/csmart-ngc-smart-victim.mjs",
6
- "typings": "index.d.ts",
7
- "exports": {
8
- "./package.json": {
9
- "default": "./package.json"
10
- },
11
- ".": {
12
- "types": "./index.d.ts",
13
- "esm2022": "./esm2022/csmart-ngc-smart-victim.mjs",
14
- "esm": "./esm2022/csmart-ngc-smart-victim.mjs",
15
- "default": "./fesm2022/csmart-ngc-smart-victim.mjs"
16
- }
17
- },
18
- "sideEffects": false,
19
- "dependencies": {
20
- "tslib": "^2.3.0"
21
- }
22
- }
1
+ {
2
+ "name": "@csmart/ngc-smart-victim",
3
+ "version": "1.18.8",
4
+ "peerDependencies": {
5
+ }
6
+ }
@@ -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,265 @@
1
+ import { Component, OnInit,Inject,OnChanges, Input, Output, EventEmitter,AfterViewInit } from '@angular/core';
2
+ import { NgcSmartVictimService } from '../smart-victim.service';
3
+ import { UntypedFormControl, UntypedFormGroup, UntypedFormBuilder,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
+ import { EmailService } from '../email.services';
13
+
14
+
15
+
16
+ @Component({
17
+
18
+ templateUrl: './caseNote.component.html',
19
+ styleUrls: ['./caseNote.component.css'],
20
+ providers: [CommonDialogService]
21
+
22
+ })
23
+ export class CaseNoteComponent implements OnInit,AfterViewInit {
24
+
25
+ // @Input() isIntake: boolean;
26
+ offenderId: number;
27
+ loginStaff: LoginStaff;
28
+
29
+ hiddenDetailFlag:boolean;
30
+ caseNoteList: CaseNote[];
31
+ caseNote: CaseNote;
32
+ editCaseNote: CaseNote = <CaseNote>{};
33
+ errorMessage: string;
34
+ contactTypes: any[];
35
+ contactPurposes: any[];
36
+ result: any;
37
+ victimName: string;
38
+ staffId: number;
39
+ victimId: number;
40
+ private sub: any;
41
+ caseNoteDataSource= new MatTableDataSource();
42
+ addDisableFlag: boolean;
43
+ hiddenAddNewFlag: boolean;
44
+ caseNoteForm: UntypedFormGroup;
45
+
46
+ constructor(
47
+ private formBuilder: UntypedFormBuilder,
48
+ private _victimServicesComponent: NgcSmartVictimService,
49
+ private commonDialogService: CommonDialogService,
50
+ public snackBar: MatSnackBar,
51
+ private route: ActivatedRoute,
52
+ private router: Router,
53
+ private smartAuthService: SmartAuthService,
54
+ private emailService: EmailService
55
+
56
+ ) {
57
+ this.initForm();
58
+ }
59
+ private initForm() {
60
+ this.caseNoteForm = this.formBuilder.group({
61
+ caseNoteDate: new UntypedFormControl('', Validators.compose([
62
+ Validators.required,dateValidator()])),
63
+ contactType: new UntypedFormControl('',Validators.required),
64
+ contactPurpose: new UntypedFormControl('',Validators.required),
65
+ comment: new UntypedFormControl('',Validators.required)
66
+ });
67
+
68
+ this.caseNoteForm.markAsPristine();
69
+ this.caseNoteForm.markAsUntouched();
70
+
71
+ }
72
+ ngAfterViewInit() {
73
+ this.smartAuthService.setPermission('Victim', this.route.snapshot);
74
+ }
75
+
76
+ ngOnInit() {
77
+ var data = this.route.snapshot.data;
78
+ this.loginStaff = data.loginStaff;
79
+ this.staffId = this.loginStaff.staffId;
80
+
81
+
82
+ this.sub = this.route.params.subscribe(params => {
83
+ this.victimId = params['victimId'];
84
+ this.offenderId = params['offenderId'];
85
+
86
+ });
87
+
88
+ this.addDisableFlag= false;
89
+ this.hiddenDetailFlag = true;
90
+ this.hiddenAddNewFlag = false;
91
+
92
+
93
+ this._victimServicesComponent.getVictim(this.victimId).subscribe(
94
+ (items: any) => {
95
+ this.victimName = items.firstName + ', ' + items.lastName;
96
+ }
97
+ );
98
+
99
+ this._victimServicesComponent.getContactTypes().subscribe(
100
+ (items: any) => {
101
+ this.contactTypes = items;
102
+ }
103
+ );
104
+
105
+ this._victimServicesComponent.getVictimContactPurposes().subscribe(
106
+ (items: any) => {
107
+ this.contactPurposes = items;
108
+ }
109
+ );
110
+
111
+
112
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
113
+ caseNoteList => {
114
+ console.log('caseNoteList');
115
+ console.log(caseNoteList);
116
+ this.caseNoteList = caseNoteList;
117
+ this.caseNoteDataSource.data = this.caseNoteList;
118
+ }
119
+ );
120
+
121
+
122
+
123
+
124
+ // this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
125
+ // (itms: any) => {
126
+ // const ELEMENT_DATA: Element[] = itms;
127
+ // this.caseNoteDataSource.data = ELEMENT_DATA;
128
+ // })
129
+ }
130
+ onEditCaseNote(victimCaseNoteId: number){
131
+
132
+ this.hiddenDetailFlag =false;
133
+ this.hiddenAddNewFlag = true;
134
+
135
+ this.addDisableFlag = true;
136
+ this.editCaseNote = this.caseNoteList.find(x => x.victimCaseNoteId === victimCaseNoteId);
137
+
138
+ }
139
+
140
+ onDeleteCaseNote(victimCaseNoteId: number){
141
+ this.commonDialogService
142
+ .confirm('', 'Do you want to delete this case note?', 'Yes', 'No')
143
+ .subscribe(res => {this.result = res;
144
+ if (this.result) {
145
+ this._victimServicesComponent.deleteCaseNote(victimCaseNoteId, this.staffId)
146
+ .subscribe(result => {
147
+ this.snackBar.open('delete Successfully !', '', { duration: 3000,});
148
+
149
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
150
+ caseNoteList => {
151
+ this.caseNoteList = caseNoteList;
152
+ this.caseNoteDataSource.data = this.caseNoteList;
153
+ }
154
+ );
155
+ }
156
+ );
157
+ }
158
+
159
+ });
160
+ }
161
+ onAddNew(){
162
+
163
+ this.hiddenDetailFlag = false;
164
+ this.editCaseNote.victimCaseNoteId = 0;
165
+
166
+ const caseNoteDateControl = this.caseNoteForm.get('caseNoteDate');
167
+ caseNoteDateControl.setValue(null);
168
+ caseNoteDateControl.setErrors(null);
169
+ caseNoteDateControl.markAsPristine();
170
+ caseNoteDateControl.markAsPristine();
171
+
172
+
173
+ const contactTypeControl = this.caseNoteForm.get('contactType');
174
+ contactTypeControl.setValue(null);
175
+ contactTypeControl.setErrors(null);
176
+ contactTypeControl.markAsPristine();
177
+ contactTypeControl.markAsUntouched();
178
+
179
+
180
+ const contactPurposeControl = this.caseNoteForm.get('contactPurpose');
181
+ contactPurposeControl.setValue(null);
182
+ contactPurposeControl.setErrors(null);
183
+ contactPurposeControl.markAsPristine();
184
+ contactPurposeControl.markAsUntouched();
185
+
186
+
187
+ const commentControl = this.caseNoteForm.get('comment');
188
+ commentControl.setValue(null);
189
+ commentControl.setErrors(null);
190
+ commentControl.markAsPristine();
191
+ commentControl.markAsUntouched();
192
+
193
+ }
194
+ back(){
195
+ this.router.navigate(['victimHome']);
196
+ }
197
+
198
+ saveCaseNote(){
199
+ this.emailService
200
+ .createCaseNoteEmail(
201
+ "VictimCaseNoteReminders",
202
+ this.offenderId,
203
+ this.staffId
204
+ )
205
+ .subscribe();
206
+
207
+ if (this.editCaseNote.victimCaseNoteId === undefined || this.editCaseNote.victimCaseNoteId === 0) {
208
+
209
+ const castNote: CaseNote = {
210
+ victimId:this.victimId,
211
+ victimCaseNoteId: 0,
212
+ caseNoteDate: this.editCaseNote.caseNoteDate,
213
+ contactTypeId: this.editCaseNote.contactTypeId,
214
+ contactType: null,
215
+ victimContactPurposeId: this.editCaseNote.victimContactPurposeId,
216
+ victimContactPurpose: null,
217
+ comment: this.editCaseNote.comment,
218
+ modifiedBy: this.staffId,
219
+ victimFirstName: null,
220
+ victimLastName: null
221
+
222
+ };
223
+ this._victimServicesComponent.addCaseNote(castNote).subscribe(
224
+ result => {
225
+ this.snackBar.open('Saved Successfully !', '', {
226
+ duration: 3000,
227
+ });
228
+
229
+ // this._victimServicesComponent.sendEmail('', {referralId: 0, offenderId: this.offenderId }, this.loginStaff.staffId);
230
+
231
+
232
+
233
+ this.hiddenDetailFlag = true;
234
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
235
+ caseNoteList => {
236
+ this.caseNoteList = caseNoteList;
237
+ this.caseNoteDataSource.data = this.caseNoteList;
238
+ }
239
+ );
240
+ }
241
+ );
242
+ } else {
243
+ this._victimServicesComponent.updateCaseNote(this.editCaseNote).subscribe(
244
+ result => {
245
+ this.snackBar.open('Update Successfully !', '', {
246
+ duration: 3000,
247
+ });
248
+ this.hiddenDetailFlag = true;
249
+ this.hiddenAddNewFlag = false;
250
+ this.addDisableFlag = false;
251
+ this._victimServicesComponent.getCasetNotes(this.victimId).subscribe(
252
+ caseNoteList => {
253
+ this.caseNoteList = caseNoteList;
254
+ this.caseNoteDataSource.data = this.caseNoteList;
255
+ }
256
+ );
257
+ }
258
+ );
259
+ }
260
+
261
+ //email
262
+
263
+ }
264
+
265
+ }
@@ -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,22 @@
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
+ })
22
+ export class CommonDialogModule { }