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">
|
<ng-container matColumnDef="debit">
|
||||||
<th mat-header-cell class="center" *matHeaderCellDef mat-sort-header> Debit </th>
|
<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>
|
||||||
|
|
||||||
<ng-container matColumnDef="credit">
|
<ng-container matColumnDef="credit">
|
||||||
<th mat-header-cell class="center" *matHeaderCellDef mat-sort-header> Credit </th>
|
<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>
|
</ng-container>
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
|||||||
+19
-5
@@ -14,11 +14,25 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Configuration Value</mat-label>
|
<mat-label>Description</mat-label>
|
||||||
<input matInput required type="number" formControlName="value">
|
<textarea matInput formControlName="description" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
|
||||||
<mat-error *ngIf="configurationForm.controls.value.hasError('required')">
|
</mat-form-field>
|
||||||
Configuration Value is <strong>required</strong>
|
|
||||||
</mat-error>
|
<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>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+30
-6
@@ -2,6 +2,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { SystemService } from '../../../system.service';
|
import { SystemService } from '../../../system.service';
|
||||||
@@ -16,6 +17,11 @@ import { SystemService } from '../../../system.service';
|
|||||||
})
|
})
|
||||||
export class EditConfigurationComponent implements OnInit {
|
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. */
|
/** Global Configuration form. */
|
||||||
configurationForm: FormGroup;
|
configurationForm: FormGroup;
|
||||||
/** Configuration. */
|
/** Configuration. */
|
||||||
@@ -25,11 +31,13 @@ export class EditConfigurationComponent implements OnInit {
|
|||||||
* Retrieves the configuration data from `resolve`.
|
* Retrieves the configuration data from `resolve`.
|
||||||
* @param {FormBuilder} formBuilder Form Builder.
|
* @param {FormBuilder} formBuilder Form Builder.
|
||||||
* @param {SystemService} systemService System Service.
|
* @param {SystemService} systemService System Service.
|
||||||
|
* @param {SettingsService} settingsService Setting Service.
|
||||||
* @param {ActivatedRoute} route Activated Route.
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
* @param {Router} router Router for navigation.
|
* @param {Router} router Router for navigation.
|
||||||
*/
|
*/
|
||||||
constructor(private formBuilder: FormBuilder,
|
constructor(private formBuilder: FormBuilder,
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
|
private settingsService: SettingsService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router) {
|
private router: Router) {
|
||||||
this.route.data.subscribe((data: { configuration: any }) => {
|
this.route.data.subscribe((data: { configuration: any }) => {
|
||||||
@@ -41,6 +49,7 @@ export class EditConfigurationComponent implements OnInit {
|
|||||||
* Creates and sets the configuration form.
|
* Creates and sets the configuration form.
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.maxDate = this.settingsService.businessDate;
|
||||||
this.createConfigurationForm();
|
this.createConfigurationForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +59,10 @@ export class EditConfigurationComponent implements OnInit {
|
|||||||
createConfigurationForm() {
|
createConfigurationForm() {
|
||||||
this.configurationForm = this.formBuilder.group({
|
this.configurationForm = this.formBuilder.group({
|
||||||
'name': [{ value: this.configuration.name, disabled: true }, Validators.required],
|
'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.
|
* if successful redirects to view all global configurations.
|
||||||
*/
|
*/
|
||||||
submit() {
|
submit() {
|
||||||
this.systemService
|
if (this.configurationForm.value.value != null || this.configurationForm.value.stringValue != null || this.configurationForm.value.dateValue != null) {
|
||||||
.updateConfiguration(this.configuration.id, this.configurationForm.value)
|
const payload = {
|
||||||
.subscribe((response: any) => {
|
...this.configurationForm.value
|
||||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
};
|
||||||
});
|
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>
|
<td mat-cell *matCellDef="let configuration"> {{ configuration.value }}</td>
|
||||||
</ng-container>
|
</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">
|
<ng-container matColumnDef="edit">
|
||||||
<th mat-header-cell *matHeaderCellDef> Edit </th>
|
<th mat-header-cell *matHeaderCellDef> Edit </th>
|
||||||
<td mat-cell *matCellDef="let configuration">
|
<td mat-cell *matCellDef="let configuration">
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
|||||||
/** Configuration data. */
|
/** Configuration data. */
|
||||||
configurationData: any;
|
configurationData: any;
|
||||||
/** Columns to be displayed in configurations table. */
|
/** 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. */
|
/** Data source for configurations table. */
|
||||||
dataSource: MatTableDataSource<any>;
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { SystemService } from 'app/system/system.service';
|
|||||||
})
|
})
|
||||||
export class CobWorkflowComponent implements OnInit, OnDestroy {
|
export class CobWorkflowComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
waitTime: number = 30000;
|
waitTime = 30000;
|
||||||
|
|
||||||
isCatchUpRunning = false;
|
isCatchUpRunning = false;
|
||||||
/** Timer to refetch COB Catch-Up status every 5 seconds */
|
/** Timer to refetch COB Catch-Up status every 5 seconds */
|
||||||
@@ -27,6 +27,9 @@ export class CobWorkflowComponent implements OnInit, OnDestroy {
|
|||||||
getCOBCatchUpStatus(): void {
|
getCOBCatchUpStatus(): void {
|
||||||
this.systemService.getCOBCatchUpStatus().subscribe((response: any) => {
|
this.systemService.getCOBCatchUpStatus().subscribe((response: any) => {
|
||||||
this.isCatchUpRunning = response.isCatchUpRunning;
|
this.isCatchUpRunning = response.isCatchUpRunning;
|
||||||
|
if (!this.isCatchUpRunning) {
|
||||||
|
this.waitTime = 30000;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.timer = setTimeout(() => { this.getCOBCatchUpStatus(); }, this.waitTime);
|
this.timer = setTimeout(() => { this.getCOBCatchUpStatus(); }, this.waitTime);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user