Enable extra field for Global Configurations (#1693)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
f6ed3c1914
commit
180264e5f4
@@ -81,12 +81,12 @@
|
||||
|
||||
<ng-container matColumnDef="debit">
|
||||
<th mat-header-cell class="center" *matHeaderCellDef mat-sort-header> Debit </th>
|
||||
<td mat-cell class="r-amount" *matCellDef="let transaction"><span *ngIf="transaction.entryType.value === 'DEBIT'"> {{ (transaction.currency.displaySymbol || transaction.currency.code) }} {{ transaction.amount | number }} </span></td>
|
||||
<td mat-cell *matCellDef="let transaction"><span *ngIf="transaction.entryType.value === 'DEBIT'"> {{ (transaction.currency.displaySymbol || transaction.currency.code) }} {{ transaction.amount | number }} </span></td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="credit">
|
||||
<th mat-header-cell class="center" *matHeaderCellDef mat-sort-header> Credit </th>
|
||||
<td mat-cell class="r-amount" *matCellDef="let transaction"><span *ngIf="transaction.entryType.value === 'CREDIT'"> {{ (transaction.currency.displaySymbol || transaction.currency.code) }} {{ transaction.amount | number }} </span></td>
|
||||
<td mat-cell *matCellDef="let transaction"><span *ngIf="transaction.entryType.value === 'CREDIT'"> {{ (transaction.currency.displaySymbol || transaction.currency.code) }} {{ transaction.amount | number }} </span></td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
|
||||
+19
-5
@@ -14,11 +14,25 @@
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Configuration Value</mat-label>
|
||||
<input matInput required type="number" formControlName="value">
|
||||
<mat-error *ngIf="configurationForm.controls.value.hasError('required')">
|
||||
Configuration Value is <strong>required</strong>
|
||||
</mat-error>
|
||||
<mat-label>Description</mat-label>
|
||||
<textarea matInput formControlName="description" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Number Value</mat-label>
|
||||
<input matInput type="number" formControlName="value">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>String Value</mat-label>
|
||||
<input matInput formControlName="stringValue">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%" (click)="configurationDatePicker.open()">
|
||||
<mat-label>Date Value</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="configurationDatePicker" formControlName="dateValue">
|
||||
<mat-datepicker-toggle matSuffix [for]="configurationDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #configurationDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
+30
-6
@@ -2,6 +2,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../../system.service';
|
||||
@@ -16,6 +17,11 @@ import { SystemService } from '../../../system.service';
|
||||
})
|
||||
export class EditConfigurationComponent implements OnInit {
|
||||
|
||||
/** Minimum transaction date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum transaction date allowed. */
|
||||
maxDate = new Date();
|
||||
|
||||
/** Global Configuration form. */
|
||||
configurationForm: FormGroup;
|
||||
/** Configuration. */
|
||||
@@ -25,11 +31,13 @@ export class EditConfigurationComponent implements OnInit {
|
||||
* Retrieves the configuration data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {SystemService} systemService System Service.
|
||||
* @param {SettingsService} settingsService Setting Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { configuration: any }) => {
|
||||
@@ -41,6 +49,7 @@ export class EditConfigurationComponent implements OnInit {
|
||||
* Creates and sets the configuration form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.createConfigurationForm();
|
||||
}
|
||||
|
||||
@@ -50,7 +59,10 @@ export class EditConfigurationComponent implements OnInit {
|
||||
createConfigurationForm() {
|
||||
this.configurationForm = this.formBuilder.group({
|
||||
'name': [{ value: this.configuration.name, disabled: true }, Validators.required],
|
||||
'value': [this.configuration.value, Validators.required]
|
||||
'description': [{ value: this.configuration.description, disabled: true }],
|
||||
'value': [this.configuration.value],
|
||||
'stringValue': [this.configuration.stringValue],
|
||||
'dateValue': [this.configuration.dateValue]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,11 +71,23 @@ export class EditConfigurationComponent implements OnInit {
|
||||
* if successful redirects to view all global configurations.
|
||||
*/
|
||||
submit() {
|
||||
this.systemService
|
||||
.updateConfiguration(this.configuration.id, this.configurationForm.value)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
if (this.configurationForm.value.value != null || this.configurationForm.value.stringValue != null || this.configurationForm.value.dateValue != null) {
|
||||
const payload = {
|
||||
...this.configurationForm.value
|
||||
};
|
||||
if (this.configurationForm.value.dateValue != null) {
|
||||
payload.locale = this.settingsService.language.code;
|
||||
payload.dateFormat = this.settingsService.dateFormat;
|
||||
} else {
|
||||
delete payload.dateValue;
|
||||
}
|
||||
|
||||
this.systemService
|
||||
.updateConfiguration(this.configuration.id, payload)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -35,6 +35,16 @@
|
||||
<td mat-cell *matCellDef="let configuration"> {{ configuration.value }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="stringValue">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> String Value </th>
|
||||
<td mat-cell *matCellDef="let configuration"> {{ configuration.stringValue }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="dateValue">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Date Value </th>
|
||||
<td mat-cell *matCellDef="let configuration"> {{ configuration.dateValue | dateFormat }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef> Edit </th>
|
||||
<td mat-cell *matCellDef="let configuration">
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
/** Configuration data. */
|
||||
configurationData: any;
|
||||
/** Columns to be displayed in configurations table. */
|
||||
displayedColumns: string[] = ['name', 'enabled', 'value', 'edit'];
|
||||
displayedColumns: string[] = ['name', 'enabled', 'value', 'stringValue', 'dateValue', 'edit'];
|
||||
/** Data source for configurations table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { SystemService } from 'app/system/system.service';
|
||||
})
|
||||
export class CobWorkflowComponent implements OnInit, OnDestroy {
|
||||
|
||||
waitTime: number = 30000;
|
||||
waitTime = 30000;
|
||||
|
||||
isCatchUpRunning = false;
|
||||
/** Timer to refetch COB Catch-Up status every 5 seconds */
|
||||
@@ -27,6 +27,9 @@ export class CobWorkflowComponent implements OnInit, OnDestroy {
|
||||
getCOBCatchUpStatus(): void {
|
||||
this.systemService.getCOBCatchUpStatus().subscribe((response: any) => {
|
||||
this.isCatchUpRunning = response.isCatchUpRunning;
|
||||
if (!this.isCatchUpRunning) {
|
||||
this.waitTime = 30000;
|
||||
}
|
||||
});
|
||||
this.timer = setTimeout(() => { this.getCOBCatchUpStatus(); }, this.waitTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user