Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
<div class="layout-row-wrap gap-70percent m-b-10 layout-lt-md-column">
<p class="mat-title flex-25">
{{ 'labels.inputs.Floating Rate Periods' | translate }}
<i
class="fas fa-question"
matTooltip="{{ 'tooltips.Floating interest rate and start date' | translate }}"
></i>
</p>

<button mat-mini-fab type="button" color="primary" (click)="addFloatingRatePeriod()">
Expand Down Expand Up @@ -167,7 +163,7 @@
mat-raised-button
type="submit"
color="primary"
[disabled]="!floatingRateForm.valid"
[disabled]="!floatingRateForm.valid || floatingRatePeriodsData.length === 0"
*mifosxHasPermission="'CREATE_FLOATINGRATE'"
>
{{ 'labels.buttons.Submit' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ export class CreateFloatingRateComponent implements OnInit {

/** Floating Rate Period Data. */
floatingRatePeriodsData: any[] = [];
/** Minimum floating rate period date allowed. */
minDate = new Date();
/** Floating Rate Form. */
floatingRateForm: UntypedFormGroup;
/** Columns to be displayed in floating rate periods table. */
Expand Down Expand Up @@ -164,9 +162,7 @@ export class CreateFloatingRateComponent implements OnInit {
*/
addFloatingRatePeriod() {
const floatingRatePeriodDialogRef = this.dialog.open(FloatingRatePeriodDialogComponent, {
data: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whyt it was removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fromDate: this.settingsService.businessDate was removed from the dialog data because the minDate calculation is now handled inside the dialog component itself. The dialog now calculates minDate as businessDate + 1 day (tomorrow) since floating rates must always be in the future. This centralizes the date logic in one place rather than passing it from the parent component.

fromDate: this.settingsService.businessDate
}
data: {}
});
floatingRatePeriodDialogRef.afterClosed().subscribe((response: any) => {
if (response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@
<div class="layout-row-wrap gap-70percent m-b-10 layout-lt-md-column">
<p class="mat-title flex-25">
{{ 'labels.inputs.Floating Rate Periods' | translate }}
<i
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it was removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question mark icon was removed as per the Jira ticket WEB-134 requirements. The ticket states: "There is a label 'Floating Rate Periods ?' The question mark makes no sense in labels - remove it."

class="fas fa-question"
matTooltip="{{
'tooltips.Floating interest rate and start date for this floating rate scheme' | translate
}}"
></i>
</p>

<button mat-mini-fab type="button" color="primary" (click)="addFloatingRatePeriod()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ export class EditFloatingRateComponent implements OnInit {
floatingRateForm: UntypedFormGroup;
/** Floating Rate Data. */
floatingRateData: any;
/** Minimum floating rate period date allowed. */
minDate = new Date();
/** Form Pristine Status. */
isFloatingRateFormPristine = true;
/** Columns to be displayed in floating rate periods table. */
Expand Down Expand Up @@ -192,7 +190,8 @@ export class EditFloatingRateComponent implements OnInit {
data: {
fromDate: ratePeriod.fromDate,
interestRate: ratePeriod.interestRate,
isDifferentialToBaseLendingRate: ratePeriod.isDifferentialToBaseLendingRate
isDifferentialToBaseLendingRate: ratePeriod.isDifferentialToBaseLendingRate,
isNew: true
}
});
editFloatingRatePeriodDialogRef.afterClosed().subscribe((response: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,33 @@ export class FloatingRatePeriodDialogComponent implements OnInit {
* Creates the floating rate period form.
*/
ngOnInit() {
this.minDate = this.settingsService.businessDate;
// Set minDate to tomorrow based on server business date (floating rates must always be in the future)
const tomorrow = new Date(this.settingsService.businessDate);
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(0, 0, 0, 0);
this.minDate = tomorrow;

let rowDisabled = false;
if (this.data && new Date(this.data.fromDate) < this.minDate) {
if (this.data?.fromDate && new Date(this.data.fromDate) < this.minDate) {
rowDisabled = true;
}
if (this.data.isNew) {
if (this.data?.isNew) {
rowDisabled = false;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
this.floatingRatePeriodForm = this.formBuilder.group({
fromDate: [
{ value: this.data ? new Date(this.data.fromDate) : '', disabled: rowDisabled },
{ value: this.data?.fromDate ? new Date(this.data.fromDate) : '', disabled: rowDisabled },
Validators.required
],
interestRate: [
{ value: this.data ? this.data.interestRate : '', disabled: rowDisabled },
{ value: this.data?.interestRate ?? '', disabled: rowDisabled },
[
Validators.required,
Validators.min(0)
]
],
isDifferentialToBaseLendingRate: [
{ value: this.data ? this.data.isDifferentialToBaseLendingRate : false, disabled: rowDisabled }]
{ value: this.data?.isDifferentialToBaseLendingRate ?? false, disabled: rowDisabled }]
});
}

Expand Down
Loading