+2
-2
@@ -40,14 +40,14 @@ export class AcceptClientTransferComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the accept-approval savings form.
|
||||
* Creates the accept client transfer form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createAcceptClientTransferForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the accept-approval savings account form.
|
||||
* Creates the accept client transfer form.
|
||||
*/
|
||||
createAcceptClientTransferForm() {
|
||||
this.acceptClientTransferForm = this.formBuilder.group({
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ export class ActivateClientComponent implements OnInit {
|
||||
maxDate = new Date();
|
||||
/** Activate client form. */
|
||||
activateClientForm: FormGroup;
|
||||
/** Client Account Id */
|
||||
/** Client Id */
|
||||
clientId: any;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ export class ClientAssignStaffComponent implements OnInit {
|
||||
|
||||
/** Client Assign Staff form. */
|
||||
clientAssignStaffForm: FormGroup;
|
||||
/** Field Officer Data */
|
||||
/** Staff Data */
|
||||
staffData: any;
|
||||
/** Client Data */
|
||||
clientData: any;
|
||||
|
||||
@@ -21,7 +21,7 @@ export class CloseClientComponent implements OnInit {
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Close Share Account form. */
|
||||
/** Close Client form. */
|
||||
closeClientForm: FormGroup;
|
||||
/** Client Data */
|
||||
closureData: any;
|
||||
|
||||
+2
-5
@@ -16,7 +16,7 @@ import { ClientsService } from 'app/clients/clients.service';
|
||||
})
|
||||
export class RejectClientTransferComponent implements OnInit {
|
||||
|
||||
/** Reject Approval Savings Account form. */
|
||||
/** Reject Client Transfer form. */
|
||||
rejectClientTransferForm: FormGroup;
|
||||
/** Client Id */
|
||||
clientId: any;
|
||||
@@ -39,15 +39,12 @@ export class RejectClientTransferComponent implements OnInit {
|
||||
this.clientId = this.route.parent.snapshot.params['clientId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the reject-approval savings form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createRejectClientTransferForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the reject-approval savings account form.
|
||||
* Creates the reject client transfer form.
|
||||
*/
|
||||
createRejectClientTransferForm() {
|
||||
this.rejectClientTransferForm = this.formBuilder.group({
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { ClientsService } from '../../../clients.service';
|
||||
import { AuthenticationService } from '../../../../core/authentication/authentication.service';
|
||||
|
||||
/**
|
||||
* Take Survey Component
|
||||
*/
|
||||
@@ -13,7 +14,7 @@ import { AuthenticationService } from '../../../../core/authentication/authentic
|
||||
templateUrl: './take-survey.component.html',
|
||||
styleUrls: ['./take-survey.component.scss']
|
||||
})
|
||||
export class TakeSurveyComponent implements OnInit {
|
||||
export class TakeSurveyComponent {
|
||||
|
||||
/** List of all Survey Data */
|
||||
allSurveyData: any;
|
||||
@@ -38,7 +39,10 @@ export class TakeSurveyComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* Retrieves the survey data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {ClientsService} clientsService ClientsService
|
||||
* @param {Router} router Router
|
||||
* @param {AuthenticationService} authenticationService AuthenticationService
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private clientsService: ClientsService,
|
||||
@@ -48,15 +52,12 @@ export class TakeSurveyComponent implements OnInit {
|
||||
this.allSurveyData = data.clientActionData;
|
||||
this.clientId = this.route.parent.parent.snapshot.paramMap.get('clientId');
|
||||
});
|
||||
|
||||
/** Retrieves User ID */
|
||||
const savedCredentials = this.authenticationService.getCredentials();
|
||||
this.userId = savedCredentials.userId;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
// TODO: document the function
|
||||
onSurveyChange(resEvent: any) {
|
||||
if (resEvent.value) {
|
||||
this.surveyData = resEvent.value;
|
||||
@@ -68,6 +69,7 @@ export class TakeSurveyComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: document the function
|
||||
groupBy(array: any, func: any) {
|
||||
const groups = {};
|
||||
array.forEach((ele: any) => {
|
||||
@@ -80,6 +82,24 @@ export class TakeSurveyComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if there is any response or not from the user and enables the submit button accordingly
|
||||
*/
|
||||
isAnyResponse(): boolean {
|
||||
if (this.surveyData) {
|
||||
this.surveyData.questionDatas.forEach((element: any) => {
|
||||
if (element.answer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the user survey response.
|
||||
*/
|
||||
submit() {
|
||||
this.formData = {
|
||||
userId: 0,
|
||||
@@ -109,24 +129,9 @@ export class TakeSurveyComponent implements OnInit {
|
||||
this.formData.scorecardValues.push(tmp);
|
||||
}
|
||||
});
|
||||
|
||||
// Submits the user survey response
|
||||
this.clientsService.createNewSurvey(this.surveyData.id, this.formData).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// Checks if there is any response or not from the user and enables the submit button accordingly
|
||||
isAnyResponse(): boolean {
|
||||
if (this.surveyData) {
|
||||
this.surveyData.questionDatas.forEach((element: any) => {
|
||||
if (element.answer) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import { ClientsService } from 'app/clients/clients.service';
|
||||
})
|
||||
export class UndoClientTransferComponent implements OnInit {
|
||||
|
||||
/** Undo Approval Savings Account form. */
|
||||
/** Undo Client Transfer form. */
|
||||
undoClientTransferForm: FormGroup;
|
||||
/** Client Id */
|
||||
clientId: any;
|
||||
@@ -40,14 +40,14 @@ export class UndoClientTransferComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the undo-approval savings form.
|
||||
* Creates the undo client transfer form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createUndoClientTransferForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the undo-approval savings account form.
|
||||
* Creates the undo client transfer form.
|
||||
*/
|
||||
createUndoClientTransferForm() {
|
||||
this.undoClientTransferForm = this.formBuilder.group({
|
||||
|
||||
+1
-4
@@ -18,7 +18,7 @@ export class UpdateClientSavingsAccountComponent implements OnInit {
|
||||
|
||||
/** Client Update Savings Account form. */
|
||||
clientSavingsAccountForm: FormGroup;
|
||||
/** Savings Accounts Officer Data */
|
||||
/** Savings Accounts Data */
|
||||
savingsAccounts: any;
|
||||
/** Client Data */
|
||||
clientData: any;
|
||||
@@ -39,9 +39,6 @@ export class UpdateClientSavingsAccountComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the client update savings account form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.savingsAccounts = this.clientData.savingAccountOptions;
|
||||
this.createClientSavingsAccountForm();
|
||||
|
||||
Reference in New Issue
Block a user