Fix to sort loan charges by due date (#1744)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
c09bc5c4bc
commit
1c453d1b2c
@@ -88,6 +88,6 @@
|
|||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" [routerLink]="[row.id]"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" [routerLink]="[row.id]"></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
<mat-paginator [pageSizeOptions]="[50, 100, 200]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { MatSort } from '@angular/material/sort';
|
import { MatSort } from '@angular/material/sort';
|
||||||
import { MatTableDataSource, MatTable } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { LoansService } from 'app/loans/loans.service';
|
import { LoansService } from 'app/loans/loans.service';
|
||||||
@@ -65,6 +65,7 @@ export class ChargesTabComponent implements OnInit {
|
|||||||
this.status = this.loanDetails.status.value;
|
this.status = this.loanDetails.status.value;
|
||||||
let actionFlag;
|
let actionFlag;
|
||||||
this.chargesData.forEach((element: any) => {
|
this.chargesData.forEach((element: any) => {
|
||||||
|
element.dueDate = this.dateUtils.parseDate(element.dueDate);
|
||||||
if (element.paid || element.waived || element.chargeTimeType.value === 'Disbursement' || this.loanDetails.status.value !== 'Active') {
|
if (element.paid || element.waived || element.chargeTimeType.value === 'Disbursement' || this.loanDetails.status.value !== 'Active') {
|
||||||
actionFlag = true;
|
actionFlag = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -72,6 +73,7 @@ export class ChargesTabComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
element.actionFlag = actionFlag;
|
element.actionFlag = actionFlag;
|
||||||
});
|
});
|
||||||
|
this.chargesData = this.chargesData.sort(function(a: any, b: any) { return b.dueDate - a.dueDate; } );
|
||||||
this.dataSource = new MatTableDataSource(this.chargesData);
|
this.dataSource = new MatTableDataSource(this.chargesData);
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
<div class="container m-b-20 space-top" fxLayout="row" fxLayoutGap="20px">
|
<div class="container m-b-20 space-top" fxLayout="row" fxLayoutGap="20px">
|
||||||
<div #schedulerStatus>
|
<div #schedulerStatus>
|
||||||
<h2 class="no-m">Scheduler Status:<span class="m-l-20 m-r-20">{{ schedulerActive ? 'Active' : 'Inactive' }}</span></h2>
|
<h2 class="no-m">Scheduler Status:<span class="m-l-20 m-r-20">{{ schedulerActive ? 'Active' : 'Inactive' }}</span>
|
||||||
</div>
|
</h2>
|
||||||
<button mat-raised-button class="suspend" (click)="suspendScheduler()" *ngIf="schedulerActive">
|
</div>
|
||||||
<fa-icon icon="times-circle" class="m-r-10"></fa-icon>
|
<button mat-raised-button class="suspend" (click)="suspendScheduler()" *ngIf="schedulerActive">
|
||||||
Suspend
|
<fa-icon icon="times-circle" class="m-r-10"></fa-icon>
|
||||||
</button>
|
Suspend
|
||||||
<button mat-raised-button class="activate" (click)="activateScheduler()" *ngIf="!schedulerActive">
|
</button>
|
||||||
<fa-icon icon="times-circle" class="m-r-10"></fa-icon>
|
<button mat-raised-button class="activate" (click)="activateScheduler()" *ngIf="!schedulerActive">
|
||||||
Activate
|
<fa-icon icon="times-circle" class="m-r-10"></fa-icon>
|
||||||
</button>
|
Activate
|
||||||
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -35,13 +36,14 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="select">
|
<ng-container matColumnDef="select">
|
||||||
<th mat-header-cell *matHeaderCellDef>
|
<th mat-header-cell *matHeaderCellDef>
|
||||||
<mat-checkbox class="m-r-10" (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"
|
<mat-checkbox class="m-r-10" (change)="$event ? masterToggle() : null"
|
||||||
|
[checked]="selection.hasValue() && isAllSelected()"
|
||||||
[indeterminate]="selection.hasValue() && !isAllSelected()">
|
[indeterminate]="selection.hasValue() && !isAllSelected()">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</th>
|
</th>
|
||||||
<td mat-cell *matCellDef="let row">
|
<td mat-cell *matCellDef="let row">
|
||||||
<mat-checkbox class="m-r-10" (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null"
|
<mat-checkbox class="m-r-10" *ngIf="!row.currentlyRunning && row.active" (click)="$event.stopPropagation()"
|
||||||
[checked]="selection.isSelected(row)">
|
(change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@@ -51,6 +53,16 @@
|
|||||||
<td mat-cell *matCellDef="let job"> {{ job.displayName }} </td>
|
<td mat-cell *matCellDef="let job"> {{ job.displayName }} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="active">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Active ? </th>
|
||||||
|
<td mat-cell *matCellDef="let job" class="center">
|
||||||
|
<div [className]="job.active === true ? 'currently-running' : 'not-currently-running'">
|
||||||
|
<fa-icon matTooltip="{{ job.active === true ? 'Yes' : 'No' }}" matTooltipPosition="right" icon="circle"
|
||||||
|
size="lg"></fa-icon>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="nextRunTime">
|
<ng-container matColumnDef="nextRunTime">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Next Run </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Next Run </th>
|
||||||
<td mat-cell *matCellDef="let job"> {{ job.nextRunTime }} </td>
|
<td mat-cell *matCellDef="let job"> {{ job.nextRunTime }} </td>
|
||||||
@@ -110,10 +122,10 @@
|
|||||||
<button mat-raised-button color="primary" (click)="runSelectedJobs()">
|
<button mat-raised-button color="primary" (click)="runSelectedJobs()">
|
||||||
<fa-icon icon="play" class="m-r-10"></fa-icon>
|
<fa-icon icon="play" class="m-r-10"></fa-icon>
|
||||||
Run Selected Jobs<ng-template #templateSchedulerJobs let-data let-popover="popover">
|
Run Selected Jobs<ng-template #templateSchedulerJobs let-data let-popover="popover">
|
||||||
<h2>Template</h2>
|
<h2>Template</h2>
|
||||||
<p>This is the template I am trying to use. Is that fine.</p>
|
<p>This is the template I am trying to use. Is that fine.</p>
|
||||||
<button (click)="popover.close();nextStepSchedulerJobs()">Next</button>
|
<button (click)="popover.close();nextStepSchedulerJobs()">Next</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</button>
|
</button>
|
||||||
<button mat-raised-button color="primary" (click)="refresh()">
|
<button mat-raised-button color="primary" (click)="refresh()">
|
||||||
<fa-icon icon="sync" class="m-r-10"></fa-icon>
|
<fa-icon icon="sync" class="m-r-10"></fa-icon>
|
||||||
@@ -124,26 +136,35 @@
|
|||||||
<ng-template #templateSchedulerStatus let-data let-popover="popover">
|
<ng-template #templateSchedulerStatus let-data let-popover="popover">
|
||||||
<h4>Scheduler Status. Button will be used to change the status.</h4>
|
<h4>Scheduler Status. Button will be used to change the status.</h4>
|
||||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
|
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
|
<button mat-raised-button color="warn"
|
||||||
|
(click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
|
||||||
<button mat-raised-button color="primary" (click)="popover.close();previousStep()">Back</button>
|
<button mat-raised-button color="primary" (click)="popover.close();previousStep()">Back</button>
|
||||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateFilter, filter, 'bottom', true)">Next</button>
|
<button mat-raised-button color="primary"
|
||||||
|
(click)="popover.close();showPopover(templateFilter, filter, 'bottom', true)">Next</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #templateFilter let-data let-popover="popover">
|
<ng-template #templateFilter let-data let-popover="popover">
|
||||||
<h4>Search bar to filter jobs.</h4>
|
<h4>Search bar to filter jobs.</h4>
|
||||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
|
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
|
<button mat-raised-button color="warn"
|
||||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateSchedulerStatus,schedulerStatus, 'bottom', true)">Back</button>
|
(click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
|
||||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateJobsTable,jobsTable, 'top', true)">Next</button>
|
<button mat-raised-button color="primary"
|
||||||
|
(click)="popover.close();showPopover(templateSchedulerStatus,schedulerStatus, 'bottom', true)">Back</button>
|
||||||
|
<button mat-raised-button color="primary"
|
||||||
|
(click)="popover.close();showPopover(templateJobsTable,jobsTable, 'top', true)">Next</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #templateJobsTable let-data let-popover="popover">
|
<ng-template #templateJobsTable let-data let-popover="popover">
|
||||||
<h4>List of all scheduled batch jobs <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/67895356/Manage+Scheduler+Jobs" target="_blank">Schedular Jobs</a></h4>
|
<h4>List of all scheduled batch jobs <a
|
||||||
|
href="https://mifosforge.jira.com/wiki/spaces/docs/pages/67895356/Manage+Scheduler+Jobs" target="_blank">Schedular
|
||||||
|
Jobs</a></h4>
|
||||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
|
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
|
<button mat-raised-button color="warn"
|
||||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateFilter, filter, 'bottom', true)">Back</button>
|
(click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
|
||||||
|
<button mat-raised-button color="primary"
|
||||||
|
(click)="popover.close();showPopover(templateFilter, filter, 'bottom', true)">Back</button>
|
||||||
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
|
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { SelectionModel } from '@angular/cdk/collections';
|
|||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
|
||||||
/** rxjs Imports */
|
/** rxjs Imports */
|
||||||
import { of } from 'rxjs';
|
|
||||||
import { SystemService } from '../../system.service';
|
import { SystemService } from '../../system.service';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
@@ -33,7 +32,7 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
/** Scheduler data */
|
/** Scheduler data */
|
||||||
schedulerData: any;
|
schedulerData: any;
|
||||||
/** Columns to be displayed in manage scheduler jobs table. */
|
/** Columns to be displayed in manage scheduler jobs table. */
|
||||||
displayedColumns: string[] = ['select', 'displayName', 'nextRunTime', 'previousRunTime', 'previousRunStatus', 'currentlyRunning', 'errorLog'];
|
displayedColumns: string[] = ['select', 'displayName', 'active', 'nextRunTime', 'previousRunTime', 'previousRunStatus', 'currentlyRunning', 'errorLog'];
|
||||||
/** Data source for manage scheduler jobs table. */
|
/** Data source for manage scheduler jobs table. */
|
||||||
dataSource: MatTableDataSource<any>;
|
dataSource: MatTableDataSource<any>;
|
||||||
/** Initialize Selection */
|
/** Initialize Selection */
|
||||||
@@ -66,11 +65,11 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
* @param {PopoverService} popoverService PopoverService.
|
* @param {PopoverService} popoverService PopoverService.
|
||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private configurationWizardService: ConfigurationWizardService,
|
private configurationWizardService: ConfigurationWizardService,
|
||||||
private popoverService: PopoverService) {
|
private popoverService: PopoverService) {
|
||||||
this.route.data.subscribe((data: { jobsScheduler: any }) => {
|
this.route.data.subscribe((data: { jobsScheduler: any }) => {
|
||||||
if (data.jobsScheduler) {
|
if (data.jobsScheduler) {
|
||||||
this.jobData = data.jobsScheduler[0];
|
this.jobData = data.jobsScheduler[0];
|
||||||
@@ -100,8 +99,8 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
*/
|
*/
|
||||||
masterToggle() {
|
masterToggle() {
|
||||||
this.isAllSelected() ?
|
this.isAllSelected() ?
|
||||||
this.selection.clear() :
|
this.selection.clear() :
|
||||||
this.dataSource.data.forEach(row => this.selection.select(row));
|
this.dataSource.data.forEach(row => this.selection.select(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,44 +116,44 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
*/
|
*/
|
||||||
setJobs() {
|
setJobs() {
|
||||||
this.systemService.getJobs()
|
this.systemService.getJobs()
|
||||||
.subscribe((jobData: any) => {
|
.subscribe((jobData: any) => {
|
||||||
this.dataSource = new MatTableDataSource(jobData);
|
this.dataSource = new MatTableDataSource(jobData);
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
this.jobsCounter = jobData.length;
|
this.jobsCounter = jobData.length;
|
||||||
this.selection.clear();
|
this.selection.clear();
|
||||||
this.dataSource.sortingDataAccessor = (item, property) => {
|
this.dataSource.sortingDataAccessor = (item, property) => {
|
||||||
switch (property) {
|
switch (property) {
|
||||||
case 'previousRunStatus': return item.lastRunHistory.status;
|
case 'previousRunStatus': return item.lastRunHistory.status;
|
||||||
case 'errorLog': return item.lastRunHistory.status;
|
case 'errorLog': return item.lastRunHistory.status;
|
||||||
case 'previousRunTime': return new Date(item.lastRunHistory.jobRunStartTime);
|
case 'previousRunTime': return new Date(item.lastRunHistory.jobRunStartTime);
|
||||||
case 'nextRunTime': return new Date(item.nextRunTime);
|
case 'nextRunTime': return new Date(item.nextRunTime);
|
||||||
default: return item[property];
|
default: return item[property];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getScheduler() {
|
getScheduler() {
|
||||||
this.systemService.getScheduler()
|
this.systemService.getScheduler()
|
||||||
.subscribe((schedulerData: any) => {
|
.subscribe((schedulerData: any) => {
|
||||||
this.schedulerData = schedulerData;
|
this.schedulerData = schedulerData;
|
||||||
this.schedulerActive = this.schedulerData.active;
|
this.schedulerActive = this.schedulerData.active;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
suspendScheduler(): void {
|
suspendScheduler(): void {
|
||||||
this.systemService.runCommandOnScheduler('stop')
|
this.systemService.runCommandOnScheduler('stop')
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.getScheduler();
|
this.getScheduler();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
activateScheduler(): void {
|
activateScheduler(): void {
|
||||||
this.systemService.runCommandOnScheduler('start')
|
this.systemService.runCommandOnScheduler('start')
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.getScheduler();
|
this.getScheduler();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
runSelectedJobs(): void {
|
runSelectedJobs(): void {
|
||||||
@@ -216,7 +215,7 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
* Next Step (Accounting) Dialog Configuration Wizard.
|
* Next Step (Accounting) Dialog Configuration Wizard.
|
||||||
*/
|
*/
|
||||||
openNextStepDialog() {
|
openNextStepDialog() {
|
||||||
const nextStepDialogRef = this.dialog.open( NextStepDialogComponent, {
|
const nextStepDialogRef = this.dialog.open(NextStepDialogComponent, {
|
||||||
data: {
|
data: {
|
||||||
nextStepName: 'Setup Accounting',
|
nextStepName: 'Setup Accounting',
|
||||||
previousStepName: 'System',
|
previousStepName: 'System',
|
||||||
@@ -224,16 +223,16 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
nextStepDialogRef.afterClosed().subscribe((response: { nextStep: boolean }) => {
|
nextStepDialogRef.afterClosed().subscribe((response: { nextStep: boolean }) => {
|
||||||
if (response.nextStep) {
|
if (response.nextStep) {
|
||||||
this.configurationWizardService.showSchedulerJobsPage = false;
|
this.configurationWizardService.showSchedulerJobsPage = false;
|
||||||
this.configurationWizardService.showSchedulerJobsList = false;
|
this.configurationWizardService.showSchedulerJobsList = false;
|
||||||
this.configurationWizardService.showChartofAccounts = true;
|
this.configurationWizardService.showChartofAccounts = true;
|
||||||
this.router.navigate(['/accounting']);
|
this.router.navigate(['/accounting']);
|
||||||
} else {
|
} else {
|
||||||
this.configurationWizardService.showSchedulerJobsPage = false;
|
this.configurationWizardService.showSchedulerJobsPage = false;
|
||||||
this.configurationWizardService.showSchedulerJobsList = false;
|
this.configurationWizardService.showSchedulerJobsList = false;
|
||||||
this.router.navigate(['/home']);
|
this.router.navigate(['/home']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user