merging code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nitesh Yadav
2026-04-20 14:26:25 +05:30
co-authored by Claude Sonnet 4.6
322 changed files with 28779 additions and 4976 deletions
@@ -1,3 +1,11 @@
/**
* 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, OnInit, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
@@ -29,19 +37,45 @@ export class EntityClassificationTabComponent implements OnInit {
categories = [
{ key: 'msme', label: 'MSME', tag: 'Udyam / MSME', tagColor: '#0A5C6B', tagBg: '#E6F4F6', icon: 'cogs' },
{ key: 'startup', label: 'Startup India', tag: 'DPIIT', tagColor: '#1A5FAB', tagBg: '#EAF2FB', icon: 'rocket' },
{ key: 'mudra', label: 'Mudra Borrower', tag: 'PMMY', tagColor: '#8A5A00', tagBg: '#FEF3DC', icon: 'hand-holding-usd' },
{
key: 'mudra',
label: 'Mudra Borrower',
tag: 'PMMY',
tagColor: '#8A5A00',
tagBg: '#FEF3DC',
icon: 'hand-holding-usd'
},
{ key: 'eou', label: 'Export Oriented Unit', tag: 'EOU', tagColor: '#1B7A4A', tagBg: '#E8F5EE', icon: 'ship' },
{ key: 'importexport', label: 'Import Export', tag: 'DGFT / IEC', tagColor: '#5B3A8A', tagBg: '#F0EBF8', icon: 'exchange-alt' },
{
key: 'importexport',
label: 'Import Export',
tag: 'DGFT / IEC',
tagColor: '#5B3A8A',
tagBg: '#F0EBF8',
icon: 'exchange-alt'
},
{ key: 'psl', label: 'Priority Sector', tag: 'RBI PSL', tagColor: '#7B1F1F', tagBg: '#FCEAEA', icon: 'bullseye' },
{ key: 'nps', label: 'Non-Priority Sector', tag: 'General', tagColor: '#444441', tagBg: '#F1EFE8', icon: 'building' }
{
key: 'nps',
label: 'Non-Priority Sector',
tag: 'General',
tagColor: '#444441',
tagBg: '#F1EFE8',
icon: 'building'
}
];
ngOnInit() {
this.clientId = this.route.parent?.snapshot.paramMap.get('clientId') || '';
if (this.clientId) {
this.clientsService.getEntityClassifications(this.clientId).subscribe({
next: (res: any) => { this.data = res; this.loading = false; },
error: () => { this.loading = false; }
next: (res: any) => {
this.data = res;
this.loading = false;
},
error: () => {
this.loading = false;
}
});
} else {
this.loading = false;
@@ -50,19 +84,25 @@ export class EntityClassificationTabComponent implements OnInit {
get enabledCategories(): any[] {
if (!this.data) return [];
return this.categories.filter(c => this.data[c.key]?.enabled);
return this.categories.filter((c) => this.data[c.key]?.enabled);
}
getCategoryData(key: string): any {
return this.data?.[key] || {};
}
getFieldPairs(catData: any): { label: string, value: any }[] {
getFieldPairs(catData: any): { label: string; value: any }[] {
if (!catData) return [];
const skip = ['id', 'clientId', 'enabled', 'locale', 'dateFormat'];
const skip = [
'id',
'clientId',
'enabled',
'locale',
'dateFormat'
];
return Object.keys(catData)
.filter(k => !skip.includes(k) && catData[k] != null && catData[k] !== '' && catData[k] !== false)
.map(k => ({
.filter((k) => !skip.includes(k) && catData[k] != null && catData[k] !== '' && catData[k] !== false)
.map((k) => ({
label: this.formatLabel(k),
value: this.formatValue(catData[k])
}));
@@ -71,7 +111,7 @@ export class EntityClassificationTabComponent implements OnInit {
private formatLabel(key: string): string {
return key
.replace(/([A-Z])/g, ' $1')
.replace(/^./, s => s.toUpperCase())
.replace(/^./, (s) => s.toUpperCase())
.replace(/Id$/, '')
.trim();
}