saving , current and RD account code update

This commit is contained in:
Nitesh Yadav
2026-04-22 18:28:14 +05:30
parent e9a9377148
commit fc1c5126fc
44 changed files with 5516 additions and 1552 deletions
@@ -0,0 +1,71 @@
<!--
Copyright since 2025 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<form [formGroup]="currentAccountTermForm">
<div class="sat-section">
<div class="sat-section__header">
<span class="sat-section__badge"><i class="fas fa-chart-line"></i></span>
<span>Interest On OD</span>
</div>
<div class="sat-body">
<!-- Interest Posting Frequency -->
<mat-form-field appearance="outline" class="sat-field">
<mat-label>Interest Posting Frequency</mat-label>
<mat-select formControlName="interestPostingPeriodType" required>
@for (opt of interestPostingPeriodTypeData; track opt) {
<mat-option [value]="opt.id">{{ opt.value | translateKey: 'catalogs' }}</mat-option>
}
</mat-select>
<mat-error>Interest Posting Frequency is <strong>required</strong></mat-error>
</mat-form-field>
<!-- Footer: Auto Post + Frequency Fix Day + Last Interest Date -->
<div class="sat-footer">
<div class="sat-footer__grid">
<div class="sat-toggle-card">
<div>
<h4>Auto Interest Post</h4>
</div>
<div class="sat-toggle-card__choices">
@for (option of yesNoOptions; track option.value) {
<label class="sat-radio-label">
<input type="radio" formControlName="autoPost" [value]="option.value" />
<span>{{ option.label }}</span>
</label>
}
</div>
</div>
<mat-form-field appearance="outline" class="sat-field">
<mat-label>Frequency (Fix Day)</mat-label>
<input type="number" matInput formControlName="frequencyFixDay" min="0" />
<mat-hint>Days</mat-hint>
</mat-form-field>
<mat-form-field appearance="outline" class="sat-field" (click)="lastInterestDatePicker.open()">
<mat-label>Last Interest Date</mat-label>
<input
matInput
[matDatepicker]="lastInterestDatePicker"
formControlName="lastInterestDate"
[min]="minDate"
[max]="maxDate"
/>
<mat-datepicker-toggle matSuffix [for]="lastInterestDatePicker"></mat-datepicker-toggle>
<mat-datepicker #lastInterestDatePicker></mat-datepicker>
</mat-form-field>
</div>
<div class="sat-note">
<span>⚠️</span>
<span>Daily product-based interest accrual enabled — interest calculated EOD on daily closing balance.</span>
</div>
</div>
</div>
</div>
</form>
@@ -0,0 +1,166 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
$accent: #0ea5e9;
$border: #e2e8f0;
$gray-50: #f8f9fa;
$gray-200: #e8eaed;
$gray-900: #202124;
.sat-section {
border: 1px solid $border;
border-radius: 10px;
overflow: hidden;
background: #fff;
& + & {
margin-top: 16px;
}
&__header {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 24px;
background: $gray-50;
border-bottom: 1px solid $gray-200;
span {
font-size: 14px;
font-weight: 600;
color: $gray-900;
}
}
}
.sat-section__badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-radius: 6px;
background: #eff6ff;
font-size: 14px;
}
.sat-body {
background: #fff;
padding: 18px 24px 24px;
}
.sat-banner {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
margin-bottom: 18px;
border-radius: 8px;
background: #eff6ff;
border: 1px solid #bfdbfe;
font-size: 13px;
color: $gray-900;
&__icon {
font-size: 16px;
}
}
.sat-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 4px 16px;
@media (width <= 900px) {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (width <= 600px) {
grid-template-columns: 1fr;
}
}
.sat-field {
width: 100%;
}
.sat-footer {
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid $border;
&__grid {
display: grid;
grid-template-columns: auto 1fr 1fr;
gap: 4px 16px;
align-items: start;
@media (width <= 900px) {
grid-template-columns: 1fr 1fr;
}
@media (width <= 600px) {
grid-template-columns: 1fr;
}
}
}
.sat-toggle-card {
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px 14px;
border: 1px solid $border;
border-radius: 8px;
background: $gray-50;
min-height: 56px;
h4 {
margin: 0;
font-size: 12px;
font-weight: 600;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.04em;
}
&__choices {
display: flex;
gap: 16px;
align-items: center;
}
}
.sat-radio-label {
display: flex;
align-items: center;
gap: 6px;
font-size: 14px;
color: $gray-900;
cursor: pointer;
[type='radio'] {
accent-color: $accent;
width: 16px;
height: 16px;
cursor: pointer;
}
}
.sat-note {
display: flex;
align-items: flex-start;
gap: 8px;
margin-top: 12px;
padding: 10px 14px;
border-radius: 8px;
background: #fffbeb;
border: 1px solid #fde68a;
font-size: 13px;
color: #92400e;
}
@@ -0,0 +1,102 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Component, Input, OnInit, inject } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms';
import { Dates } from 'app/core/utils/dates';
import { SettingsService } from 'app/settings/settings.service';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
@Component({
selector: 'mifosx-current-account-term-step',
templateUrl: './current-account-term-step.component.html',
styleUrls: ['./current-account-term-step.component.scss'],
imports: [...STANDALONE_SHARED_IMPORTS]
})
export class CurrentAccountTermStepComponent implements OnInit {
private formBuilder = inject(UntypedFormBuilder);
private dateUtils = inject(Dates);
private settingsService = inject(SettingsService);
private _currentAccountProductTemplate: any;
@Input()
set currentAccountProductTemplate(value: any) {
this._currentAccountProductTemplate = value;
if (value && this.currentAccountTermForm) {
this.applyTemplate(value);
}
}
get currentAccountProductTemplate(): any {
return this._currentAccountProductTemplate;
}
currentAccountTermForm: UntypedFormGroup;
interestPostingPeriodTypeData: any[] = [];
yesNoOptions = [
{ value: true, label: 'Yes' },
{ value: false, label: 'No' }
];
minDate = new Date(2000, 0, 1);
maxDate = new Date();
constructor() {
this.createForm();
}
createForm() {
this.currentAccountTermForm = this.formBuilder.group({
currencyCode: [{ value: '', disabled: true }],
interestPostingPeriodType: [
'',
Validators.required
],
autoPost: [true],
frequencyFixDay: [
30,
[Validators.min(0)]
],
lastInterestDate: ['']
});
}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
if (this._currentAccountProductTemplate) {
this.applyTemplate(this._currentAccountProductTemplate);
}
}
private applyTemplate(t: any) {
this.maxDate = this.settingsService.businessDate;
this.interestPostingPeriodTypeData = t.interestPostingPeriodTypeOptions || [];
this.currentAccountTermForm.patchValue({
currencyCode: t.currency?.code,
interestPostingPeriodType: t.interestPostingPeriodType?.id,
autoPost: t.autoPost ?? true,
frequencyFixDay: t.frequencyFixDay ?? 30,
lastInterestDate: t.lastInterestDate ? new Date(t.lastInterestDate) : ''
});
}
get currentAccountTerms() {
const value = { ...this.currentAccountTermForm.getRawValue() };
const dateFormat = this.settingsService.dateFormat;
if (value.lastInterestDate instanceof Date) {
value.lastInterestDate = this.dateUtils.formatDate(value.lastInterestDate, dateFormat) || '';
}
delete value.currencyCode;
return value;
}
}