@csmart/ngc-smart-victim 1.18.7 → 1.18.8
Sign up to get free protection for your applications and to get access to all the features.
- package/karma.conf.js +32 -0
- package/ng-package.json +7 -0
- package/package.json +6 -22
- package/src/lib/caseNote/caseNote.component.css +20 -0
- package/src/lib/caseNote/caseNote.component.html +188 -0
- package/src/lib/caseNote/caseNote.component.ts +265 -0
- package/src/lib/common-dialog/common-dialog.component.css +10 -0
- package/src/lib/common-dialog/common-dialog.component.html +23 -0
- package/src/lib/common-dialog/common-dialog.component.spec.ts +25 -0
- package/src/lib/common-dialog/common-dialog.component.ts +21 -0
- package/src/lib/common-dialog/common-dialog.module.ts +22 -0
- package/src/lib/common-dialog/common-dialog.service.ts +35 -0
- package/src/lib/contact/contact.component.css +20 -0
- package/src/lib/contact/contact.component.html +124 -0
- package/src/lib/contact/contact.component.ts +176 -0
- package/src/lib/email-notification.service.ts +42 -0
- package/src/lib/email.services.ts +51 -0
- package/src/lib/http.service.ts +34 -0
- package/src/lib/intake.service.ts +82 -0
- package/src/lib/loader.service.ts +11 -0
- package/src/lib/safetyPlan/serviceProvider.component.ts +94 -0
- package/src/lib/safetyPlan/victimSafetyPlan.component.css +27 -0
- package/src/lib/safetyPlan/victimSafetyPlan.component.html +85 -0
- package/src/lib/safetyPlan/victimSafetyPlan.component.ts +178 -0
- package/src/lib/safetyPlan/victimSafetyPlanDetail.component.html +234 -0
- package/src/lib/safetyPlan/victimSafetyPlanDetail.component.ts +492 -0
- package/src/lib/shared/app.shared.module.ts +111 -0
- package/src/lib/shared/validators/date.validator.ts +73 -0
- package/src/lib/shared/validators/index.ts +1 -0
- package/src/lib/smart-victim-delete-confirm.component.ts +35 -0
- package/src/lib/smart-victim-detail/smart-victim-detail.component.css +43 -0
- package/src/lib/smart-victim-detail/smart-victim-detail.component.html +869 -0
- package/src/lib/smart-victim-detail/smart-victim-detail.component.spec.ts +25 -0
- package/src/lib/smart-victim-detail/smart-victim-detail.component.ts +1384 -0
- package/src/lib/smart-victim.component.css +192 -0
- package/src/lib/smart-victim.component.html +138 -0
- package/src/lib/smart-victim.component.spec.ts +25 -0
- package/src/lib/smart-victim.component.ts +329 -0
- package/src/lib/smart-victim.model.ts +301 -0
- package/src/lib/smart-victim.module.ts +110 -0
- package/src/lib/smart-victim.service.spec.ts +12 -0
- package/src/lib/smart-victim.service.ts +557 -0
- package/src/lib/victim-routing.module.ts +35 -0
- package/{lib/victimSearch/VictimSearchFilter.d.ts → src/lib/victimSearch/VictimSearchFilter.ts} +9 -7
- package/src/lib/victimSearch/victimSearchForm.component.html +35 -0
- package/src/lib/victimSearch/victimSearchForm.component.ts +41 -0
- package/{public-api.d.ts → src/public-api.ts} +12 -7
- package/src/test.ts +22 -0
- package/tsconfig.lib.json +37 -0
- package/tsconfig.spec.json +17 -0
- package/tslint.json +17 -0
- package/esm2022/csmart-ngc-smart-victim.mjs +0 -5
- package/esm2022/lib/caseNote/caseNote.component.mjs +0 -194
- package/esm2022/lib/common-dialog/common-dialog.component.mjs +0 -23
- package/esm2022/lib/common-dialog/common-dialog.module.mjs +0 -34
- package/esm2022/lib/common-dialog/common-dialog.service.mjs +0 -33
- package/esm2022/lib/contact/contact.component.mjs +0 -140
- package/esm2022/lib/email.services.mjs +0 -42
- package/esm2022/lib/intake.service.mjs +0 -57
- package/esm2022/lib/safetyPlan/serviceProvider.component.mjs +0 -99
- package/esm2022/lib/safetyPlan/victimSafetyPlan.component.mjs +0 -116
- package/esm2022/lib/safetyPlan/victimSafetyPlanDetail.component.mjs +0 -340
- package/esm2022/lib/shared/app.shared.module.mjs +0 -215
- package/esm2022/lib/shared/validators/date.validator.mjs +0 -59
- package/esm2022/lib/shared/validators/index.mjs +0 -2
- package/esm2022/lib/smart-victim-delete-confirm.component.mjs +0 -44
- package/esm2022/lib/smart-victim-detail/smart-victim-detail.component.mjs +0 -1104
- package/esm2022/lib/smart-victim.component.mjs +0 -316
- package/esm2022/lib/smart-victim.model.mjs +0 -133
- package/esm2022/lib/smart-victim.module.mjs +0 -128
- package/esm2022/lib/smart-victim.service.mjs +0 -352
- package/esm2022/lib/victim-routing.module.mjs +0 -41
- package/esm2022/lib/victimSearch/VictimSearchFilter.mjs +0 -3
- package/esm2022/lib/victimSearch/victimSearchForm.component.mjs +0 -38
- package/esm2022/public-api.mjs +0 -11
- package/fesm2022/csmart-ngc-smart-victim.mjs +0 -3263
- package/fesm2022/csmart-ngc-smart-victim.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/caseNote/caseNote.component.d.ts +0 -51
- package/lib/common-dialog/common-dialog.component.d.ts +0 -14
- package/lib/common-dialog/common-dialog.module.d.ts +0 -8
- package/lib/common-dialog/common-dialog.service.d.ts +0 -11
- package/lib/contact/contact.component.d.ts +0 -40
- package/lib/email.services.d.ts +0 -11
- package/lib/intake.service.d.ts +0 -57
- package/lib/safetyPlan/serviceProvider.component.d.ts +0 -19
- package/lib/safetyPlan/victimSafetyPlan.component.d.ts +0 -54
- package/lib/safetyPlan/victimSafetyPlanDetail.component.d.ts +0 -62
- package/lib/shared/app.shared.module.d.ts +0 -33
- package/lib/shared/validators/date.validator.d.ts +0 -9
- package/lib/shared/validators/index.d.ts +0 -1
- package/lib/smart-victim-delete-confirm.component.d.ts +0 -12
- package/lib/smart-victim-detail/smart-victim-detail.component.d.ts +0 -129
- package/lib/smart-victim.component.d.ts +0 -69
- package/lib/smart-victim.model.d.ts +0 -205
- package/lib/smart-victim.module.d.ts +0 -49
- package/lib/smart-victim.service.d.ts +0 -71
- package/lib/victim-routing.module.d.ts +0 -7
- package/lib/victimSearch/victimSearchForm.component.d.ts +0 -14
@@ -0,0 +1,492 @@
|
|
1
|
+
import { Component, OnInit,Inject } from '@angular/core';
|
2
|
+
import { NgcSmartVictimService } from '../smart-victim.service';
|
3
|
+
import { UntypedFormControl, UntypedFormGroup, UntypedFormBuilder,Validators } from '@angular/forms';
|
4
|
+
import { VictimSafetyPlan,VictimServiceDetail,
|
5
|
+
VictimServiceStatusHistory,VictimServiceTypeProgramProviderModel,
|
6
|
+
ProviderListCollectionModel } from '../smart-victim.model';
|
7
|
+
import { MatDialog } from '@angular/material/dialog';
|
8
|
+
import { CommonDialogService} from '.././common-dialog/common-dialog.service';
|
9
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
10
|
+
import { Observable } from 'rxjs';
|
11
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
12
|
+
import { SelectedOffender, LoginStaff } from '@csmart/ngc-smart-core';
|
13
|
+
import { dateValidator, passDateValidator } from '../shared/validators';
|
14
|
+
import { SeriveProviderComponent} from '../safetyPlan/serviceProvider.component'
|
15
|
+
import { ProvidersDialogData} from '../smart-victim.model';
|
16
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
17
|
+
import { MatTableDataSource } from '@angular/material/table';
|
18
|
+
|
19
|
+
@Component({
|
20
|
+
templateUrl: './victimSafetyPlanDetail.component.html',
|
21
|
+
providers: [CommonDialogService],
|
22
|
+
styleUrls: ['./victimSafetyPlan.component.css']
|
23
|
+
|
24
|
+
})
|
25
|
+
|
26
|
+
export class VictimSafetyPlanDetailComponent implements OnInit {
|
27
|
+
|
28
|
+
|
29
|
+
hiddenAddNewFlag: boolean;
|
30
|
+
safetyPlans: VictimSafetyPlan[];
|
31
|
+
safetyPlan: VictimSafetyPlan;
|
32
|
+
editSafetyPlan: VictimSafetyPlan = <VictimSafetyPlan>{};
|
33
|
+
errorMessage: string;
|
34
|
+
contactTypes: any[];
|
35
|
+
contactPurposes: any[];
|
36
|
+
victimServiceTypes: any[];
|
37
|
+
victimSafetyPlans: VictimSafetyPlan[];
|
38
|
+
victimServiceStatus: any[];
|
39
|
+
providerList: VictimServiceTypeProgramProviderModel[];
|
40
|
+
providerListCollection:ProviderListCollectionModel[]=[];
|
41
|
+
victimServiceDetail: VictimServiceDetail[];
|
42
|
+
indx:any;
|
43
|
+
serviceCheck = [];
|
44
|
+
victimName: string;
|
45
|
+
isDisplay: boolean;
|
46
|
+
staffId: number;
|
47
|
+
victimId: number;
|
48
|
+
victimServiceId: number;
|
49
|
+
offenderId: number;
|
50
|
+
loginStaff: LoginStaff;
|
51
|
+
private sub: any;
|
52
|
+
result: any;
|
53
|
+
victimServiceStatusHistoriesDataSource= new MatTableDataSource();
|
54
|
+
providerId: string;
|
55
|
+
selected: string;
|
56
|
+
|
57
|
+
|
58
|
+
spForm: UntypedFormGroup;
|
59
|
+
|
60
|
+
constructor(
|
61
|
+
public dialog: MatDialog,
|
62
|
+
private _victimServicesComponent: NgcSmartVictimService,
|
63
|
+
private http: HttpClient,
|
64
|
+
public snackBar: MatSnackBar,
|
65
|
+
private route: ActivatedRoute,
|
66
|
+
private router: Router,
|
67
|
+
private commonDialogService: CommonDialogService,
|
68
|
+
private formBuilder: UntypedFormBuilder,
|
69
|
+
|
70
|
+
) {
|
71
|
+
|
72
|
+
this.initForm();
|
73
|
+
}
|
74
|
+
|
75
|
+
private initForm() {
|
76
|
+
|
77
|
+
|
78
|
+
this.spForm = this.formBuilder.group({
|
79
|
+
serviceGoal: new UntypedFormControl('', Validators.compose([
|
80
|
+
Validators.required ])),
|
81
|
+
goalStatus: new UntypedFormControl('', Validators.compose([
|
82
|
+
Validators.required ])),
|
83
|
+
goalStatusDate: new UntypedFormControl('', Validators.compose([
|
84
|
+
Validators.required,dateValidator() ])),
|
85
|
+
comment: new UntypedFormControl('',Validators.required)
|
86
|
+
});
|
87
|
+
this.spForm.markAsPristine();
|
88
|
+
this.spForm.markAsUntouched();
|
89
|
+
|
90
|
+
}
|
91
|
+
|
92
|
+
ngOnInit() {
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
var data = this.route.snapshot.data;
|
97
|
+
this.loginStaff = data.loginStaff;
|
98
|
+
this.staffId = this.loginStaff.staffId;
|
99
|
+
|
100
|
+
this.sub = this.route.params.subscribe(params => {
|
101
|
+
this.victimServiceId = params['victimServiceId'];
|
102
|
+
this.victimId = params['victimId'];
|
103
|
+
|
104
|
+
});
|
105
|
+
|
106
|
+
this.hiddenAddNewFlag = false;
|
107
|
+
this.isDisplay = false;
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
this._victimServicesComponent.getVictimServiceTypes().subscribe(
|
112
|
+
(items: any) => {
|
113
|
+
this.victimServiceTypes = items;
|
114
|
+
}
|
115
|
+
);
|
116
|
+
|
117
|
+
this._victimServicesComponent.getVictimServiceStatus().subscribe(
|
118
|
+
(items: any) => {
|
119
|
+
this.victimServiceStatus = items;
|
120
|
+
}
|
121
|
+
);
|
122
|
+
|
123
|
+
this._victimServicesComponent.getVictim(this.victimId).subscribe(
|
124
|
+
(items: any) => {
|
125
|
+
this.victimName = items.firstName + ', ' + items.lastName;
|
126
|
+
}
|
127
|
+
);
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
//---------------graphQL--------------------------------------
|
132
|
+
// this.getVictimServiceTypeProgramProviders().subscribe(result => {
|
133
|
+
// this.providerList = result;
|
134
|
+
// });
|
135
|
+
// console.log('this.victimServiceId');
|
136
|
+
// console.log(this.victimServiceId);
|
137
|
+
|
138
|
+
if (this.victimServiceId!=0){
|
139
|
+
this._victimServicesComponent.getVictimServices(this.victimServiceId).subscribe(
|
140
|
+
victimSafetyPlans => {
|
141
|
+
console.log('victimSafetyPlans');
|
142
|
+
console.log(victimSafetyPlans);
|
143
|
+
|
144
|
+
this.editSafetyPlan = victimSafetyPlans[0];
|
145
|
+
this.victimId = victimSafetyPlans[0].victimId;
|
146
|
+
|
147
|
+
console.log('this.editSafetyPlan');
|
148
|
+
console.log(this.editSafetyPlan);
|
149
|
+
// console.log('this.editSafetyPlan.goal');
|
150
|
+
// console.log(this.editSafetyPlan.goal);
|
151
|
+
// console.log('this.editSafetyPlan[0].goal');
|
152
|
+
// console.log(this.editSafetyPlan[0].goal);
|
153
|
+
|
154
|
+
}
|
155
|
+
);
|
156
|
+
|
157
|
+
this._victimServicesComponent.getServiceStatusHistories(this.victimServiceId).subscribe(
|
158
|
+
victimServiceStatusHistories => {
|
159
|
+
// this.victimServiceStatusHistories = victimServiceStatusHistories;
|
160
|
+
this.victimServiceStatusHistoriesDataSource.data = victimServiceStatusHistories;
|
161
|
+
}
|
162
|
+
);
|
163
|
+
|
164
|
+
}
|
165
|
+
|
166
|
+
this.loadProvider();
|
167
|
+
|
168
|
+
}
|
169
|
+
//pass in id
|
170
|
+
isInArray(providerListCollectionKey:string, serviceTypeName: string, event){
|
171
|
+
|
172
|
+
console.log('providerListCollectionKey');
|
173
|
+
console.log(providerListCollectionKey);
|
174
|
+
|
175
|
+
|
176
|
+
console.log('serviceTypeName');
|
177
|
+
console.log(serviceTypeName);
|
178
|
+
|
179
|
+
console.log('event.source.value');
|
180
|
+
console.log(event.checked);
|
181
|
+
|
182
|
+
if (event.checked == true){
|
183
|
+
|
184
|
+
for(let j=0;j<this.providerListCollection.length;j++){
|
185
|
+
if(providerListCollectionKey==this.providerListCollection[j].groupId){
|
186
|
+
this.providerListCollection[j].isDisplay=!this.providerListCollection[j].isDisplay;
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
const dialogRef = this.dialog.open(SeriveProviderComponent, {
|
191
|
+
width: '500px',
|
192
|
+
data: <ProvidersDialogData>{
|
193
|
+
|
194
|
+
serviceType:serviceTypeName,
|
195
|
+
serviceTypeId: providerListCollectionKey,
|
196
|
+
providerCollections: [...this.providerListCollection],
|
197
|
+
},
|
198
|
+
panelClass: 'formFieldWidth480',
|
199
|
+
});
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
dialogRef.afterClosed().subscribe((result: any) => {
|
204
|
+
console.log('The dialog was closed');
|
205
|
+
console.log(result);
|
206
|
+
if (result) {
|
207
|
+
console.log('The dialog was closed, inside result');
|
208
|
+
this.savePlanProvider(providerListCollectionKey,result.voteeProviderId);
|
209
|
+
|
210
|
+
}
|
211
|
+
|
212
|
+
|
213
|
+
});
|
214
|
+
|
215
|
+
// return;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
}//if event.checked == true
|
220
|
+
//this.router.navigate(['saftyPlanDetail', this.victimServiceId, this.victimId ]);
|
221
|
+
|
222
|
+
}
|
223
|
+
|
224
|
+
loadProvider(){
|
225
|
+
|
226
|
+
this.providerListCollection=[];
|
227
|
+
this._victimServicesComponent.getvVictimServiceTypeProgramProviders()
|
228
|
+
.subscribe(
|
229
|
+
(providerList:VictimServiceTypeProgramProviderModel[] )=>{
|
230
|
+
if(providerList){
|
231
|
+
|
232
|
+
let providers = Object.create(null);
|
233
|
+
for(let i=0;i<providerList.length;i++){
|
234
|
+
|
235
|
+
if (!providers[providerList[i].victimServiceTypeId]) {
|
236
|
+
providers[providerList[i].victimServiceTypeId] = [];
|
237
|
+
|
238
|
+
if ( this.editSafetyPlan.vVictimServiceDetails != null ){
|
239
|
+
for (let j=0; j<this.editSafetyPlan.vVictimServiceDetails.length; j++){
|
240
|
+
if ( providerList[i].victimServiceTypeId == this.editSafetyPlan.vVictimServiceDetails[j].victimServiceId.toString() ){
|
241
|
+
this.isDisplay = true;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
this.providerListCollection.push({ groupId: providerList[i].victimServiceTypeId,isDisplay:this.isDisplay, collection: providers[providerList[i].victimServiceTypeId] });
|
246
|
+
}
|
247
|
+
|
248
|
+
providers[providerList[i].victimServiceTypeId].push(providerList[i]);
|
249
|
+
|
250
|
+
}
|
251
|
+
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
});
|
256
|
+
|
257
|
+
}
|
258
|
+
//---------------graphQL--------------------------------------
|
259
|
+
// getVictimServiceTypeProgramProviders(): Observable<VictimServiceTypeProgramProviderModel[]> {
|
260
|
+
// const queryString = `
|
261
|
+
// {
|
262
|
+
// findVictimServiceTypeProgramProviders {
|
263
|
+
// data {
|
264
|
+
// victimServiceTypeProgramProviderId
|
265
|
+
// victimServiceType
|
266
|
+
// victimProgramProvider
|
267
|
+
// }
|
268
|
+
// }
|
269
|
+
// }`;
|
270
|
+
|
271
|
+
// return this.http.post<any>(environment.smartApiUrl, { query: queryString })
|
272
|
+
// .map(result => {
|
273
|
+
// return result.data.findVictimServiceTypeProgramProviders.data;
|
274
|
+
// });
|
275
|
+
// }
|
276
|
+
|
277
|
+
evaluateSelection(victimServiceTypeId: string) {
|
278
|
+
if (this.editSafetyPlan.vVictimServiceDetails) {
|
279
|
+
return this.editSafetyPlan.vVictimServiceDetails.findIndex(r => r.victimServiceTypeId === victimServiceTypeId) >= 0;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
|
284
|
+
savePlanProvider(victimServiceTypeId: string,victimProgramProviderId: string){
|
285
|
+
|
286
|
+
console.log('savePlanProvider');
|
287
|
+
console.log(victimServiceTypeId);
|
288
|
+
console.log(victimProgramProviderId);
|
289
|
+
|
290
|
+
if (victimProgramProviderId === "" || victimProgramProviderId=== null || victimProgramProviderId === undefined){
|
291
|
+
|
292
|
+
this.snackBar.open('Please pick a program on the drop down list !', '', { duration: 120,});
|
293
|
+
// alert('Please pick a program on the drop down list !');
|
294
|
+
|
295
|
+
}else
|
296
|
+
{
|
297
|
+
|
298
|
+
if ( this.victimServiceId == 0){
|
299
|
+
//insert
|
300
|
+
console.log('insert new plan');
|
301
|
+
const safetyPlan: VictimSafetyPlan = {
|
302
|
+
victimId:this.victimId,
|
303
|
+
fullName: null,
|
304
|
+
victimServiceId: 0,
|
305
|
+
goal:this.editSafetyPlan.goal,
|
306
|
+
comment: this.editSafetyPlan.comment,
|
307
|
+
modifiedBy:this.staffId,
|
308
|
+
victimServiceStatusId: null,
|
309
|
+
status: null,
|
310
|
+
startDate: null,
|
311
|
+
vVictimServiceDetails: null,
|
312
|
+
victimName: null
|
313
|
+
};
|
314
|
+
this._victimServicesComponent.addSafetyPlan(safetyPlan).subscribe(
|
315
|
+
(itms:any)=>{
|
316
|
+
const victimServiceStatus: VictimServiceStatusHistory= {
|
317
|
+
victimServiceStatusHistoryId:0,
|
318
|
+
victimServiceId: itms.victimServiceId,
|
319
|
+
victimServiceStatusId: this.editSafetyPlan.victimServiceStatusId ,
|
320
|
+
startDate: this.editSafetyPlan.startDate,
|
321
|
+
modifiedBy:this.staffId,
|
322
|
+
comment:'test add safety plan'
|
323
|
+
};
|
324
|
+
|
325
|
+
this._victimServicesComponent.addVictimServiceStatus(victimServiceStatus).subscribe(
|
326
|
+
|
327
|
+
() =>{
|
328
|
+
console.log('check itms.victimServiceId iniside add victim serive status');
|
329
|
+
console.log(itms.victimServiceId);
|
330
|
+
|
331
|
+
const victimServiceDetail: VictimServiceDetail = {
|
332
|
+
victimServiceId: itms.victimServiceId,
|
333
|
+
victimServiceDetailId: 0,
|
334
|
+
victimServiceTypeId: victimServiceTypeId,
|
335
|
+
victimProgramProviderId: victimProgramProviderId,
|
336
|
+
modifiedBy: this.staffId,
|
337
|
+
victimProgramProvider: null
|
338
|
+
};
|
339
|
+
|
340
|
+
console.log('add plan provider here at insert');
|
341
|
+
|
342
|
+
this._victimServicesComponent.addPlanProvider(victimServiceDetail).subscribe(
|
343
|
+
|
344
|
+
() =>{
|
345
|
+
|
346
|
+
this.router.navigate(['saftyPlanDetail', itms.victimServiceId, this.victimId ]);
|
347
|
+
|
348
|
+
}
|
349
|
+
);
|
350
|
+
|
351
|
+
}
|
352
|
+
);
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
}
|
357
|
+
|
358
|
+
|
359
|
+
);
|
360
|
+
}
|
361
|
+
else//update
|
362
|
+
{
|
363
|
+
const victimServiceDetail: VictimServiceDetail = {
|
364
|
+
victimServiceId: this.victimServiceId,
|
365
|
+
victimServiceDetailId: 0,
|
366
|
+
victimServiceTypeId: victimServiceTypeId,
|
367
|
+
victimProgramProviderId: victimProgramProviderId,
|
368
|
+
modifiedBy: this.staffId,
|
369
|
+
victimProgramProvider: null
|
370
|
+
};
|
371
|
+
console.log('add plan provider here at update');
|
372
|
+
this._victimServicesComponent.addPlanProvider(victimServiceDetail).subscribe(
|
373
|
+
|
374
|
+
() =>{
|
375
|
+
|
376
|
+
this.router.navigate(['saftyPlanDetail', this.victimServiceId, this.victimId ]);
|
377
|
+
|
378
|
+
}
|
379
|
+
);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
|
384
|
+
}
|
385
|
+
|
386
|
+
|
387
|
+
deleteProvider(victimProgramProviderId: string){
|
388
|
+
|
389
|
+
this.commonDialogService
|
390
|
+
.confirm('', 'Do you want to delete this provider?', 'Yes', 'No')
|
391
|
+
.subscribe(res => {this.result = res;
|
392
|
+
if (this.result) {
|
393
|
+
this._victimServicesComponent.deleteProvider(victimProgramProviderId, this.staffId)
|
394
|
+
.subscribe(result => {
|
395
|
+
this.snackBar.open('delete provider Successfully !', '', {
|
396
|
+
duration: 3000,
|
397
|
+
});
|
398
|
+
|
399
|
+
location.reload();
|
400
|
+
|
401
|
+
}
|
402
|
+
);
|
403
|
+
|
404
|
+
}
|
405
|
+
|
406
|
+
});
|
407
|
+
|
408
|
+
// location.reload();
|
409
|
+
|
410
|
+
}
|
411
|
+
saveSafetyPlan() {
|
412
|
+
|
413
|
+
if (this.editSafetyPlan.victimServiceId === undefined ) {
|
414
|
+
|
415
|
+
const safetyPlan: VictimSafetyPlan = {
|
416
|
+
victimId: this.victimId,
|
417
|
+
fullName: null,
|
418
|
+
victimServiceId: 0,
|
419
|
+
goal:this.editSafetyPlan.goal,
|
420
|
+
comment: this.editSafetyPlan.comment,
|
421
|
+
modifiedBy:this.staffId,
|
422
|
+
victimServiceStatusId: null,
|
423
|
+
status: null,
|
424
|
+
startDate: null,
|
425
|
+
vVictimServiceDetails: null,
|
426
|
+
victimName: null
|
427
|
+
};
|
428
|
+
this._victimServicesComponent.addSafetyPlan(safetyPlan).subscribe(
|
429
|
+
(itms:any)=>{
|
430
|
+
const victimServiceStatus: VictimServiceStatusHistory= {
|
431
|
+
victimServiceStatusHistoryId:0,
|
432
|
+
victimServiceId: itms.victimServiceId,
|
433
|
+
victimServiceStatusId: this.editSafetyPlan.victimServiceStatusId ,
|
434
|
+
startDate: this.editSafetyPlan.startDate,
|
435
|
+
modifiedBy:this.staffId,
|
436
|
+
comment:'test add safety Plan'
|
437
|
+
};
|
438
|
+
|
439
|
+
this._victimServicesComponent.addVictimServiceStatus(victimServiceStatus).subscribe(
|
440
|
+
resp=>{
|
441
|
+
this.snackBar.open('Insert status successfully!', '', {
|
442
|
+
duration: 3000,
|
443
|
+
});
|
444
|
+
|
445
|
+
}
|
446
|
+
);
|
447
|
+
|
448
|
+
|
449
|
+
this.router.navigate(['saftyPlanDetail', itms.victimServiceId, this.victimId ]);
|
450
|
+
}
|
451
|
+
|
452
|
+
|
453
|
+
);
|
454
|
+
} else {
|
455
|
+
// this.editSafetyPlan.modifiedBy=this.loginStaff.staffId;
|
456
|
+
this.editSafetyPlan.modifiedBy =this.staffId;
|
457
|
+
this._victimServicesComponent.updateSafetyPlan(this.editSafetyPlan).subscribe(
|
458
|
+
resp=>{
|
459
|
+
// this.snackBar.open('update Successfully!', '', {
|
460
|
+
// duration: 3000,
|
461
|
+
// });
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
const victimServiceStatus: VictimServiceStatusHistory= {
|
466
|
+
victimServiceStatusHistoryId:0,
|
467
|
+
victimServiceId: this.editSafetyPlan.victimServiceId.toString(),
|
468
|
+
victimServiceStatusId: this.editSafetyPlan.victimServiceStatusId ,
|
469
|
+
startDate: this.editSafetyPlan.startDate,
|
470
|
+
modifiedBy:this.staffId,
|
471
|
+
comment:'test update safety Plan'
|
472
|
+
};
|
473
|
+
|
474
|
+
this._victimServicesComponent.addVictimServiceStatus(victimServiceStatus).subscribe();
|
475
|
+
|
476
|
+
|
477
|
+
this.router.navigate(['saftyPlanDetail', this.editSafetyPlan.victimServiceId, this.victimId ]);
|
478
|
+
|
479
|
+
}
|
480
|
+
);
|
481
|
+
}
|
482
|
+
}
|
483
|
+
|
484
|
+
back(){
|
485
|
+
console.log('this.victimId');
|
486
|
+
console.log(this.victimId);
|
487
|
+
this.router.navigate(['saftyPlan', this.victimId]);
|
488
|
+
}
|
489
|
+
|
490
|
+
|
491
|
+
}
|
492
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
import { NgModule } from '@angular/core';
|
2
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
3
|
+
//import {MAT_MOMENT_DATE_FORMATS, MomentDateAdapter} from '@angular/material-moment-adapter';
|
4
|
+
import {BrowserModule} from '@angular/platform-browser';
|
5
|
+
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
6
|
+
import {CdkTableModule} from '@angular/cdk/table';
|
7
|
+
import {DateAdapter, MatNativeDateModule, MatRippleModule, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
|
8
|
+
import {MatIconModule} from '@angular/material/icon';
|
9
|
+
|
10
|
+
|
11
|
+
// import {
|
12
|
+
// MatButtonModule, MatCardModule, MatCheckboxModule, MatToolbarModule, MatSelectModule, MatDatepickerModule,
|
13
|
+
// MatProgressSpinnerModule, MatGridListModule, MatTableModule, MatSidenavModule, MatRadioModule, MatPaginatorModule,
|
14
|
+
// // tslint:disable-next-line:whitespace
|
15
|
+
// MatNativeDateModule, MatSliderModule, MatDialogModule, MatChipsModule,MatSortModule,
|
16
|
+
// MatTabsModule, MatRippleModule, MatListModule, MatInputModule, MatFormFieldModule, MatStepperModule, MatExpansionModule,
|
17
|
+
|
18
|
+
|
19
|
+
// } from '@angular/material';
|
20
|
+
import {MatSnackBarModule} from '@angular/material/snack-bar';
|
21
|
+
import { MatButtonModule } from '@angular/material/button';
|
22
|
+
import { MatCardModule } from '@angular/material/card';
|
23
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
24
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
25
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
26
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
27
|
+
import { MatGridListModule } from '@angular/material/grid-list';
|
28
|
+
import { MatInputModule } from '@angular/material/input';
|
29
|
+
import { MatListModule } from '@angular/material/list';
|
30
|
+
import { MatPaginatorModule } from '@angular/material/paginator';
|
31
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
32
|
+
import { MatRadioModule } from '@angular/material/radio';
|
33
|
+
import { MatSelectModule } from '@angular/material/select';
|
34
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
35
|
+
import { MatSliderModule } from '@angular/material/slider';
|
36
|
+
import { MatSortModule } from '@angular/material/sort';
|
37
|
+
import { MatTableModule } from '@angular/material/table';
|
38
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
39
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
40
|
+
import { MatStepperModule } from "@angular/material/stepper";
|
41
|
+
import { MatChipsModule } from "@angular/material/chips";
|
42
|
+
import { SmartUiModule } from '@csmart/smart-ui';
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
@NgModule(
|
47
|
+
{
|
48
|
+
imports: [
|
49
|
+
|
50
|
+
MatButtonModule,
|
51
|
+
MatCardModule,
|
52
|
+
MatCheckboxModule,
|
53
|
+
MatToolbarModule,
|
54
|
+
MatSelectModule,
|
55
|
+
MatDatepickerModule,
|
56
|
+
MatNativeDateModule,
|
57
|
+
MatDialogModule,
|
58
|
+
MatTabsModule,
|
59
|
+
MatListModule,
|
60
|
+
MatInputModule,
|
61
|
+
MatStepperModule,
|
62
|
+
BrowserAnimationsModule,
|
63
|
+
MatGridListModule,
|
64
|
+
MatProgressSpinnerModule,
|
65
|
+
MatTableModule,
|
66
|
+
MatSidenavModule,
|
67
|
+
MatRadioModule,
|
68
|
+
MatIconModule,
|
69
|
+
MatSliderModule,
|
70
|
+
MatChipsModule,
|
71
|
+
MatSnackBarModule,
|
72
|
+
CdkTableModule,
|
73
|
+
MatSortModule,
|
74
|
+
MatPaginatorModule,
|
75
|
+
MatExpansionModule,
|
76
|
+
MatRippleModule,
|
77
|
+
SmartUiModule
|
78
|
+
],
|
79
|
+
exports: [
|
80
|
+
MatButtonModule,
|
81
|
+
MatCardModule,
|
82
|
+
MatCheckboxModule,
|
83
|
+
MatToolbarModule,
|
84
|
+
MatSelectModule,
|
85
|
+
MatDatepickerModule,
|
86
|
+
MatNativeDateModule,
|
87
|
+
MatDialogModule,
|
88
|
+
MatTabsModule,
|
89
|
+
MatListModule,
|
90
|
+
MatInputModule,
|
91
|
+
MatStepperModule,
|
92
|
+
BrowserAnimationsModule,
|
93
|
+
MatGridListModule,
|
94
|
+
MatProgressSpinnerModule,
|
95
|
+
MatTableModule,
|
96
|
+
MatSidenavModule,
|
97
|
+
MatRadioModule,
|
98
|
+
MatIconModule,
|
99
|
+
MatSliderModule,
|
100
|
+
MatChipsModule,
|
101
|
+
MatSnackBarModule,
|
102
|
+
CdkTableModule,
|
103
|
+
MatSortModule,
|
104
|
+
MatPaginatorModule,
|
105
|
+
MatExpansionModule,
|
106
|
+
MatRippleModule,
|
107
|
+
SmartUiModule
|
108
|
+
]
|
109
|
+
}
|
110
|
+
)
|
111
|
+
export class SharedModule { }
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { AbstractControl, ValidatorFn } from '@angular/forms';
|
2
|
+
|
3
|
+
|
4
|
+
export function dateValidator(): ValidatorFn {
|
5
|
+
return (control: AbstractControl): {[key: string]: any} => {
|
6
|
+
const dateStr = control.value;
|
7
|
+
const invalidObj = { 'date': 'future Date is Not Allowed' };
|
8
|
+
const date = new Date(dateStr);
|
9
|
+
if (date > new Date()) {
|
10
|
+
return invalidObj;
|
11
|
+
}
|
12
|
+
return null;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
export function passDateValidator(): ValidatorFn {
|
18
|
+
return (control: AbstractControl): {[key: string]: any} => {
|
19
|
+
const dateStr = control.value;
|
20
|
+
const invalidObj = { 'date': 'Pass Date is Not Allowed' };
|
21
|
+
const date = new Date(dateStr);
|
22
|
+
if (date < new Date()) {
|
23
|
+
return invalidObj;
|
24
|
+
}
|
25
|
+
return null;
|
26
|
+
};
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
export function dateLessThan(dateField1: string, dateField2: string, validatorField: { [key: string]: boolean }): ValidatorFn {
|
32
|
+
return (c: AbstractControl): { [key: string]: any } | null => {
|
33
|
+
const date1 = c.get(dateField1).value;
|
34
|
+
const date2 = c.get(dateField2).value;
|
35
|
+
|
36
|
+
console.log('date1');
|
37
|
+
console.log(date1);
|
38
|
+
console.log('date2');
|
39
|
+
console.log(date2);
|
40
|
+
//const invalidObj = { 'dateRule': 'date is Not Allowed' };
|
41
|
+
if ((date1 !== null && date2 !== null) && date1 > date2) {
|
42
|
+
console.log(validatorField);
|
43
|
+
return validatorField;
|
44
|
+
//return invalidObj;
|
45
|
+
|
46
|
+
}
|
47
|
+
console.log('return null');
|
48
|
+
return null;
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
export function greaterLessThan(dateField1: string, dateField2: string, validatorField: { [key: string]: boolean }): ValidatorFn {
|
55
|
+
return (c: AbstractControl): { [key: string]: any } | null => {
|
56
|
+
const date1 = c.get(dateField1).value;
|
57
|
+
const date2 = c.get(dateField2).value;
|
58
|
+
|
59
|
+
console.log('end date');
|
60
|
+
console.log(date1);
|
61
|
+
console.log('ver date');
|
62
|
+
console.log(date2);
|
63
|
+
//const invalidObj = { 'dateRule': 'date is Not Allowed' };
|
64
|
+
if ((date1 !== null && date2 !== null) && date1 < date2) {
|
65
|
+
console.log(validatorField);
|
66
|
+
return validatorField;
|
67
|
+
//return invalidObj;
|
68
|
+
|
69
|
+
}
|
70
|
+
console.log('return null');
|
71
|
+
return null;
|
72
|
+
};
|
73
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './date.validator';
|