Business and COB Date management
This commit is contained in:
committed by
Arnold Gálovics
parent
6e973dd50a
commit
1b72136411
@@ -0,0 +1,97 @@
|
||||
<div class="container space">
|
||||
|
||||
<div class="mat-elevation-z8">
|
||||
<div *ngIf="!isBusinessDateEnabled">
|
||||
<p>The Business Date functionality is not enabled. If you need that, Go to Global Configurations and enable the
|
||||
configuration: <code>{{configurationName}}</code></p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="isBusinessDateEnabled">
|
||||
|
||||
<mat-card>
|
||||
<form [formGroup]="businessDateForm">
|
||||
<mat-card-content>
|
||||
<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column" class="space">
|
||||
<div fxFlex="50%">
|
||||
<span fxFlex="40%" class="date-type">User date format: </span>
|
||||
<span fxFlex="60%" class="date-value">{{userDateFormat}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Business Date -->
|
||||
<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||
<div fxFlex="50%" *ngIf="!isEditInProgress">
|
||||
<span fxFlex="40%" class="date-type">Business Date: </span>
|
||||
<span fxFlex="60%" class="date-value">{{businessDate | dateFormat}}</span>
|
||||
</div>
|
||||
|
||||
<mat-form-field (click)="businessDatePicker.open()" *ngIf="isEditInProgress && (dateIndex == 0)">
|
||||
<mat-label>Business Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="businessDatePicker"
|
||||
formControlName="businessDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="businessDatePicker">
|
||||
</mat-datepicker-toggle>
|
||||
<mat-datepicker #businessDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="businessDateForm.controls.businessDate.hasError('required')">
|
||||
Business Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxLayoutGap="2%" fxFlex="22%" class="options-wrapper">
|
||||
<span *ngIf="isEditInProgress && (dateIndex == 0)">
|
||||
<button mat-stroked-button color="primary" [disabled]="businessDateForm.pristine" (click)="submit()"
|
||||
*mifosxHasPermission="'UPDATE_BUSINESSDATE'">
|
||||
Submit
|
||||
</button>
|
||||
</span>
|
||||
<button mat-button *ngIf="isEditInProgress" (click)="editInProgressToggle(0)">
|
||||
Cancel
|
||||
</button>
|
||||
<button type="button" color="primary" *ngIf="!isEditInProgress" mat-icon-button matTooltip="Edit the Business Date"
|
||||
matTooltipPosition="above" (click)="editInProgressToggle(0)">
|
||||
<fa-icon icon="edit" size="lg"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- COB Date -->
|
||||
<div fxFlexFill fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||
<div fxFlex="50%" *ngIf="!isEditInProgress">
|
||||
<span fxFlex="40%" class="date-type">COB Date: </span>
|
||||
<span fxFlex="60%" class="date-value">{{cobDate | dateFormat}}</span>
|
||||
</div>
|
||||
|
||||
<mat-form-field (click)="cobDatePicker.open()" *ngIf="isEditInProgress && (dateIndex == 1)">
|
||||
<mat-label>COB Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="cobDatePicker"
|
||||
formControlName="businessDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="cobDatePicker">
|
||||
</mat-datepicker-toggle>
|
||||
<mat-datepicker #cobDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="businessDateForm.controls.cobDate.hasError('required')">
|
||||
COB Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxLayoutGap="4%" fxFlex="22%" class="options-wrapper">
|
||||
<span *ngIf="isEditInProgress && (dateIndex == 1)">
|
||||
<button mat-stroked-button color="primary" [disabled]="businessDateForm.pristine" (click)="submit()"
|
||||
*mifosxHasPermission="'UPDATE_BUSINESSDATE'">
|
||||
Submit
|
||||
</button>
|
||||
</span>
|
||||
<button mat-button *ngIf="isEditInProgress" (click)="editInProgressToggle(1)">
|
||||
Cancel
|
||||
</button>
|
||||
<button type="button" color="primary" *ngIf="!isEditInProgress" mat-icon-button matTooltip="Edit the COB Date"
|
||||
matTooltipPosition="above" (click)="editInProgressToggle(1)">
|
||||
<fa-icon icon="edit" size="lg"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</form>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
.space {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.date-type {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 400;
|
||||
min-width: 40%;
|
||||
}
|
||||
|
||||
.date-value {
|
||||
display: inline;
|
||||
font-size: 1rem;
|
||||
min-width: 50%;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BusinessDateTabComponent } from './business-date-tab.component';
|
||||
|
||||
describe('BusinessDateTabComponent', () => {
|
||||
let component: BusinessDateTabComponent;
|
||||
let fixture: ComponentFixture<BusinessDateTabComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BusinessDateTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BusinessDateTabComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,141 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-business-date-tab',
|
||||
templateUrl: './business-date-tab.component.html',
|
||||
styleUrls: ['./business-date-tab.component.scss']
|
||||
})
|
||||
export class BusinessDateTabComponent implements OnInit {
|
||||
|
||||
configurationName = 'enable_business_date';
|
||||
businessDateType = 'BUSINESS_DATE';
|
||||
cobDateType = 'COB_DATE';
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date(2100, 0, 1);
|
||||
/** Business date */
|
||||
businessDate = new Date();
|
||||
/** COB date */
|
||||
cobDate = new Date();
|
||||
/** business Date form. */
|
||||
businessDateForm: FormGroup;
|
||||
/** Configuration data. */
|
||||
configurations: any;
|
||||
/** Business data. */
|
||||
businessDateData: any;
|
||||
|
||||
dateIndex = 0;
|
||||
userDateFormat: '';
|
||||
isBusinessDateEnabled = false;
|
||||
isEditInProgress = false;
|
||||
|
||||
/**
|
||||
* Retrieves the configurations data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {SystemService} systemService System Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private dateUtils: Dates) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.userDateFormat = this.settingsService.dateFormat;
|
||||
this.getConfigurations();
|
||||
this.createBusinessDateForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Configuration and the Business Date data
|
||||
*/
|
||||
getConfigurations(): void {
|
||||
this.systemService.getConfigurations()
|
||||
.subscribe((configurationData: any) => {
|
||||
this.configurations = configurationData.globalConfiguration;
|
||||
this.validateBusinessDateStatus();
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.systemService.getBusinessDates()
|
||||
.subscribe((businessDateData: any) => {
|
||||
this.businessDateData = businessDateData;
|
||||
this.setBusinessDates();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Business Date and COB Date.
|
||||
*/
|
||||
setBusinessDates() {
|
||||
this.businessDateData.forEach((data: any) => {
|
||||
if (data.type === this.businessDateType) {
|
||||
this.businessDate = new Date(data.date);
|
||||
} else {
|
||||
this.cobDate = new Date(data.date);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Business Date form.
|
||||
*/
|
||||
createBusinessDateForm(): void {
|
||||
this.businessDateForm = this.formBuilder.group({
|
||||
'businessDate': [new Date(), Validators.required],
|
||||
'cobDate': [new Date(), Validators.required],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate If the enable_business_date configuration is enabled or disabled.
|
||||
*/
|
||||
validateBusinessDateStatus(): void {
|
||||
this.isBusinessDateEnabled = false;
|
||||
this.configurations.forEach((config: any) => {
|
||||
if (config.name === this.configurationName) {
|
||||
this.isBusinessDateEnabled = config.enabled;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag to display or not the datepicker control to set the Business Date value
|
||||
*/
|
||||
editInProgressToggle(index: any): void {
|
||||
this.dateIndex = index;
|
||||
this.isEditInProgress = !this.isEditInProgress;
|
||||
}
|
||||
|
||||
submit() {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevBusinessDate: Date = this.businessDateForm.value.businessDate;
|
||||
let dateType = this.businessDateType;
|
||||
if (this.dateIndex === 1) {
|
||||
dateType = this.cobDateType;
|
||||
}
|
||||
const data = {
|
||||
date: this.dateUtils.formatDate(prevBusinessDate, dateFormat),
|
||||
type: dateType,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.systemService.updateBusinessDate(data).subscribe((response: any) => {
|
||||
this.getConfigurations();
|
||||
this.editInProgressToggle(this.dateIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<mat-card class="configurations-card">
|
||||
<mat-card-content>
|
||||
<mat-tab-group #tabGroup mat-align-tabs="center">
|
||||
<mat-tab label="Global Configurations">
|
||||
<mifosx-global-configurations-tab></mifosx-global-configurations-tab>
|
||||
</mat-tab>
|
||||
<mat-tab label="Business Date">
|
||||
<mifosx-business-date-tab></mifosx-business-date-tab>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,27 @@
|
||||
.configurations-card {
|
||||
margin: 0 auto;
|
||||
max-width: 80rem;
|
||||
width: 90%;
|
||||
padding: 0;
|
||||
padding-bottom: 50px;
|
||||
min-height: 500px;
|
||||
.header {
|
||||
padding: 1%;
|
||||
.header-title-group {
|
||||
.client-card-title {
|
||||
margin-top: 1.4rem;
|
||||
color: white;
|
||||
width: 90%;
|
||||
p {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigation-tabs {
|
||||
overflow: auto;
|
||||
}
|
||||
i:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConfigurationsComponent } from './configurations.component';
|
||||
|
||||
describe('ConfigurationsComponent', () => {
|
||||
let component: ConfigurationsComponent;
|
||||
let fixture: ComponentFixture<ConfigurationsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ConfigurationsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ConfigurationsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-configurations',
|
||||
templateUrl: './configurations.component.html',
|
||||
styleUrls: ['./configurations.component.scss']
|
||||
})
|
||||
export class ConfigurationsComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
<div class="container">
|
||||
<div class="container space">
|
||||
|
||||
<mat-card>
|
||||
|
||||
@@ -27,11 +27,12 @@
|
||||
|
||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||
<button type="button" mat-raised-button [routerLink]="['../../']"> Cancel </button>
|
||||
<button mat-raised-button color="primary" [disabled]="configurationForm.pristine || !configurationForm.valid"> Submit </button>
|
||||
<button mat-raised-button color="primary" [disabled]="configurationForm.pristine || !configurationForm.valid">
|
||||
Submit </button>
|
||||
</mat-card-actions>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</mat-card>
|
||||
|
||||
|
||||
</div>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
|
||||
.space {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
import { SystemService } from '../../../system.service';
|
||||
|
||||
/**
|
||||
* Edit Configuration Component
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
|
||||
/**
|
||||
* Configurations data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class GlobalConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const configurationId = route.paramMap.get('id');
|
||||
return this.systemService.getConfiguration(configurationId);
|
||||
}
|
||||
|
||||
}
|
||||
+6
-15
@@ -21,9 +21,12 @@
|
||||
<ng-container matColumnDef="enabled">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||
<td mat-cell *matCellDef="let configuration">
|
||||
<div [className]="configuration.enabled ? 'enabled' : 'disabled'">
|
||||
<fa-icon icon="circle" size="lg" matTooltip="{{ configuration.enabled ? 'Enabled' : 'Disabled' }}" matTooltipPosition="right"></fa-icon>
|
||||
</div>
|
||||
<mat-slide-toggle [(ngModel)]="configuration.enabled" name="{{configuration.name}}" (click)="toggleStatus(configuration)">
|
||||
<div [className]="configuration.enabled ? 'enabled' : 'disabled'">
|
||||
<span *ngIf="configuration.enabled">Enabled</span>
|
||||
<span *ngIf="!configuration.enabled">Disabled</span>
|
||||
</div>
|
||||
</mat-slide-toggle>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
@@ -32,18 +35,6 @@
|
||||
<td mat-cell *matCellDef="let configuration"> {{ configuration.value }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="action">
|
||||
<th mat-header-cell *matHeaderCellDef> Action </th>
|
||||
<td mat-cell *matCellDef="let configuration">
|
||||
<button mat-button *ngIf="!configuration.enabled" color="accent" (click)="toggleStatus(configuration)">
|
||||
<fa-icon icon="lock-open"></fa-icon> Enable
|
||||
</button>
|
||||
<button mat-button *ngIf="configuration.enabled" color="warn" (click)="toggleStatus(configuration)">
|
||||
<fa-icon icon="lock"></fa-icon> Disable
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef> Edit </th>
|
||||
<td mat-cell *matCellDef="let configuration">
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GlobalConfigurationsTabComponent } from './global-configurations-tab.component';
|
||||
|
||||
describe('GlobalConfigurationsTabComponent', () => {
|
||||
let component: GlobalConfigurationsTabComponent;
|
||||
let fixture: ComponentFixture<GlobalConfigurationsTabComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GlobalConfigurationsTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GlobalConfigurationsTabComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+17
-20
@@ -6,22 +6,19 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../system.service';
|
||||
import { SystemService } from '../../system.service';
|
||||
|
||||
/**
|
||||
* Global Configurations Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-global-configurations',
|
||||
templateUrl: './global-configurations.component.html',
|
||||
styleUrls: ['./global-configurations.component.scss']
|
||||
selector: 'mifosx-global-configurations-tab',
|
||||
templateUrl: './global-configurations-tab.component.html',
|
||||
styleUrls: ['./global-configurations-tab.component.scss']
|
||||
})
|
||||
export class GlobalConfigurationsComponent implements OnInit {
|
||||
export class GlobalConfigurationsTabComponent implements OnInit {
|
||||
|
||||
/** Configuration data. */
|
||||
configurationData: any;
|
||||
/** Columns to be displayed in configurations table. */
|
||||
displayedColumns: string[] = ['name', 'enabled', 'value', 'action', 'edit'];
|
||||
displayedColumns: string[] = ['name', 'enabled', 'value', 'edit'];
|
||||
/** Data source for configurations table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -37,27 +34,28 @@ export class GlobalConfigurationsComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { configurations: any }) => {
|
||||
this.configurationData = data.configurations.globalConfiguration;
|
||||
});
|
||||
private systemService: SystemService) {
|
||||
this.configurationData = this.systemService.getConfigurations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configurations table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.setConfigurations();
|
||||
this.setConfigurationData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for configurations table.
|
||||
*/
|
||||
setConfigurations() {
|
||||
this.dataSource = new MatTableDataSource(this.configurationData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
setConfigurationData(): void {
|
||||
this.systemService.getConfigurations()
|
||||
.subscribe((configurationData: any) => {
|
||||
this.configurationData = configurationData.globalConfiguration;
|
||||
this.dataSource = new MatTableDataSource(this.configurationData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,5 +75,4 @@ export class GlobalConfigurationsComponent implements OnInit {
|
||||
configuration.enabled = response.changes.enabled;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../system.service';
|
||||
import { SystemService } from '../../system.service';
|
||||
|
||||
/**
|
||||
* Configurations data resolver.
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../system.service';
|
||||
|
||||
/**
|
||||
* Global Configuration data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class GlobalConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const configurationId = route.paramMap.get('id');
|
||||
return this.systemService.getConfiguration(configurationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GlobalConfigurationsComponent } from './global-configurations.component';
|
||||
|
||||
describe('GlobalConfigurationsComponent', () => {
|
||||
let component: GlobalConfigurationsComponent;
|
||||
let fixture: ComponentFixture<GlobalConfigurationsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GlobalConfigurationsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GlobalConfigurationsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -26,8 +26,6 @@ import { ManageSurveysComponent } from './manage-surveys/manage-surveys.componen
|
||||
import { CreateSurveyComponent } from './manage-surveys/create-survey/create-survey.component';
|
||||
import { ViewSurveyComponent } from './manage-surveys/view-survey/view-survey.component';
|
||||
import { ManageSchedulerJobsComponent } from './manage-scheduler-jobs/manage-scheduler-jobs.component';
|
||||
import { GlobalConfigurationsComponent } from './global-configurations/global-configurations.component';
|
||||
import { EditConfigurationComponent } from './global-configurations/edit-configuration/edit-configuration.component';
|
||||
import { AmazonS3Component } from './external-services/amazon-s3/amazon-s3.component';
|
||||
import { EmailComponent } from './external-services/email/email.component';
|
||||
import { SMSComponent } from './external-services/sms/sms.component';
|
||||
@@ -62,8 +60,7 @@ import { HooksTemplateResolver } from './manage-hooks/hooks-template.resolver';
|
||||
import { RolesAndPermissionsResolver } from './roles-and-permissions/roles-and-permissions.resolver';
|
||||
import { ManageSurveysResolver } from './manage-surveys/manage-surveys.resolver';
|
||||
import { ManageSchedulerJobsResolver } from './manage-scheduler-jobs/manage-scheduler-jobs.resolver';
|
||||
import { GlobalConfigurationsResolver } from './global-configurations/global-configurations.resolver';
|
||||
import { GlobalConfigurationResolver } from './global-configurations/global-configuration.resolver';
|
||||
import { GlobalConfigurationsResolver } from './configurations/global-configurations-tab/global-configurations.resolver';
|
||||
import { AmazonS3ConfigurationResolver } from './external-services/amazon-s3/amazon-s3.resolver';
|
||||
import { EmailConfigurationResolver } from './external-services/email/email.resolver';
|
||||
import { SMSConfigurationResolver } from './external-services/sms/sms.resolver';
|
||||
@@ -87,6 +84,8 @@ import { ConfigureMakerCheckerTasksComponent } from './configure-maker-checker-t
|
||||
import { MakerCheckerTasksResolver } from './configure-maker-checker-tasks/configure-maker-checker-tasks.resolver';
|
||||
import { ViewHistorySchedulerJobComponent } from './manage-scheduler-jobs/view-history-scheduler-job/view-history-scheduler-job.component';
|
||||
import { ViewHistorySchedulerJobsResolver } from './manage-scheduler-jobs/view-history-scheduler-job/view-history-scheduler-job.resolver';
|
||||
import { ConfigurationsComponent } from './configurations/configurations.component';
|
||||
import { GlobalConfigurationResolver } from './configurations/global-configurations-tab/global-configuration.resolver';
|
||||
|
||||
const routes: Routes = [
|
||||
Route.withShell([
|
||||
@@ -94,25 +93,25 @@ const routes: Routes = [
|
||||
path: 'system',
|
||||
data: { title: extract('System'), breadcrumb: 'System' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: SystemComponent
|
||||
},
|
||||
{
|
||||
path: 'codes',
|
||||
data: { title: extract('View Codes'), breadcrumb: 'Codes' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: CodesComponent,
|
||||
resolve: {
|
||||
codes: CodesResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
component: CreateCodeComponent,
|
||||
data: { title: extract('Create Code'), breadcrumb: 'Create' }
|
||||
{
|
||||
path: '',
|
||||
component: SystemComponent
|
||||
},
|
||||
{
|
||||
path: 'codes',
|
||||
data: { title: extract('View Codes'), breadcrumb: 'Codes' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: CodesComponent,
|
||||
resolve: {
|
||||
codes: CodesResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
component: CreateCodeComponent,
|
||||
data: { title: extract('Create Code'), breadcrumb: 'Create' }
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
@@ -135,19 +134,19 @@ const routes: Routes = [
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
|
||||
},
|
||||
{
|
||||
path: 'entity-to-entity-mapping',
|
||||
component: EntityToEntityMappingComponent,
|
||||
data: { title: extract('Entity to Entity Mapping'), breadcrumb: 'Entity to Entity Mapping' },
|
||||
resolve: {
|
||||
entityMappings: EntityToEntityMappingResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
path: 'entity-to-entity-mapping',
|
||||
component: EntityToEntityMappingComponent,
|
||||
data: { title: extract('Entity to Entity Mapping'), breadcrumb: 'Entity to Entity Mapping' },
|
||||
resolve: {
|
||||
entityMappings: EntityToEntityMappingResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'external-services',
|
||||
data: { title: extract('External Services'), breadcrumb: 'External Services' },
|
||||
children: [
|
||||
@@ -169,7 +168,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: 'edit',
|
||||
component: EditAmazonS3Component,
|
||||
data: {title: extract('Edit Amazon S3 Configuration'), breadcrumb: 'Edit'},
|
||||
data: { title: extract('Edit Amazon S3 Configuration'), breadcrumb: 'Edit' },
|
||||
resolve: {
|
||||
amazonS3Configuration: AmazonS3ConfigurationResolver
|
||||
}
|
||||
@@ -243,7 +242,7 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'data-tables',
|
||||
data: { title: extract('Manage Data Tables'), breadcrumb: 'Manage Data Tables' },
|
||||
data: { title: extract('Manage Data Tables'), breadcrumb: 'Manage Data Tables' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -255,14 +254,14 @@ const routes: Routes = [
|
||||
{
|
||||
path: 'create',
|
||||
component: CreateDataTableComponent,
|
||||
data: { title: extract('Create Data Table'), breadcrumb: 'Create'},
|
||||
data: { title: extract('Create Data Table'), breadcrumb: 'Create' },
|
||||
resolve: {
|
||||
columnCodes: CodesResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':datatableName',
|
||||
data: { title: extract('View Data Table'), routeParamBreadcrumb: 'datatableName'},
|
||||
data: { title: extract('View Data Table'), routeParamBreadcrumb: 'datatableName' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -274,7 +273,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: 'edit',
|
||||
component: EditDataTableComponent,
|
||||
data: { title: extract('Edit Data table'), breadcrumb: 'Edit', routeParamBreadcrumb: false},
|
||||
data: { title: extract('Edit Data table'), breadcrumb: 'Edit', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
dataTable: DataTableResolver,
|
||||
columnCodes: CodesResolver
|
||||
@@ -283,10 +282,10 @@ const routes: Routes = [
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
path: 'hooks',
|
||||
data: { title: extract('Manage Hooks'), breadcrumb: 'Manage Hooks' },
|
||||
data: { title: extract('Manage Hooks'), breadcrumb: 'Manage Hooks' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -326,10 +325,10 @@ const routes: Routes = [
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
path: 'roles-and-permissions',
|
||||
data: { title: extract('Roles and Permissions'), breadcrumb: 'Roles and Permissions' },
|
||||
data: { title: extract('Roles and Permissions'), breadcrumb: 'Roles and Permissions' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -355,117 +354,101 @@ const routes: Routes = [
|
||||
roledetails: ViewRoleResolver,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'edit',
|
||||
component: EditRoleComponent,
|
||||
data: { title: extract('Edit Role'), breadcrumb: 'Edit', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
role: ViewRoleResolver,
|
||||
{
|
||||
path: 'edit',
|
||||
component: EditRoleComponent,
|
||||
data: { title: extract('Edit Role'), breadcrumb: 'Edit', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
role: ViewRoleResolver,
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'configure-mc-tasks',
|
||||
data: { title: extract('Configure Maker Checker Tasks'), breadcrumb: 'Configure Maker Checker Tasks' },
|
||||
component: ConfigureMakerCheckerTasksComponent,
|
||||
resolve: {
|
||||
permissions: MakerCheckerTasksResolver
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'configure-mc-tasks',
|
||||
data: { title: extract('Configure Maker Checker Tasks'), breadcrumb: 'Configure Maker Checker Tasks' },
|
||||
component: ConfigureMakerCheckerTasksComponent,
|
||||
resolve: {
|
||||
permissions: MakerCheckerTasksResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'surveys',
|
||||
data: { title: extract('Manage Surveys'), breadcrumb: 'Manage Surveys' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ManageSurveysComponent,
|
||||
resolve: {
|
||||
surveys: ManageSurveysResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
component: CreateSurveyComponent,
|
||||
data: { title: extract('Create Survey'), breadcrumb: 'Create' },
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
data: {title: extract('View Survey'), routeParamBreadcrumb: 'id'},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ViewSurveyComponent,
|
||||
resolve: {
|
||||
survey: SurveyResolver
|
||||
}
|
||||
{
|
||||
path: 'surveys',
|
||||
data: { title: extract('Manage Surveys'), breadcrumb: 'Manage Surveys' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ManageSurveysComponent,
|
||||
resolve: {
|
||||
surveys: ManageSurveysResolver
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'scheduler-jobs',
|
||||
data: { title: extract('Manage Scheduler Jobs'), breadcrumb: 'Manage Scheduler Jobs' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ManageSchedulerJobsComponent,
|
||||
resolve: {},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
data: { title: extract('View Scheduler Job'), routeParamBreadcrumb: 'id' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ViewSchedulerJobComponent,
|
||||
resolve: {
|
||||
selectedJob: ViewSchedulerJobResolver
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
component: CreateSurveyComponent,
|
||||
data: { title: extract('Create Survey'), breadcrumb: 'Create' },
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
data: { title: extract('View Survey'), routeParamBreadcrumb: 'id' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ViewSurveyComponent,
|
||||
resolve: {
|
||||
survey: SurveyResolver
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'edit',
|
||||
component: EditSchedulerJobComponent,
|
||||
data: { title: extract('Edit Scheduler Job'), routeParamBreadcrumb: false, breadcrumb: 'Edit' },
|
||||
resolve: {
|
||||
jobSelected: ManageSchedulerJobResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'viewhistory',
|
||||
component: ViewHistorySchedulerJobComponent,
|
||||
data: { title: extract('Scheduler Job History'), breadcrumb: 'View History' },
|
||||
resolve: {
|
||||
jobsSchedulerHistory: ViewHistorySchedulerJobsResolver
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'scheduler-jobs',
|
||||
data: { title: extract('Manage Scheduler Jobs'), breadcrumb: 'Manage Scheduler Jobs' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ManageSchedulerJobsComponent,
|
||||
resolve: {},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
data: { title: extract('View Scheduler Job'), routeParamBreadcrumb: 'id' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: ViewSchedulerJobComponent,
|
||||
resolve: {
|
||||
selectedJob: ViewSchedulerJobResolver
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'global-configurations',
|
||||
data: { title: extract('Global Configurations'), breadcrumb: 'Global Configurations' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: GlobalConfigurationsComponent,
|
||||
resolve: {
|
||||
configurations: GlobalConfigurationsResolver
|
||||
{
|
||||
path: 'edit',
|
||||
component: EditSchedulerJobComponent,
|
||||
data: { title: extract('Edit Scheduler Job'), routeParamBreadcrumb: false, breadcrumb: 'Edit' },
|
||||
resolve: {
|
||||
jobSelected: ManageSchedulerJobResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'viewhistory',
|
||||
component: ViewHistorySchedulerJobComponent,
|
||||
data: { title: extract('Scheduler Job History'), breadcrumb: 'View History' },
|
||||
resolve: {
|
||||
jobsSchedulerHistory: ViewHistorySchedulerJobsResolver
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: EditConfigurationComponent,
|
||||
data: { title: extract('Edit Configuration'), breadcrumb: 'Edit' },
|
||||
resolve: {
|
||||
configuration: GlobalConfigurationResolver
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'configurations',
|
||||
component: ConfigurationsComponent,
|
||||
data: { title: extract('Configurations'), breadcrumb: 'Configurations' }
|
||||
},
|
||||
{
|
||||
path: 'account-number-preferences',
|
||||
@@ -565,12 +548,12 @@ const routes: Routes = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ViewAuditComponent,
|
||||
data: { title: extract('View Audit'), routeParamBreadcrumb: 'id' },
|
||||
resolve: {
|
||||
auditTrail: AuditTrailResolver
|
||||
}
|
||||
path: ':id',
|
||||
component: ViewAuditComponent,
|
||||
data: { title: extract('View Audit'), routeParamBreadcrumb: 'id' },
|
||||
resolve: {
|
||||
auditTrail: AuditTrailResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -96,12 +96,12 @@
|
||||
<p matLine>Schedule a job, modify or delete jobs</p>
|
||||
</mat-list-item>
|
||||
|
||||
<mat-list-item [routerLink]="['global-configurations']">
|
||||
<mat-list-item [routerLink]="['configurations']">
|
||||
<mat-icon matListIcon>
|
||||
<fa-icon icon="cogs" size="sm"></fa-icon>
|
||||
</mat-icon>
|
||||
<h4 matLine>Configurations</h4>
|
||||
<p matLine>Global configurations and Cache settings</p>
|
||||
<p matLine>Global configurations, Cache and Business Date settings</p>
|
||||
</mat-list-item>
|
||||
|
||||
<mat-list-item [routerLink]="['account-number-preferences']">
|
||||
|
||||
@@ -23,8 +23,7 @@ import { ManageSurveysComponent } from './manage-surveys/manage-surveys.componen
|
||||
import { ViewSurveyComponent } from './manage-surveys/view-survey/view-survey.component';
|
||||
import { CreateSurveyComponent } from './manage-surveys/create-survey/create-survey.component';
|
||||
import { ManageSchedulerJobsComponent } from './manage-scheduler-jobs/manage-scheduler-jobs.component';
|
||||
import { GlobalConfigurationsComponent } from './global-configurations/global-configurations.component';
|
||||
import { EditConfigurationComponent } from './global-configurations/edit-configuration/edit-configuration.component';
|
||||
import { EditConfigurationComponent } from './configurations/global-configurations-tab/edit-configuration/edit-configuration.component';
|
||||
import { AmazonS3Component } from './external-services/amazon-s3/amazon-s3.component';
|
||||
import { EmailComponent } from './external-services/email/email.component';
|
||||
import { SMSComponent } from './external-services/sms/sms.component';
|
||||
@@ -60,6 +59,9 @@ import { AddEventDialogComponent } from './manage-hooks/add-event-dialog/add-eve
|
||||
import { ViewSchedulerJobComponent } from './manage-scheduler-jobs/view-scheduler-job/view-scheduler-job.component';
|
||||
import { EditSchedulerJobComponent } from './manage-scheduler-jobs/edit-scheduler-job/edit-scheduler-job.component';
|
||||
import { ConfigureMakerCheckerTasksComponent } from './configure-maker-checker-tasks/configure-maker-checker-tasks.component';
|
||||
import { BusinessDateTabComponent } from './configurations/business-date-tab/business-date-tab.component';
|
||||
import { ConfigurationsComponent } from './configurations/configurations.component';
|
||||
import { GlobalConfigurationsTabComponent } from './configurations/global-configurations-tab/global-configurations-tab.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -83,7 +85,6 @@ import { ConfigureMakerCheckerTasksComponent } from './configure-maker-checker-t
|
||||
RolesAndPermissionsComponent,
|
||||
ManageSurveysComponent,
|
||||
ManageSchedulerJobsComponent,
|
||||
GlobalConfigurationsComponent,
|
||||
EditConfigurationComponent,
|
||||
AmazonS3Component,
|
||||
EmailComponent,
|
||||
@@ -119,7 +120,10 @@ import { ConfigureMakerCheckerTasksComponent } from './configure-maker-checker-t
|
||||
CreateSurveyComponent,
|
||||
EditSchedulerJobComponent,
|
||||
ViewHistorySchedulerJobComponent,
|
||||
ViewSurveyComponent
|
||||
ViewSurveyComponent,
|
||||
BusinessDateTabComponent,
|
||||
ConfigurationsComponent,
|
||||
GlobalConfigurationsTabComponent
|
||||
],
|
||||
})
|
||||
export class SystemModule { }
|
||||
|
||||
@@ -328,6 +328,21 @@ export class SystemService {
|
||||
return this.http.put(`/datatables/${dataTableName}`, dataTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Business Date data.
|
||||
*/
|
||||
getBusinessDates(): Observable<any> {
|
||||
return this.http.get('/businessdate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} dateData Business Date data to be updated.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
updateBusinessDate(dateData: any): Observable<any> {
|
||||
return this.http.post(`/businessdate`, dateData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Configurations data.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user