@csmart/ngc-smart-victim 1.18.9 → 1.18.12

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csmart/ngc-smart-victim",
3
- "version": "1.18.9",
3
+ "version": "1.18.12",
4
4
  "peerDependencies": {
5
5
  }
6
6
  }
@@ -51,12 +51,19 @@
51
51
 
52
52
 
53
53
  <mat-form-field>
54
- <mat-label>Relationship to Offender:</mat-label>
55
- <mat-select formControlName="victimOffenderRelationshipTypeId" [(ngModel)]="editVictim.victimOffenderRelationshipTypeId" >
56
- <mat-option *ngFor="let item of relationshipTypes" [value]="item.relationshipTypeId">{{item.name}}</mat-option>
54
+ <mat-label>Relationship to Offender:9</mat-label>
55
+
56
+ <mat-select #relationShipSel multiple formControlName="victimRelationships" [(ngModel)]="editVictim.victimOffenderRelationshipTypeId" >
57
+ <div (mouseleave)="relationShipSel.close()">
58
+ <mat-option color="primary" *ngFor="let item of relationshipTypes" [value]="item.relationshipTypeId">
59
+ {{item.name}}
60
+ </mat-option>
61
+ </div>
57
62
  </mat-select>
58
- <div class="help-block" *ngIf="victimForm.get('victimOffenderRelationshipTypeId').errors
59
- && (victimForm.get('victimOffenderRelationshipTypeId').dirty || victimForm.get('victimOffenderRelationshipTypeId').touched)">
63
+
64
+
65
+ <div class="help-block" *ngIf="victimForm.get('victimRelationships').errors
66
+ && (victimForm.get('victimRelationships').dirty || victimForm.get('victimRelationships').touched)">
60
67
  <mat-error>relationship is <strong>required</strong></mat-error>
61
68
  </div>
62
69
  </mat-form-field>
@@ -749,8 +756,8 @@
749
756
  <mat-error>Under supervision field is <strong>required</strong></mat-error>
750
757
  </div>
751
758
 
752
- <div class="help-block" *ngIf="victimForm.get('victimOffenderRelationshipTypeId').errors
753
- && (victimForm.get('victimOffenderRelationshipTypeId').dirty || victimForm.get('victimOffenderRelationshipTypeId').touched)">
759
+ <div class="help-block" *ngIf="victimForm.get('victimRelationships').errors
760
+ && (victimForm.get('victimRelationships').dirty || victimForm.get('victimRelationships').touched)">
754
761
  <mat-error>Relationship is <strong>required</strong></mat-error>
755
762
  </div>
756
763
 
@@ -1,7 +1,7 @@
1
1
  import { Component, OnInit, OnChanges, Input, Output, EventEmitter, ViewChild } from '@angular/core';
2
2
  import { UntypedFormBuilder, UntypedFormGroup, UntypedFormControl,Validators,ValidatorFn } from '@angular/forms';
3
3
  import { MatRadioChange, MatRadioGroup } from '@angular/material/radio';
4
- import { Victim,VictimDrugUse, Contact, VictimAdvocate,VictimGuardian,VictimWeaponUse,VictimSupport } from '../smart-victim.model';
4
+ import { Victim,VictimDrugUse, Contact, VictimAdvocate,VictimGuardian,VictimWeaponUse,VictimSupport,VictimRelationship } from '../smart-victim.model';
5
5
  import { NgcSmartVictimService } from '../smart-victim.service';
6
6
  import { Router, ActivatedRoute } from '@angular/router';
7
7
  import { CommonDialogService} from '.././common-dialog/common-dialog.service';
@@ -124,7 +124,7 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
124
124
  weaponTypes: any;
125
125
  flagOption: any;
126
126
  selectedWeaponTypes: any;
127
- selectedVictimSupportTypes: any;
127
+ //selectedVictimSupportTypes: any;
128
128
  selectedDrugs: any;
129
129
  id: any;
130
130
  hidden: boolean=true;
@@ -201,7 +201,7 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
201
201
 
202
202
  this.victimForm = this.formBuilder.group({
203
203
  underSupervisionFlag: new UntypedFormControl('', Validators.compose([ Validators.required])),
204
- victimOffenderRelationshipTypeId:new UntypedFormControl('', Validators.compose([ Validators.required])),
204
+ victimRelationships:new UntypedFormControl('', Validators.compose([ Validators.required])),
205
205
  lastName: new UntypedFormControl('', Validators.compose([ Validators.required])),
206
206
  firstName: new UntypedFormControl('', Validators.compose([ Validators.required])),
207
207
  middleName: new UntypedFormControl('', ),
@@ -304,6 +304,13 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
304
304
  const victimSupportsControl = this.victimForm.get('victimSupports');
305
305
  victimSupportsControl.setValue(supportsData);
306
306
 
307
+
308
+ var relationshipsData =[];
309
+ this.editVictim.victimRelationships.forEach( t=>{relationshipsData.push(t.victimRelationshipTypeId); } )
310
+ const victimOffenderRelationshipControl = this.victimForm.get('victimRelations');
311
+ victimOffenderRelationshipControl.setValue(relationshipsData);
312
+
313
+
307
314
  var weaponUsesData =[];
308
315
  var otherWeapon = "";
309
316
  this.editVictim.victimWeaponUses.forEach( t=>{
@@ -596,16 +603,17 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
596
603
  );
597
604
  this.victimService.getRelationshipTypes().subscribe(
598
605
  (items: any) => {
599
- this.relationshipTypes = items.filter( (y) => ((y.relationshipCategoryId === 'ST' || y.relationshipCategoryId === 'FM' )
600
- && y.relationship !== 'AY'
601
- && y.relationship !== 'VT'
602
- && y.relationship !== 'CME'
603
- && y.relationship !== 'HH'
604
- && y.relationship !== 'NC'
605
- && y.relationship !== 'CL'
606
- && y.relationship !== 'OP'
607
-
608
- ));
606
+
607
+ this.relationshipTypes = items.filter( (y) => ((y.relationshipCategoryId === 'ST' || y.relationshipCategoryId === 'FM' )
608
+ && y.relationship !== 'AY'
609
+ && y.relationship !== 'VT'
610
+ && y.relationship !== 'CME'
611
+ && y.relationship !== 'HH'
612
+ && y.relationship !== 'NC'
613
+ && y.relationship !== 'CL'
614
+ && y.relationship !== 'OP'
615
+
616
+ ));
609
617
  }
610
618
  );
611
619
  this.victimService.getSupportTypes().subscribe(
@@ -988,12 +996,58 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
988
996
  }
989
997
  //data process
990
998
 
999
+
1000
+ var myVictimRelationships = [];
1001
+
1002
+ console.log('this.victimForm.value.victimRelationships'+this.victimForm.value.victimRelationships)
1003
+ if (this.victimForm.value.victimRelationships){
1004
+ console.log('this.victimForm.value.victimRelationships 1'+this.victimForm.value.victimRelationships)
1005
+
1006
+ this.victimForm.value.victimRelationships.forEach(element => {
1007
+ const victimRelationship= <VictimRelationship>{};
1008
+ victimRelationship.victimId= 0;
1009
+ victimRelationship.victimRelationshipTypeId= element;
1010
+ victimRelationship.modifiedBy= 2929;
1011
+ myVictimRelationships.push(victimRelationship);
1012
+ console.log('this.victimForm.value.victimRelationships 2'+this.victimForm.value.victimId)
1013
+ console.log('this.victimForm.value.victimRelationships 3'+this.staffId)
1014
+ console.log('this.victimForm.value.victimRelationships 4'+element)
1015
+
1016
+ });
1017
+ }
1018
+
1019
+ console.log('myVictimRelationships'+myVictimRelationships)
1020
+
1021
+
991
1022
  console.log('this.phoneValidationFlag 1');
992
1023
  console.log(this.phoneValidationFlag);
993
1024
  if ( this.phoneValidationFlag === false){
994
1025
  if (this.victimDetail === null){
1026
+
995
1027
  //insert new victim
996
1028
 
1029
+
1030
+ var myVictimRelationships = [];
1031
+
1032
+ console.log('this.victimForm.value.victimRelationships'+this.victimForm.value.victimRelationships)
1033
+ if (this.victimForm.value.victimRelationships){
1034
+ console.log('this.victimForm.value.victimRelationships 1'+this.victimForm.value.victimRelationships)
1035
+
1036
+ this.victimForm.value.victimRelationships.forEach(element => {
1037
+ const victimRelationship= <VictimRelationship>{};
1038
+ victimRelationship.victimId= this.victimForm.value.victimId;
1039
+ victimRelationship.victimRelationshipTypeId= element;
1040
+ victimRelationship.modifiedBy= this.staffId;
1041
+ myVictimRelationships.push(victimRelationship);
1042
+ console.log('this.victimForm.value.victimRelationships 2'+this.victimForm.value.victimId)
1043
+ console.log('this.victimForm.value.victimRelationships 3'+this.staffId)
1044
+ console.log('this.victimForm.value.victimRelationships 4'+element)
1045
+
1046
+ });
1047
+ }
1048
+
1049
+ console.log('myVictimRelationships'+myVictimRelationships)
1050
+
997
1051
  var myVictimSupports = [];
998
1052
  if (this.victimForm.value.victimSupports){
999
1053
  this.victimForm.value.victimSupports.forEach(element => {
@@ -1005,6 +1059,7 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1005
1059
  });
1006
1060
  }
1007
1061
 
1062
+
1008
1063
  var myVictimDrugUses = [];
1009
1064
  console.log('this.victimForm.value.victimDrugUses during save');
1010
1065
  console.log(this.victimForm.value.victimDrugUses);
@@ -1053,8 +1108,8 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1053
1108
  const newVictim = {
1054
1109
  victimId: 0,
1055
1110
  offenderId: this.offenderId,
1056
- victimOffenderRelationshipTypeId:
1057
- this.victimForm.value.victimOffenderRelationshipTypeId,
1111
+ // victimOffenderRelationshipTypeId:
1112
+ // this.victimForm.value.victimOffenderRelationshipTypeId,
1058
1113
  lastName: this.victimForm.value.lastName,
1059
1114
  firstName: this.victimForm.value.firstName,
1060
1115
  middleName: this.victimForm.value.middleName
@@ -1103,6 +1158,7 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1103
1158
  vVictimGuardian: null,
1104
1159
  victimDrugUses: myVictimDrugUses,
1105
1160
  victimSupports: myVictimSupports,
1161
+ victimOffenderRelationships: myVictimRelationships,
1106
1162
  victimWeaponUses: myVictimWeaponUses,
1107
1163
 
1108
1164
  advocateFirstName: null,
@@ -1126,7 +1182,7 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1126
1182
  guardianCellPhone: null,
1127
1183
  guardianAddressId: null,
1128
1184
  guardianBirthDate: null,
1129
- relationship: null,
1185
+ //relationship: null,
1130
1186
  //relationship: this.victimForm.value.victimOffenderRelationshipTypeId? this.victimForm.value.victimOffenderRelationshipTypeId : null,
1131
1187
  allowCsosaContactFlag: this.victimForm.value.allowCsosaContactFlag
1132
1188
  ? this.victimForm.value.allowCsosaContactFlag
@@ -1213,7 +1269,7 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1213
1269
  else {
1214
1270
  //update victim
1215
1271
  this.victimDetail.underSupervisionFlag = this.victimForm.value.underSupervisionFlag;
1216
- this.victimDetail.victimOffenderRelationshipTypeId = this.victimForm.value.victimOffenderRelationshipTypeId;
1272
+ //this.victimDetail.victimOffenderRelationshipTypeId = this.victimForm.value.victimOffenderRelationshipTypeId;
1217
1273
  this.victimDetail.lastName = this.victimForm.value.lastName;
1218
1274
  this.victimDetail.firstName = this.victimForm.value.firstName;
1219
1275
  this.victimDetail.middleName = this.victimForm.value.middleName;
@@ -1251,6 +1307,17 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1251
1307
  this.victimDetail.victimSupports.push(victimSupport);
1252
1308
  });
1253
1309
 
1310
+
1311
+ this.victimDetail.victimRelationships = [];
1312
+ this.victimForm.value.victimRelationships.forEach(element => {
1313
+ const victimRelationship= <VictimRelationship>{};
1314
+ victimRelationship.victimId= this.victimDetail.victimId;
1315
+ victimRelationship.victimRelationshipTypeId= element;
1316
+ victimRelationship.modifiedBy= this.staffId;
1317
+ this.victimDetail.victimRelationships.push(victimRelationship);
1318
+ });
1319
+
1320
+
1254
1321
  this.victimDetail.victimDrugUses = [];
1255
1322
 
1256
1323
  this.victimForm.value.victimDrugUses.forEach(element => {
@@ -1384,4 +1451,19 @@ export class SmartVictimDetailComponent implements OnInit, OnChanges {
1384
1451
  }
1385
1452
 
1386
1453
 
1454
+
1455
+ update() {
1456
+ // this.task.update(task => {
1457
+ // if (index === undefined) {
1458
+ // task.completed = completed;
1459
+ // task.subtasks?.forEach(t => (t.completed = completed));
1460
+ // } else {
1461
+ // task.subtasks![index].completed = completed;
1462
+ // task.completed = task.subtasks?.every(t => t.completed) ?? true;
1463
+ // }
1464
+ // return {...task};
1465
+ // });
1466
+ }
1467
+
1468
+
1387
1469
  }
@@ -89,9 +89,6 @@ export class VictimDrugUse {
89
89
  ) { }
90
90
  }
91
91
 
92
-
93
-
94
-
95
92
  export class VictimSupport {
96
93
  constructor(
97
94
  // public victimSupportId: number,
@@ -105,6 +102,17 @@ export class VictimSupport {
105
102
  ) { }
106
103
  }
107
104
 
105
+ export class VictimRelationship {
106
+ constructor(
107
+ public victimId: number,
108
+
109
+ public victimRelationshipTypeId: string,
110
+
111
+ public modifiedBy: number
112
+
113
+ ) { }
114
+ }
115
+
108
116
  export class VictimGuardian {
109
117
  constructor(public victimGuardianId: number,
110
118
 
@@ -285,7 +293,7 @@ export interface VictimServiceTypeProgramProviderModel {
285
293
  public alcoholUseFlag: boolean,
286
294
  public accessRisk: string,
287
295
  public modifiedBy: number,
288
- public relationship: string,
296
+ //public relationship: string,
289
297
 
290
298
  public vVictimAdvocate: VictimAdvocate,
291
299
  public vVictimGuardian: VictimGuardian,
@@ -294,6 +302,8 @@ export interface VictimServiceTypeProgramProviderModel {
294
302
  public victimWeaponUses: VictimWeaponUse[],
295
303
  public victimDrugUses: VictimDrugUse[],
296
304
 
305
+ public victimRelationships: VictimRelationship[],
306
+
297
307
  public allowCsosaContactFlag: boolean,
298
308
  public liveWithOffenderFlag: boolean
299
309
  ) { }
@@ -366,6 +366,25 @@ postVictimSupport(id: any, val: any) {
366
366
  );
367
367
  }
368
368
 
369
+ /*
370
+ putVictimRelationship(id: any, val: any) {
371
+ const tempVal = JSON.stringify(val);
372
+ return this.http.put(this.smartVictimServiceUrl + 'VictimRelationships/' + id, tempVal, options).pipe
373
+ (
374
+ map(res => { return res;})
375
+ );
376
+ }
377
+
378
+ postVictimRelationship(id: any, val: any) {
379
+ const tempVal = JSON.stringify(val);
380
+ return this.http.post(this.smartVictimServiceUrl + 'VictimRelationships/' + id, tempVal, options).pipe
381
+ (
382
+ map(res => { return res;})
383
+ );
384
+ }
385
+
386
+ */
387
+
369
388
  deleteVictims(val: any, staffId: number) {
370
389
  return this.http.delete(this.smartVictimServiceUrl+ 'Victims/' + val + '?staffId='+ staffId, options).pipe
371
390
  (
@@ -1,6 +1,7 @@
1
1
  import { MsalGuard } from '@azure/msal-angular';
2
2
  import { SmartErrorComponent } from '@csmart/ngc-smart-core';
3
- import { LoginStaffResolverService, SelectedOffenderResolverService} from '@csmart/ngc-smart-core';
3
+ import { LoginStaffResolverService, SelectedOffenderResolverService,SmartAuthorizationGuard,
4
+ SmartOffenderRedirectGuard,} from '@csmart/ngc-smart-core';
4
5
  import { Routes, RouterModule } from '@angular/router';
5
6
  import { NgModule } from '@angular/core';
6
7
  import { CaseNoteComponent } from './caseNote/caseNote.component';
@@ -13,13 +14,13 @@ import { NgcSmartVictimComponent} from './smart-victim.component'
13
14
  const routes: Routes = [
14
15
 
15
16
  //{path: 'casenote/:victimId', component: CaseNoteComponent,pathMatch: 'full',canActivate: [MsalGuard],resolve: { loginStaff: LoginStaffResolverService } },
16
- {path: 'casenote/:victimId/:offenderId', component: CaseNoteComponent,pathMatch: 'full',canActivate: [MsalGuard],resolve: { loginStaff: LoginStaffResolverService } },
17
- {path: 'saftyPlan/:victimId', component: VictimSafetyPlanComponent,pathMatch: 'full',resolve: { loginStaff: LoginStaffResolverService } },
18
- {path: 'saftyPlanDetail/:victimServiceId/:victimId', component: VictimSafetyPlanDetailComponent,pathMatch: 'full',resolve: { loginStaff: LoginStaffResolverService } },
19
- {path: 'victimList', component: NgcSmartVictimComponent, resolve: { loginStaff: LoginStaffResolverService, selectedOffender: SelectedOffenderResolverService} },
20
- {path: 'victimHome', component: NgcSmartVictimComponent, resolve: { loginStaff: LoginStaffResolverService, selectedOffender: SelectedOffenderResolverService} },
21
- {path: 'victimContact/:victimId', component: ContactComponent, resolve: { loginStaff: LoginStaffResolverService, selectedOffender: SelectedOffenderResolverService} },
22
- {path: 'victimDetail/:victimId', component: SmartVictimDetailComponent, resolve: { loginStaff: LoginStaffResolverService, selectedOffender: SelectedOffenderResolverService} },
17
+ {path: 'casenote/:victimId/:offenderId', component: CaseNoteComponent,pathMatch: 'full', canActivate: [MsalGuard, SmartAuthorizationGuard], },
18
+ {path: 'saftyPlan/:victimId', component: VictimSafetyPlanComponent,pathMatch: 'full',},
19
+ {path: 'saftyPlanDetail/:victimServiceId/:victimId', component: VictimSafetyPlanDetailComponent,pathMatch: 'full', },
20
+ {path: 'victimList', component: NgcSmartVictimComponent, },
21
+ {path: 'victimHome', component: NgcSmartVictimComponent, },
22
+ {path: 'victimContact/:victimId', component: ContactComponent, },
23
+ {path: 'victimDetail/:victimId', component: SmartVictimDetailComponent, },
23
24
  {path: 'smart-error', component: SmartErrorComponent }
24
25
  ];
25
26