intelica-library-ui 0.1.188 → 0.1.190

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
5
5
  import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, tap, map } from 'rxjs';
6
6
  import Swal from 'sweetalert2';
7
7
  import * as i1 from '@angular/common';
8
- import { CommonModule, DatePipe, isPlatformBrowser } from '@angular/common';
8
+ import { CommonModule, DatePipe, isPlatformBrowser, NgIf } from '@angular/common';
9
9
  import * as i1$1 from '@angular/forms';
10
10
  import { FormsModule, FormBuilder, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
11
11
  import { BadgeModule } from 'primeng/badge';
@@ -16,7 +16,7 @@ import { TableModule } from 'primeng/table';
16
16
  import * as i4 from 'primeng/tooltip';
17
17
  import { TooltipModule } from 'primeng/tooltip';
18
18
  import moment from 'moment';
19
- import * as _ from 'lodash';
19
+ import _ from 'lodash';
20
20
  import * as i2 from 'primeng/button';
21
21
  import { ButtonModule } from 'primeng/button';
22
22
  import * as i3 from 'primeng/radiobutton';
@@ -41,6 +41,10 @@ import { Dialog } from 'primeng/dialog';
41
41
  import * as echarts from 'echarts';
42
42
  import * as i2$4 from 'primeng/skeleton';
43
43
  import { SkeletonModule } from 'primeng/skeleton';
44
+ import { DropdownModule } from 'primeng/dropdown';
45
+ import { OverlayPanelModule } from 'primeng/overlaypanel';
46
+ import * as i4$2 from 'primeng/accordion';
47
+ import { AccordionModule } from 'primeng/accordion';
44
48
  import * as XLSX from 'xlsx';
45
49
  import { Workbook } from 'exceljs';
46
50
  import { saveAs } from 'file-saver';
@@ -610,8 +614,81 @@ class FormatDateConstants {
610
614
  static YYYYMMDD_SLASH = "YYYY/MM/DD";
611
615
  }
612
616
 
617
+ class GroupRegCountryBankConstants {
618
+ //IDS
619
+ static COLUMN_GROUP_ID = 'groupId';
620
+ static COLUMN_REGION_ID = 'regionId';
621
+ static COLUMN_COUNTRY_ID = 'countryId';
622
+ static COLUMN_BANK_ID = 'bankId';
623
+ //DESCRIPTION BD
624
+ static COLUMN_GROUP_NAME = 'groupName';
625
+ static COLUMN_REGION_NAME = 'regionName';
626
+ static COLUMN_COUNTRY_NAME = 'countryName';
627
+ static COLUMN_BANK_NAME = 'bankName';
628
+ static COLUMN_BANK_NAME_COMERCIAL = 'bankNameCommercial';
629
+ //DESCRIPTION GROUP COMBO
630
+ static GLOBAL = {
631
+ 325: 'Global',
632
+ 327: 'Global'
633
+ };
634
+ static GROUP = {
635
+ 325: 'Group',
636
+ 327: 'Grupo'
637
+ };
638
+ static REGION = {
639
+ 325: 'Region',
640
+ 327: 'Región'
641
+ };
642
+ static COUNTRY = {
643
+ 325: 'Country',
644
+ 327: 'País'
645
+ };
646
+ static BANK = {
647
+ 325: 'Client',
648
+ 327: 'Cliente'
649
+ };
650
+ //DESCRIPCION BY
651
+ static GROUP_BY = 'groupBy';
652
+ static GROUP_TEXT = 'name';
653
+ static GROUP_INDEX = 'index';
654
+ }
655
+ class GroupRegionCountryBankModel {
656
+ index = 0;
657
+ groupId = 0;
658
+ groupName = '';
659
+ regionId = 0;
660
+ regionName = '';
661
+ countryId = 0;
662
+ countryName = '';
663
+ bankId = 0;
664
+ bankName = '';
665
+ nivel = 0;
666
+ bankNameCommercial = '';
667
+ }
668
+ class GlobalConstants {
669
+ static STRING_ALL = 'All';
670
+ static NUMBER_ALL = -1;
671
+ static REGION_EUROPE = 7;
672
+ static KEY_ENCRIPT = 'abcdefghijklmnopqrstuvwx';
673
+ static IV_ENCRIPT = '1234567890123456';
674
+ }
675
+
676
+ class OrderConstants {
677
+ //DESCRIPTION
678
+ static ORDER_BY_DESC = "desc";
679
+ static ORDER_BY_ASC = "asc";
680
+ //VALUES
681
+ static ORDER_BY_DESC_VALUE = "1";
682
+ static ORDER_BY_ASC_VALUE = "0";
683
+ }
684
+
685
+ class Constants {
686
+ static REGION_EUROPE = 7;
687
+ }
688
+
613
689
  class SharedService {
614
690
  location;
691
+ termsPipe;
615
692
  configObservable = new Subject();
616
693
  isLoading = new BehaviorSubject(false);
617
694
  isLoadingHeader = new BehaviorSubject(true);
@@ -654,8 +731,10 @@ class SharedService {
654
731
  ],
655
732
  };
656
733
  subtitleDescriptionNotification$;
657
- constructor(location) {
734
+ GlobalTermService = inject(GlobalTermService);
735
+ constructor(location, termsPipe) {
658
736
  this.location = location;
737
+ this.termsPipe = termsPipe;
659
738
  }
660
739
  ///METODOS GLOBALS.
661
740
  IsNumberRate(n) {
@@ -1342,7 +1421,84 @@ class SharedService {
1342
1421
  },
1343
1422
  ], [criteria]);
1344
1423
  }
1345
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, deps: [{ token: i1.Location }], target: i0.ɵɵFactoryTarget.Injectable });
1424
+ //TITLES
1425
+ setTitles(ListGeneralGroupRegionCountryBank, groupId, regId, countryId, bankId, isInternal) {
1426
+ let res = "";
1427
+ const ListGeneralGroupAll = _.orderBy(_.uniqBy(ListGeneralGroupRegionCountryBank, GroupRegCountryBankConstants.COLUMN_GROUP_ID), [GroupRegCountryBankConstants.COLUMN_GROUP_NAME], [OrderConstants.ORDER_BY_ASC]);
1428
+ const ListGeneralRegionAll = _.orderBy(_.uniqBy(ListGeneralGroupRegionCountryBank, GroupRegCountryBankConstants.COLUMN_REGION_ID), [GroupRegCountryBankConstants.COLUMN_REGION_NAME], [OrderConstants.ORDER_BY_ASC]);
1429
+ const ListGeneralCountryAll = _.orderBy(_.uniqBy(ListGeneralGroupRegionCountryBank, GroupRegCountryBankConstants.COLUMN_COUNTRY_ID), [GroupRegCountryBankConstants.COLUMN_COUNTRY_NAME], [OrderConstants.ORDER_BY_ASC]);
1430
+ const ListGeneralBankAll = _.orderBy(_.uniqBy(ListGeneralGroupRegionCountryBank, GroupRegCountryBankConstants.COLUMN_BANK_ID), [GroupRegCountryBankConstants.COLUMN_BANK_NAME], [OrderConstants.ORDER_BY_ASC]);
1431
+ const CurrentGroup = this.getCurrentGroup(ListGeneralGroupAll, ListGeneralRegionAll, groupId, regId);
1432
+ const CurrentRegion = this.getCurrentRegion(ListGeneralRegionAll, regId, countryId);
1433
+ const CurrentCountry = countryId > 0 ? ListGeneralCountryAll.filter((f) => f.countryId === countryId)[0] : undefined;
1434
+ const CurrentBank = bankId > 0 ? ListGeneralBankAll.filter((f) => f.bankId === bankId)[0] : undefined;
1435
+ if (isInternal) {
1436
+ res = CurrentGroup ? CurrentGroup.groupName : "";
1437
+ res = CurrentRegion ? this.getTitleByRegionOrCountry(CurrentGroup, CurrentRegion, "regionName") : res;
1438
+ res = CurrentCountry ? this.getTitleByRegionOrCountry(CurrentGroup, CurrentCountry, "countryName") : res;
1439
+ res = CurrentBank ? CurrentBank.bankName : res;
1440
+ }
1441
+ else {
1442
+ res = CurrentGroup ? CurrentGroup.groupName : "";
1443
+ res = CurrentRegion ? CurrentRegion.groupName + " " + CurrentRegion.regionName : res;
1444
+ res = CurrentCountry ? CurrentCountry.bankName + " " + CurrentCountry.countryName : res;
1445
+ res = CurrentBank ? this.getTitleByBank(ListGeneralCountryAll, CurrentBank) : res;
1446
+ res = ListGeneralGroupRegionCountryBank.length > 1 ? res : "";
1447
+ }
1448
+ return res;
1449
+ }
1450
+ getCurrentGroup(ListGeneralGroupAll, ListGeneralRegionAll, groupId, regId) {
1451
+ if (ListGeneralGroupAll.length === 1) {
1452
+ return ListGeneralGroupAll[0];
1453
+ }
1454
+ if (groupId > 0) {
1455
+ return ListGeneralGroupAll.filter((f) => f.groupId === groupId)[0];
1456
+ }
1457
+ if ((regId === Constants.REGION_EUROPE || regId === -1) && ListGeneralRegionAll.length === 3) {
1458
+ return ListGeneralRegionAll[0];
1459
+ }
1460
+ return undefined;
1461
+ }
1462
+ getCurrentRegion(ListGeneralRegionAll, regId, countryId) {
1463
+ if ((regId === Constants.REGION_EUROPE || regId === -1) && ListGeneralRegionAll.length === 3) {
1464
+ return undefined;
1465
+ }
1466
+ if (regId > 0 && countryId < 1) {
1467
+ return ListGeneralRegionAll.filter((f) => f.regionId === regId)[0];
1468
+ }
1469
+ return undefined;
1470
+ }
1471
+ getTitleByRegionOrCountry(CurrentGroup, Current, field) {
1472
+ return CurrentGroup ? CurrentGroup.groupName + " - " + Current[field] : Current[field];
1473
+ }
1474
+ getTitleByBank(ListGeneralCountryAll, CurrentBank) {
1475
+ return ListGeneralCountryAll.length > 1 ? CurrentBank.groupName + " - " + CurrentBank.countryName + " - " + CurrentBank.bankNameCommercial : CurrentBank.bankNameCommercial;
1476
+ }
1477
+ getTermTextByCode(code, mode = 1) {
1478
+ return this.termsPipe.transform(code, "", mode);
1479
+ }
1480
+ isEmpty(value) {
1481
+ return value === null || value === "" || value === undefined;
1482
+ }
1483
+ groupByColumn(data, columnGroup) {
1484
+ let colUnique = [];
1485
+ if (columnGroup != "") {
1486
+ colUnique = [
1487
+ ...new Set(data.map(item => {
1488
+ return item[columnGroup];
1489
+ })),
1490
+ ].filter(unique => !this.isEmpty(unique));
1491
+ }
1492
+ else {
1493
+ colUnique = [
1494
+ ...new Set(data.map(item => {
1495
+ return item;
1496
+ })),
1497
+ ].filter(unique => !this.isEmpty(unique));
1498
+ }
1499
+ return colUnique;
1500
+ }
1501
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, deps: [{ token: i1.Location }, { token: TermPipe }], target: i0.ɵɵFactoryTarget.Injectable });
1346
1502
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, providedIn: "root" });
1347
1503
  }
1348
1504
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, decorators: [{
@@ -1350,7 +1506,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
1350
1506
  args: [{
1351
1507
  providedIn: "root",
1352
1508
  }]
1353
- }], ctorParameters: () => [{ type: i1.Location }] });
1509
+ }], ctorParameters: () => [{ type: i1.Location }, { type: TermPipe }] });
1354
1510
 
1355
1511
  class PositiveNumberDirective {
1356
1512
  el;
@@ -4501,15 +4657,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
4501
4657
  type: Output
4502
4658
  }] } });
4503
4659
 
4504
- class OrderConstants {
4505
- //DESCRIPTION
4506
- static ORDER_BY_DESC = "desc";
4507
- static ORDER_BY_ASC = "asc";
4508
- //VALUES
4509
- static ORDER_BY_DESC_VALUE = "1";
4510
- static ORDER_BY_ASC_VALUE = "0";
4511
- }
4512
-
4513
4660
  class SortingComponent {
4514
4661
  /**
4515
4662
  * Suscripción a un observable.
@@ -5348,6 +5495,451 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
5348
5495
  type: Input
5349
5496
  }] } });
5350
5497
 
5498
+ class TitlesComponent {
5499
+ globalTerms = inject(GlobalTermService);
5500
+ SharedService = inject(SharedService);
5501
+ /** Modelo de selección de filtro. */
5502
+ setFilter;
5503
+ /** Título y subtítulo */
5504
+ title = "";
5505
+ subTitle = "";
5506
+ /** Mostrar filtros en cabecera */
5507
+ showFilterHead = true;
5508
+ /** Agregar opción Global (-1,-1,-1,-1) */
5509
+ addGlobal = false;
5510
+ /** ID para helper */
5511
+ helperId = "";
5512
+ /** Evento de cambio */
5513
+ changeCboTitle = new EventEmitter();
5514
+ /** Dropdown alterno (caja grande) */
5515
+ showAlterFilterHead = false;
5516
+ subShowAlterFilterHead = false;
5517
+ /** Filtros alternos (categoría / subcategoría) */
5518
+ alterFilterValues = [];
5519
+ alterFilterValue = 0;
5520
+ subAlterFilterValues = [];
5521
+ subAlterFilterValue = 0;
5522
+ /** Bancos disponibles (para filtrar) */
5523
+ bankIdListAvaliable = [];
5524
+ /** Dropdown alterno (caja grande) */
5525
+ isInternal = true;
5526
+ currentUser;
5527
+ applyFilterClick = new EventEmitter();
5528
+ clearFilterClick = new EventEmitter();
5529
+ /** Estado interno */
5530
+ titlePage = "";
5531
+ selectIndex = 0;
5532
+ filterHead = "";
5533
+ placeholder = "";
5534
+ subscription = new Subscription();
5535
+ userBanks = [];
5536
+ existEurope = false;
5537
+ isDropdownOpen = false;
5538
+ groupValues = [];
5539
+ dropdownOptions = [];
5540
+ groupIds = [];
5541
+ countryIds = [];
5542
+ regionIds = [];
5543
+ isFilterAvaliable = false;
5544
+ dropdownMenuId = "";
5545
+ tempCategoryId = 0;
5546
+ tempSubcategoryId = 0;
5547
+ tempGroupId = 0;
5548
+ filterSubCategories = [];
5549
+ langId = 325;
5550
+ IsTitleDropdownOpen = false;
5551
+ demoRadioButtonRegion;
5552
+ selectedRadioButtonRegion = null;
5553
+ demoRadioButtonCountry;
5554
+ selectedRadioButtonCountry = null;
5555
+ demoRadioButtonClient;
5556
+ selectedRadioButtonClient = null;
5557
+ demoRadioButtonCategory;
5558
+ selectedRadioButtonCategory = null;
5559
+ demoRadioButtonSubCategory;
5560
+ selectedRadioButtonSubCategory = null;
5561
+ demoRadioButtonMonthly;
5562
+ selectedRadioButtonMonthly = null;
5563
+ constructor() {
5564
+ this.subscription = this.SharedService.isLoadingPageInfo.subscribe({
5565
+ next: isLoadingPageInfo => {
5566
+ if (!isLoadingPageInfo) {
5567
+ this.loadData();
5568
+ this.dropdownMenuId = this.SharedService.GetLastSegmentUrl() + "-analytics";
5569
+ }
5570
+ },
5571
+ });
5572
+ }
5573
+ OnTitleDropdownClickOutside(event) {
5574
+ const dropdownElement = document.querySelector(".titleDropdown");
5575
+ if (dropdownElement && !dropdownElement.contains(event.target)) {
5576
+ this.IsTitleDropdownOpen = false;
5577
+ }
5578
+ }
5579
+ OnTitleDropdownToggle(event) {
5580
+ event.stopPropagation();
5581
+ this.IsTitleDropdownOpen = !this.IsTitleDropdownOpen;
5582
+ }
5583
+ ApplyFilter() {
5584
+ const model = this.buildTitleSelect(this.selectIndex);
5585
+ this.changeCboTitle.emit(model);
5586
+ this.applyFilterClick.emit(model);
5587
+ this.IsTitleDropdownOpen = false;
5588
+ }
5589
+ ClearFilter() {
5590
+ this.alterFilterValue = 0;
5591
+ this.subAlterFilterValue = 0;
5592
+ this.changeCategories();
5593
+ const model = this.buildTitleSelect(this.selectIndex);
5594
+ this.changeCboTitle.emit(model);
5595
+ this.clearFilterClick.emit();
5596
+ this.IsTitleDropdownOpen = false;
5597
+ }
5598
+ buildTitleSelect(index) {
5599
+ const titleSelect = {
5600
+ groupId: GlobalConstants.NUMBER_ALL,
5601
+ regionId: GlobalConstants.NUMBER_ALL,
5602
+ countryId: GlobalConstants.NUMBER_ALL,
5603
+ bankId: GlobalConstants.NUMBER_ALL,
5604
+ banksId: "",
5605
+ group: "",
5606
+ addValue1: 0,
5607
+ addValue2: 0,
5608
+ };
5609
+ const objSelect = this.userBanks.find(model => model.index === index) ?? {};
5610
+ titleSelect.group = objSelect.groupBy;
5611
+ switch (objSelect.groupBy) {
5612
+ case GroupRegCountryBankConstants.GROUP[this.langId]:
5613
+ titleSelect.groupId = objSelect.id;
5614
+ break;
5615
+ case GroupRegCountryBankConstants.REGION[this.langId]: {
5616
+ const region = this.currentUser.listRegionAll.find(r => r.regionId === objSelect.id);
5617
+ titleSelect.regionId = region?.regionId ?? -1;
5618
+ break;
5619
+ }
5620
+ case GroupRegCountryBankConstants.COUNTRY[this.langId]: {
5621
+ const country = this.currentUser.listCountryAll.find(c => c.countryId === objSelect.id);
5622
+ titleSelect.countryId = country?.countryId ?? -1;
5623
+ break;
5624
+ }
5625
+ default: {
5626
+ const bank = this.currentUser.listBankAll.find(b => b.bankId === objSelect.id);
5627
+ if (this.currentUser.IsGroupProfile) {
5628
+ titleSelect.countryId = bank?.countryId ?? -1;
5629
+ }
5630
+ titleSelect.bankId = bank?.bankId ?? -1;
5631
+ break;
5632
+ }
5633
+ }
5634
+ titleSelect.banksId = this.getAllBanks(objSelect);
5635
+ titleSelect.addValue1 = this.alterFilterValue ?? 0;
5636
+ titleSelect.addValue2 = this.subAlterFilterValue ?? 0;
5637
+ return titleSelect;
5638
+ }
5639
+ writeValue(obj) {
5640
+ }
5641
+ registerOnChange(fn) {
5642
+ }
5643
+ registerOnTouched(fn) {
5644
+ }
5645
+ setDisabledState(isDisabled) {
5646
+ }
5647
+ loadData() {
5648
+ this.langId = this.currentUser.LangSite;
5649
+ this.filterHead = this.SharedService.setTitles(this.currentUser.ListGroupRegionCountryBank, -1, -1, -1, -1, this.isInternal);
5650
+ this.title = this.titlePage;
5651
+ this.setGroupRegionCountryBankAll();
5652
+ this.setTitleFilter(this.setFilter);
5653
+ }
5654
+ ngOnChanges(changes) {
5655
+ if (changes.setFilter) {
5656
+ if (this.bankIdListAvaliable.length > 0 && this.currentUser.IsIntelicaUser) {
5657
+ this.filterBankListAvaliable();
5658
+ this.setTitleFilter(changes.setFilter.currentValue);
5659
+ }
5660
+ else {
5661
+ this.isFilterAvaliable = false;
5662
+ this.setGroupRegionCountryBankAll();
5663
+ this.setTitleFilter(changes.setFilter.currentValue);
5664
+ }
5665
+ }
5666
+ if (changes.title) {
5667
+ this.titlePage = this.title;
5668
+ }
5669
+ if (changes.alterFilterValue) {
5670
+ this.tempCategoryId = this.alterFilterValue !== null && this.alterFilterValue !== undefined ? this.alterFilterValue : 0;
5671
+ }
5672
+ if (changes.subAlterFilterValue) {
5673
+ this.tempSubcategoryId = this.subAlterFilterValue !== null && this.subAlterFilterValue !== undefined ? this.subAlterFilterValue : 0;
5674
+ }
5675
+ if (changes.subAlterFilterValues) {
5676
+ this.changeCategories();
5677
+ }
5678
+ if (this.tempSubcategoryId === -1) {
5679
+ this.tempSubcategoryId = 0;
5680
+ }
5681
+ }
5682
+ setGroupRegionCountryBankAll() {
5683
+ let regionValue = this.SharedService.getTermTextByCode("LBL_BANK_REGION");
5684
+ let countryValue = this.SharedService.getTermTextByCode("LBL_BANK_COUNTRY");
5685
+ let bankValue = this.SharedService.getTermTextByCode("LBL_BANK");
5686
+ let globalValue = this.SharedService.getTermTextByCode("LBL_TITLE_GLOBAL");
5687
+ let allValue = this.SharedService.getTermTextByCode("LBL_ALL");
5688
+ this.userBanks = [];
5689
+ if (this.currentUser) {
5690
+ if (this.addGlobal) {
5691
+ this.setNewField(globalValue, globalValue, GlobalConstants.NUMBER_ALL);
5692
+ }
5693
+ if (this.currentUser && this.currentUser.ListGroupRegionCountryBank.length == 1) {
5694
+ this.setNewField(bankValue !== "" ? bankValue : GroupRegCountryBankConstants.BANK[this.langId], this.currentUser.ListGroupRegionCountryBank[0].bankNameCommercial, this.currentUser.ListGroupRegionCountryBank[0].bankId);
5695
+ return;
5696
+ }
5697
+ let listGroupAll = this.fillGeneralListFilter(this.currentUser.listGroupAll, this.groupIds, 0, this.isFilterAvaliable);
5698
+ this.fillGeneralList(listGroupAll, GroupRegCountryBankConstants.GROUP[this.langId], true);
5699
+ if (this.validateEuropeAll() && !this.currentUser.PerfilInternal) {
5700
+ this.setNewField(regionValue !== "" ? regionValue : GroupRegCountryBankConstants.REGION[this.langId], allValue !== "" ? allValue : GlobalConstants.STRING_ALL, GlobalConstants.NUMBER_ALL);
5701
+ }
5702
+ let listRegionAll = this.fillGeneralListFilter(this.currentUser.listRegionAll, this.regionIds, 1, this.isFilterAvaliable);
5703
+ this.fillGeneralList(listRegionAll, GroupRegCountryBankConstants.REGION[this.langId]);
5704
+ if (this.hasNotPreviousGroup(this.currentUser.listCountryAll)) {
5705
+ this.setNewField(countryValue !== "" ? countryValue : GroupRegCountryBankConstants.COUNTRY[this.langId], allValue !== "" ? allValue : GlobalConstants.STRING_ALL, GlobalConstants.NUMBER_ALL);
5706
+ }
5707
+ let listCountryAll = this.fillGeneralListFilter(this.currentUser.listCountryAll, this.countryIds, 2, this.isFilterAvaliable);
5708
+ this.fillGeneralList(listCountryAll, GroupRegCountryBankConstants.COUNTRY[this.langId]);
5709
+ if (this.hasNotPreviousGroup(this.currentUser.listBankAll)) {
5710
+ this.setNewField(bankValue !== "" ? bankValue : GroupRegCountryBankConstants.BANK[this.langId], allValue !== "" ? allValue : GlobalConstants.STRING_ALL, GlobalConstants.NUMBER_ALL);
5711
+ }
5712
+ let listBankAll = this.fillGeneralListFilter(this.currentUser.listBankAll, this.bankIdListAvaliable, 3, this.isFilterAvaliable);
5713
+ listBankAll.forEach(bank => {
5714
+ if (this.existsMoreThanOneBankOrPerfilInternal(bank)) {
5715
+ this.setNewField(bankValue !== "" ? bankValue : GroupRegCountryBankConstants.BANK[this.langId], this.currentUser.PerfilInternal ? bank.bankName : bank.bankNameCommercial, bank.bankId);
5716
+ }
5717
+ });
5718
+ this.groupValues = [];
5719
+ var groupValues = this.SharedService.groupByColumn(this.userBanks, "groupBy");
5720
+ groupValues.forEach(element => {
5721
+ this.groupValues.push({ groupname: element, values: this.userBanks.filter(uB => uB.groupBy === element) });
5722
+ });
5723
+ }
5724
+ }
5725
+ fillGeneralList(listAll, groupBy, setSelectIndex = false) {
5726
+ const groupValue = this.SharedService.getTermTextByCode("LBL_BANK_GROUP");
5727
+ const regionValue = this.SharedService.getTermTextByCode("LBL_BANK_REGION");
5728
+ const countryValue = this.SharedService.getTermTextByCode("LBL_BANK_COUNTRY");
5729
+ [...listAll].forEach(model => {
5730
+ if (!(listAll.length > 1 || this.currentUser.PerfilInternal)) {
5731
+ return;
5732
+ }
5733
+ switch (groupBy) {
5734
+ case GroupRegCountryBankConstants.GROUP[this.langId]:
5735
+ this.setNewField(groupValue, model.groupName, model.groupId);
5736
+ break;
5737
+ case GroupRegCountryBankConstants.REGION[this.langId]:
5738
+ this.setNewField(regionValue, model.regionName, model.regionId);
5739
+ break;
5740
+ case GroupRegCountryBankConstants.COUNTRY[this.langId]:
5741
+ this.setNewField(countryValue, model.countryName, model.countryId);
5742
+ break;
5743
+ }
5744
+ });
5745
+ if (setSelectIndex) {
5746
+ this.selectIndex = this.currentUser.PerfilInternal ? this.userBanks.length : this.selectIndex;
5747
+ }
5748
+ }
5749
+ existsMoreThanOneBankOrPerfilInternal(bank) {
5750
+ return this.currentUser.listBankAll.filter(altBank => altBank.countryId === bank.countryId).length > 1 || this.currentUser.PerfilInternal;
5751
+ }
5752
+ hasNotPreviousGroup(listAll) {
5753
+ return !this.currentUser.PerfilInternal && listAll.length > 1 && !this.userBanks.some(field => field.id === -1) && !this.existEurope;
5754
+ }
5755
+ setNewField(groupBy, name, id) {
5756
+ const field = {
5757
+ groupBy: groupBy,
5758
+ name: name,
5759
+ id: id,
5760
+ index: this.userBanks.length,
5761
+ };
5762
+ this.userBanks.push(field);
5763
+ }
5764
+ validateEuropeAll() {
5765
+ this.existEurope = this.currentUser.listRegionAll.some(region => region.regionId === GlobalConstants.REGION_EUROPE);
5766
+ return (this.existEurope && this.currentUser.listRegionAll.length > 3) || (!this.existEurope && this.currentUser.listRegionAll.length > 1);
5767
+ }
5768
+ setTitleFilter(filter) {
5769
+ if (!filter)
5770
+ return;
5771
+ let groupBy = "";
5772
+ let id = GlobalConstants.NUMBER_ALL;
5773
+ filter.groupId = filter.groupId > 0 ? filter.groupId : GlobalConstants.NUMBER_ALL;
5774
+ filter.regionId = filter.regionId > 0 ? filter.regionId : GlobalConstants.NUMBER_ALL;
5775
+ filter.countryId = filter.countryId > 0 ? filter.countryId : GlobalConstants.NUMBER_ALL;
5776
+ filter.bankId = filter.bankId > 0 ? filter.bankId : GlobalConstants.NUMBER_ALL;
5777
+ const groupValue = this.SharedService.getTermTextByCode("LBL_BANK_GROUP");
5778
+ const regionValue = this.SharedService.getTermTextByCode("LBL_BANK_REGION");
5779
+ const countryValue = this.SharedService.getTermTextByCode("LBL_BANK_COUNTRY");
5780
+ const bankValue = this.SharedService.getTermTextByCode("LBL_BANK");
5781
+ if (filter.groupId !== GlobalConstants.NUMBER_ALL) {
5782
+ groupBy = groupValue !== "" ? groupValue : GroupRegCountryBankConstants.GROUP[this.langId];
5783
+ id = filter.groupId;
5784
+ }
5785
+ if (filter.regionId !== GlobalConstants.NUMBER_ALL) {
5786
+ groupBy = regionValue !== "" ? regionValue : GroupRegCountryBankConstants.REGION[this.langId];
5787
+ id = filter.regionId;
5788
+ }
5789
+ if (filter.countryId !== GlobalConstants.NUMBER_ALL) {
5790
+ groupBy = countryValue !== "" ? countryValue : GroupRegCountryBankConstants.COUNTRY[this.langId];
5791
+ id = filter.countryId;
5792
+ }
5793
+ if (filter.bankId !== GlobalConstants.NUMBER_ALL) {
5794
+ groupBy = bankValue !== "" ? bankValue : GroupRegCountryBankConstants.BANK[this.langId];
5795
+ id = filter.bankId;
5796
+ }
5797
+ const selected = this.userBanks.find(option => option.groupBy === groupBy && option.id === id) ?? this.userBanks[0];
5798
+ if (selected) {
5799
+ this.selectIndex = selected.index;
5800
+ this.tempGroupId = this.selectIndex;
5801
+ }
5802
+ this.filterHead = this.SharedService.setTitles(this.currentUser.ListGroupRegionCountryBank, filter.groupId, filter.regionId, filter.countryId, filter.bankId, this.isInternal);
5803
+ if (this.addGlobal && filter.groupId === -1 && filter.regionId === -1 && filter.countryId === -1 && filter.bankId === -1) {
5804
+ this.filterHead = this.SharedService.getTermTextByCode("LBL_TITLE_GLOBAL");
5805
+ }
5806
+ }
5807
+ showFilter() {
5808
+ return this.userBanks.length > 1 && this.showFilterHead;
5809
+ }
5810
+ /** PrimeNG emite { originalEvent, value } */
5811
+ changeFilter(event) {
5812
+ if (event?.value !== undefined) {
5813
+ this.emitSelectFilter(event.value);
5814
+ }
5815
+ }
5816
+ emitSelectFilter(index) {
5817
+ const titleSelect = this.buildTitleSelect(index);
5818
+ this.filterHead = this.SharedService.setTitles(this.currentUser.ListGroupRegionCountryBank, titleSelect.groupId, titleSelect.regionId, titleSelect.countryId, titleSelect.bankId, this.isInternal);
5819
+ if (this.addGlobal &&
5820
+ (titleSelect.groupId == null || titleSelect.groupId === -1) &&
5821
+ (titleSelect.regionId == null || titleSelect.regionId === -1) &&
5822
+ (titleSelect.countryId == null || titleSelect.countryId === -1) &&
5823
+ (titleSelect.bankId == null || titleSelect.bankId === -1)) {
5824
+ this.filterHead = this.SharedService.getTermTextByCode("LBL_TITLE_GLOBAL");
5825
+ }
5826
+ this.changeCboTitle.emit(titleSelect);
5827
+ }
5828
+ getAllBanks(filter) {
5829
+ let banks = "";
5830
+ const banksFiltered = this.currentUser.ListGroupRegionCountryBank.filter(bank => {
5831
+ let validate = false;
5832
+ switch (filter.groupBy) {
5833
+ case GroupRegCountryBankConstants.GROUP[this.langId]:
5834
+ validate = bank.groupId === filter.id;
5835
+ break;
5836
+ case GroupRegCountryBankConstants.REGION[this.langId]:
5837
+ validate = bank.regionId === filter.id;
5838
+ break;
5839
+ case GroupRegCountryBankConstants.COUNTRY[this.langId]:
5840
+ validate = bank.countryId === filter.id;
5841
+ break;
5842
+ default:
5843
+ validate = bank.bankId === filter.id;
5844
+ break;
5845
+ }
5846
+ return validate || filter.id === GlobalConstants.NUMBER_ALL;
5847
+ });
5848
+ banksFiltered.forEach(b => banks += "|" + b.bankId);
5849
+ return banks.substring(1);
5850
+ }
5851
+ transformNegative(val) {
5852
+ return this.SharedService.TransformNegative(val.toString());
5853
+ }
5854
+ ngOnDestroy() {
5855
+ this.subscription.unsubscribe();
5856
+ }
5857
+ filterBankListAvaliable() {
5858
+ const banksAll = [...this.currentUser.ListGroupRegionCountryBank].filter(item => this.bankIdListAvaliable.includes(item.bankId));
5859
+ this.groupIds = [...new Set(banksAll.map(item => item.groupId))];
5860
+ this.countryIds = [...new Set(banksAll.map(item => item.countryId))];
5861
+ this.regionIds = [...new Set(banksAll.map(item => item.regionId))];
5862
+ this.isFilterAvaliable = true;
5863
+ this.setGroupRegionCountryBankAll();
5864
+ }
5865
+ fillGeneralListFilter(listAll, listIds, column, isFilterAvaliable = false) {
5866
+ return isFilterAvaliable
5867
+ ? [...listAll].filter(item => listIds.includes(item[column === 0 ? "groupId" : column === 1 ? "regionId" : column === 2 ? "countryId" : "bankId"]))
5868
+ : [...listAll];
5869
+ }
5870
+ changeCategories() {
5871
+ this.filterSubCategories = this.subAlterFilterValues.filter(f => f.feeStypId === this.alterFilterValue || this.alterFilterValue === 0);
5872
+ if (this.tempCategoryId !== this.alterFilterValue) {
5873
+ this.subAlterFilterValue = 0;
5874
+ }
5875
+ }
5876
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TitlesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5877
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: TitlesComponent, isStandalone: true, selector: "intelica-titles", inputs: { setFilter: "setFilter", title: "title", subTitle: "subTitle", showFilterHead: "showFilterHead", addGlobal: "addGlobal", helperId: "helperId", showAlterFilterHead: "showAlterFilterHead", subShowAlterFilterHead: "subShowAlterFilterHead", alterFilterValues: "alterFilterValues", alterFilterValue: "alterFilterValue", subAlterFilterValues: "subAlterFilterValues", subAlterFilterValue: "subAlterFilterValue", bankIdListAvaliable: "bankIdListAvaliable", isInternal: "isInternal", currentUser: "currentUser" }, outputs: { changeCboTitle: "changeCboTitle", applyFilterClick: "applyFilterClick", clearFilterClick: "clearFilterClick" }, providers: [
5878
+ {
5879
+ provide: NG_VALUE_ACCESSOR,
5880
+ useExisting: forwardRef(() => TitlesComponent),
5881
+ multi: true,
5882
+ },
5883
+ ], usesOnChanges: true, ngImport: i0, template: "<div class=\"cs-client\" [id]=\"helperId\">\r\n <div class=\"client\">\r\n <div class=\"autoLine d-flex\">\r\n <div class=\"position-relative\">\r\n <ng-container *ngIf=\"!showAlterFilterHead\">\r\n <b><span>{{ titlePage }}</span></b>\r\n <b><span *ngIf=\"showFilter()\">&nbsp;- {{ filterHead }}</span></b>\r\n <b><span *ngIf=\"subTitle.length > 0\">&nbsp;- {{ subTitle }}</span></b>\r\n </ng-container>\r\n \r\n <ng-container>\r\n <div class=\"titleDropdown titleDropdown--minHeight\" [ngClass]=\"{ 'is-dropdown': IsTitleDropdownOpen }\">\r\n <div class=\"titleDropdown__toggle\" (click)=\"OnTitleDropdownToggle($event)\">\r\n <div class=\"titleDropdown__label\">\r\n <span class=\"client\">\r\n <b><span class=\"titleCategoryAnalytics\">{{ titlePage }}</span></b>\r\n <b><span *ngIf=\"showFilter()\">&nbsp;- {{ filterHead }}</span></b>\r\n <b><span *ngIf=\"subTitle.length > 0\">&nbsp;- {{ subTitle }}</span></b>\r\n </span>\r\n </div>\r\n <div class=\"titleDropdown__icon\"><i class=\"icon-arrow-down\"></i></div>\r\n </div>\r\n <div class=\"titleDropdown__dropdown\">\r\n <p-accordion class=\"prAccordionTitleDropdown\" [multiple]=\"true\">\r\n\r\n <!-- Panels din\u00E1micos basados en groupValues (Group / Region / Country / Bank) -->\r\n <p-accordion-panel *ngFor=\"let g of groupValues; let gi = index\" [value]=\"gi\">\r\n <p-accordion-header>\r\n <div class=\"accordion-container-header\">{{ g.groupname }}</div>\r\n </p-accordion-header>\r\n \r\n <p-accordion-content>\r\n <div class=\"prRadioButtonGroup\" *ngFor=\"let v of g.values\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n [inputId]=\"'optSort-' + gi + '-' + v.index\"\r\n [name]=\"'optSort_' + gi\"\r\n [value]=\"v.index\"\r\n [(ngModel)]=\"selectIndex\" />\r\n <label class=\"prRadioButtonLabel\" [for]=\"'optSort-' + gi + '-' + v.index\">\r\n {{ v.name }}\r\n </label>\r\n </div>\r\n </p-accordion-content>\r\n </p-accordion-panel>\r\n \r\n <!-- Category (usa tu alterFilterValues / alterFilterValue) -->\r\n <p-accordion-panel *ngIf=\"alterFilterValues?.length\" value=\"category\">\r\n <p-accordion-header>\r\n <div class=\"accordion-container-header\">{{'LBL_CATEGORY' | term : globalTerms.languageCode}}</div>\r\n </p-accordion-header>\r\n \r\n <p-accordion-content>\r\n <!-- ALL -->\r\n <div class=\"prRadioButtonGroup\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n inputId=\"cat-all\"\r\n name=\"category\"\r\n [value]=\"0\"\r\n [(ngModel)]=\"alterFilterValue\"\r\n (onClick)=\"changeCategories()\" />\r\n <label class=\"prRadioButtonLabel\" for=\"cat-all\">{{'LBL_ALL' | term : globalTerms.languageCode}}</label>\r\n </div>\r\n \r\n <!-- Lista de categor\u00EDas -->\r\n <div class=\"prRadioButtonGroup\" *ngFor=\"let cat of alterFilterValues\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n [inputId]=\"'cat-' + cat.feeStypId\"\r\n name=\"category\"\r\n [value]=\"cat.feeStypId\"\r\n [(ngModel)]=\"alterFilterValue\"\r\n (onClick)=\"changeCategories()\" />\r\n <label class=\"prRadioButtonLabel\" [for]=\"'cat-' + cat.feeStypId\">\r\n {{ cat.feeStypDesc }}\r\n </label>\r\n </div>\r\n </p-accordion-content>\r\n </p-accordion-panel>\r\n \r\n <!-- SubCategory (filtrado por changeCategories -> filterSubCategories) -->\r\n <p-accordion-panel *ngIf=\"filterSubCategories?.length\" value=\"subcategory\">\r\n <p-accordion-header>\r\n <div class=\"accordion-container-header\">{{'LBL_SUBCATEGORY' | term : globalTerms.languageCode}}</div>\r\n </p-accordion-header>\r\n \r\n <p-accordion-content>\r\n <!-- ALL -->\r\n <div class=\"prRadioButtonGroup\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n inputId=\"subcat-all\"\r\n name=\"subcategory\"\r\n [value]=\"0\"\r\n [(ngModel)]=\"subAlterFilterValue\" />\r\n <label class=\"prRadioButtonLabel\" for=\"subcat-all\">{{'LBL_ALL' | term : globalTerms.languageCode}}</label>\r\n </div>\r\n \r\n <!-- Lista subcategor\u00EDas filtradas -->\r\n <div class=\"prRadioButtonGroup\" *ngFor=\"let sub of filterSubCategories\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n [inputId]=\"'sub-' + sub.feeStypSubId\"\r\n name=\"subcategory\"\r\n [value]=\"sub.feeStypSubId\"\r\n [(ngModel)]=\"subAlterFilterValue\" />\r\n <label class=\"prRadioButtonLabel\" [for]=\"'sub-' + sub.feeStypSubId\">\r\n {{ sub.feeStypSubDesc }}\r\n </label>\r\n </div>\r\n </p-accordion-content>\r\n </p-accordion-panel>\r\n \r\n </p-accordion>\r\n \r\n <div class=\"titleDropdown__action\">\r\n <div class=\"btnBox btnBox--center\">\r\n <p-button class=\"prButton prButton--primary\" label=\"Apply\" severity=\"primary\" (click)=\"ApplyFilter()\" />\r\n <p-button class=\"prButton prButton--primary\" label=\"Clear\" severity=\"secondary\" (click)=\"ClearFilter()\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>\r\n </div>\r\n \r\n <div class=\"d-flex\">\r\n <span class=\"range mt-1\"><ng-content></ng-content></span>\r\n </div>\r\n </div>\r\n ", styles: [".range{font-size:12px;color:var(--main-blue)}.client{font-size:14px;color:var(--main-blue)}.midLine{top:-3px;height:20px;width:105%;position:absolute;padding:0}.contentSelections{padding:16px;max-height:370px;overflow:auto}.contentSelections hr{margin:10px 0 0}.form-check label{font-size:11px;margin-left:2px}.subtitleSelections{font-size:12px;color:var(--main-blue);display:block;font-weight:700}.listOperators{position:relative;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr}.containerDropDown{border:.5px solid var(--main-gray)}.listOperators>div{padding-right:15px}.listOperators>div:nth-child(2n){padding-right:0}.contentBoxSection{margin-top:12px}.contentBoxSection:first-child{margin-top:0}.dropdown-toggle i{font-size:9px;margin-left:5px}.border-gray-bottom{border-bottom:1px solid gray;display:block;margin-top:16px}.cs-DataArea .cs-client{margin-top:10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "pipe", type: TermPipe, name: "term" }, { kind: "ngmodule", type: OverlayPanelModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: AccordionModule }, { kind: "component", type: i4$2.Accordion, selector: "p-accordion", inputs: ["value", "multiple", "style", "styleClass", "expandIcon", "collapseIcon", "selectOnFocus", "transitionOptions", "activeIndex", "headerAriaLevel"], outputs: ["valueChange", "activeIndexChange", "onClose", "onOpen"] }, { kind: "component", type: i4$2.AccordionPanel, selector: "p-accordion-panel, p-accordionpanel", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: i4$2.AccordionHeader, selector: "p-accordion-header, p-accordionheader" }, { kind: "component", type: i4$2.AccordionContent, selector: "p-accordion-content, p-accordioncontent" }, { kind: "ngmodule", type: PopoverModule }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i3.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "formControlName", "name", "disabled", "variant", "size", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "autofocus", "binary"], outputs: ["onClick", "onFocus", "onBlur"] }] });
5884
+ }
5885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TitlesComponent, decorators: [{
5886
+ type: Component,
5887
+ args: [{ selector: "intelica-titles", providers: [
5888
+ {
5889
+ provide: NG_VALUE_ACCESSOR,
5890
+ useExisting: forwardRef(() => TitlesComponent),
5891
+ multi: true,
5892
+ },
5893
+ ], imports: [
5894
+ CommonModule,
5895
+ FormsModule,
5896
+ DropdownModule,
5897
+ TermPipe,
5898
+ OverlayPanelModule,
5899
+ ButtonModule,
5900
+ NgIf,
5901
+ AccordionModule,
5902
+ PopoverModule,
5903
+ RadioButtonModule,
5904
+ ], template: "<div class=\"cs-client\" [id]=\"helperId\">\r\n <div class=\"client\">\r\n <div class=\"autoLine d-flex\">\r\n <div class=\"position-relative\">\r\n <ng-container *ngIf=\"!showAlterFilterHead\">\r\n <b><span>{{ titlePage }}</span></b>\r\n <b><span *ngIf=\"showFilter()\">&nbsp;- {{ filterHead }}</span></b>\r\n <b><span *ngIf=\"subTitle.length > 0\">&nbsp;- {{ subTitle }}</span></b>\r\n </ng-container>\r\n \r\n <ng-container>\r\n <div class=\"titleDropdown titleDropdown--minHeight\" [ngClass]=\"{ 'is-dropdown': IsTitleDropdownOpen }\">\r\n <div class=\"titleDropdown__toggle\" (click)=\"OnTitleDropdownToggle($event)\">\r\n <div class=\"titleDropdown__label\">\r\n <span class=\"client\">\r\n <b><span class=\"titleCategoryAnalytics\">{{ titlePage }}</span></b>\r\n <b><span *ngIf=\"showFilter()\">&nbsp;- {{ filterHead }}</span></b>\r\n <b><span *ngIf=\"subTitle.length > 0\">&nbsp;- {{ subTitle }}</span></b>\r\n </span>\r\n </div>\r\n <div class=\"titleDropdown__icon\"><i class=\"icon-arrow-down\"></i></div>\r\n </div>\r\n <div class=\"titleDropdown__dropdown\">\r\n <p-accordion class=\"prAccordionTitleDropdown\" [multiple]=\"true\">\r\n\r\n <!-- Panels din\u00E1micos basados en groupValues (Group / Region / Country / Bank) -->\r\n <p-accordion-panel *ngFor=\"let g of groupValues; let gi = index\" [value]=\"gi\">\r\n <p-accordion-header>\r\n <div class=\"accordion-container-header\">{{ g.groupname }}</div>\r\n </p-accordion-header>\r\n \r\n <p-accordion-content>\r\n <div class=\"prRadioButtonGroup\" *ngFor=\"let v of g.values\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n [inputId]=\"'optSort-' + gi + '-' + v.index\"\r\n [name]=\"'optSort_' + gi\"\r\n [value]=\"v.index\"\r\n [(ngModel)]=\"selectIndex\" />\r\n <label class=\"prRadioButtonLabel\" [for]=\"'optSort-' + gi + '-' + v.index\">\r\n {{ v.name }}\r\n </label>\r\n </div>\r\n </p-accordion-content>\r\n </p-accordion-panel>\r\n \r\n <!-- Category (usa tu alterFilterValues / alterFilterValue) -->\r\n <p-accordion-panel *ngIf=\"alterFilterValues?.length\" value=\"category\">\r\n <p-accordion-header>\r\n <div class=\"accordion-container-header\">{{'LBL_CATEGORY' | term : globalTerms.languageCode}}</div>\r\n </p-accordion-header>\r\n \r\n <p-accordion-content>\r\n <!-- ALL -->\r\n <div class=\"prRadioButtonGroup\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n inputId=\"cat-all\"\r\n name=\"category\"\r\n [value]=\"0\"\r\n [(ngModel)]=\"alterFilterValue\"\r\n (onClick)=\"changeCategories()\" />\r\n <label class=\"prRadioButtonLabel\" for=\"cat-all\">{{'LBL_ALL' | term : globalTerms.languageCode}}</label>\r\n </div>\r\n \r\n <!-- Lista de categor\u00EDas -->\r\n <div class=\"prRadioButtonGroup\" *ngFor=\"let cat of alterFilterValues\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n [inputId]=\"'cat-' + cat.feeStypId\"\r\n name=\"category\"\r\n [value]=\"cat.feeStypId\"\r\n [(ngModel)]=\"alterFilterValue\"\r\n (onClick)=\"changeCategories()\" />\r\n <label class=\"prRadioButtonLabel\" [for]=\"'cat-' + cat.feeStypId\">\r\n {{ cat.feeStypDesc }}\r\n </label>\r\n </div>\r\n </p-accordion-content>\r\n </p-accordion-panel>\r\n \r\n <!-- SubCategory (filtrado por changeCategories -> filterSubCategories) -->\r\n <p-accordion-panel *ngIf=\"filterSubCategories?.length\" value=\"subcategory\">\r\n <p-accordion-header>\r\n <div class=\"accordion-container-header\">{{'LBL_SUBCATEGORY' | term : globalTerms.languageCode}}</div>\r\n </p-accordion-header>\r\n \r\n <p-accordion-content>\r\n <!-- ALL -->\r\n <div class=\"prRadioButtonGroup\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n inputId=\"subcat-all\"\r\n name=\"subcategory\"\r\n [value]=\"0\"\r\n [(ngModel)]=\"subAlterFilterValue\" />\r\n <label class=\"prRadioButtonLabel\" for=\"subcat-all\">{{'LBL_ALL' | term : globalTerms.languageCode}}</label>\r\n </div>\r\n \r\n <!-- Lista subcategor\u00EDas filtradas -->\r\n <div class=\"prRadioButtonGroup\" *ngFor=\"let sub of filterSubCategories\">\r\n <p-radiobutton\r\n class=\"prRadioButton\"\r\n [inputId]=\"'sub-' + sub.feeStypSubId\"\r\n name=\"subcategory\"\r\n [value]=\"sub.feeStypSubId\"\r\n [(ngModel)]=\"subAlterFilterValue\" />\r\n <label class=\"prRadioButtonLabel\" [for]=\"'sub-' + sub.feeStypSubId\">\r\n {{ sub.feeStypSubDesc }}\r\n </label>\r\n </div>\r\n </p-accordion-content>\r\n </p-accordion-panel>\r\n \r\n </p-accordion>\r\n \r\n <div class=\"titleDropdown__action\">\r\n <div class=\"btnBox btnBox--center\">\r\n <p-button class=\"prButton prButton--primary\" label=\"Apply\" severity=\"primary\" (click)=\"ApplyFilter()\" />\r\n <p-button class=\"prButton prButton--primary\" label=\"Clear\" severity=\"secondary\" (click)=\"ClearFilter()\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>\r\n </div>\r\n \r\n <div class=\"d-flex\">\r\n <span class=\"range mt-1\"><ng-content></ng-content></span>\r\n </div>\r\n </div>\r\n ", styles: [".range{font-size:12px;color:var(--main-blue)}.client{font-size:14px;color:var(--main-blue)}.midLine{top:-3px;height:20px;width:105%;position:absolute;padding:0}.contentSelections{padding:16px;max-height:370px;overflow:auto}.contentSelections hr{margin:10px 0 0}.form-check label{font-size:11px;margin-left:2px}.subtitleSelections{font-size:12px;color:var(--main-blue);display:block;font-weight:700}.listOperators{position:relative;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr}.containerDropDown{border:.5px solid var(--main-gray)}.listOperators>div{padding-right:15px}.listOperators>div:nth-child(2n){padding-right:0}.contentBoxSection{margin-top:12px}.contentBoxSection:first-child{margin-top:0}.dropdown-toggle i{font-size:9px;margin-left:5px}.border-gray-bottom{border-bottom:1px solid gray;display:block;margin-top:16px}.cs-DataArea .cs-client{margin-top:10px}\n"] }]
5905
+ }], ctorParameters: () => [], propDecorators: { setFilter: [{
5906
+ type: Input
5907
+ }], title: [{
5908
+ type: Input
5909
+ }], subTitle: [{
5910
+ type: Input
5911
+ }], showFilterHead: [{
5912
+ type: Input
5913
+ }], addGlobal: [{
5914
+ type: Input
5915
+ }], helperId: [{
5916
+ type: Input
5917
+ }], changeCboTitle: [{
5918
+ type: Output
5919
+ }], showAlterFilterHead: [{
5920
+ type: Input
5921
+ }], subShowAlterFilterHead: [{
5922
+ type: Input
5923
+ }], alterFilterValues: [{
5924
+ type: Input
5925
+ }], alterFilterValue: [{
5926
+ type: Input
5927
+ }], subAlterFilterValues: [{
5928
+ type: Input
5929
+ }], subAlterFilterValue: [{
5930
+ type: Input
5931
+ }], bankIdListAvaliable: [{
5932
+ type: Input
5933
+ }], isInternal: [{
5934
+ type: Input
5935
+ }], currentUser: [{
5936
+ type: Input
5937
+ }], applyFilterClick: [{
5938
+ type: Output
5939
+ }], clearFilterClick: [{
5940
+ type: Output
5941
+ }] } });
5942
+
5351
5943
  class CheckboxFilterDirective extends FilterDirective {
5352
5944
  constructor() {
5353
5945
  super(FilterTypeEnum.Checkbox);
@@ -5832,7 +6424,7 @@ class HtmlToExcelService {
5832
6424
  horizontal: "center",
5833
6425
  wrapText: true,
5834
6426
  };
5835
- async ExportToExcel(excelName, reportTitle, filterTitle, rowsSerializate, columns, filters, subtitles = [], showTotalRow = false, headerGroups = []) {
6427
+ async ExportToExcel(excelName, reportTitle, filterTitle, rowsSerializate, columns, filters, subtitles = [], showTotalRow = false, headerGroups = [], childKey) {
5836
6428
  const workbook = new Workbook();
5837
6429
  const worksheet = workbook.addWorksheet(reportTitle);
5838
6430
  worksheet.views = [{ showGridLines: false }];
@@ -5840,7 +6432,7 @@ class HtmlToExcelService {
5840
6432
  base64: this.Logo,
5841
6433
  extension: "png",
5842
6434
  });
5843
- this.SetReportPage(rowsSerializate, worksheet, columns, imageId, subtitles, showTotalRow, headerGroups);
6435
+ this.SetReportPage(rowsSerializate, worksheet, columns, imageId, subtitles, showTotalRow, headerGroups, childKey);
5844
6436
  this.SetTitle(worksheet, reportTitle);
5845
6437
  if (filters.length > 0) {
5846
6438
  const worksheetFilter = workbook.addWorksheet(filterTitle);
@@ -5862,9 +6454,13 @@ class HtmlToExcelService {
5862
6454
  };
5863
6455
  titleCell.alignment = this.ColumnAligment;
5864
6456
  }
5865
- SetReportPage(rowsSerializate, worksheet, columns, imageId, subtitles = [], showTotalRow = false, headerGroups = []) {
6457
+ SetReportPage(rowsSerializate, worksheet, columns, imageId, subtitles = [], showTotalRow = false, headerGroups = [], childKey) {
5866
6458
  let columnsCell = [];
5867
6459
  let rows = JSON.parse(rowsSerializate);
6460
+ const isHierarchical = this.DetectsHierarchy(rows, childKey);
6461
+ if (isHierarchical) {
6462
+ rows = this.FlattenRowsForHierarchy(rows, childKey);
6463
+ }
5868
6464
  let isHeaderGood = headerGroups.length > 0;
5869
6465
  const imageRows = 5;
5870
6466
  const numberRows = rows.length;
@@ -5982,24 +6578,60 @@ class HtmlToExcelService {
5982
6578
  startRow++;
5983
6579
  }
5984
6580
  //Inserción de filas
6581
+ const numberColIdx = (() => {
6582
+ const byEmpty = columns.findIndex(c => (c.columnName ?? "").trim() === "");
6583
+ if (byEmpty !== -1)
6584
+ return byEmpty;
6585
+ const isNumDisplay = (s) => (s ?? "").trim().toLowerCase().replace("º", "°") === "n°";
6586
+ const byDisplay = columns.findIndex(c => isNumDisplay(c.displayColumnName));
6587
+ const byColumnName = columns.findIndex(c => isNumDisplay(c.columnName));
6588
+ const i = byDisplay !== -1 ? byDisplay : byColumnName;
6589
+ return i; // -1 si no hay numeración
6590
+ })(); // Detecta la columna de numeración ("", "N°" o "Nº") si existe
6591
+ const hasNumbering = numberColIdx !== -1;
6592
+ // Columna a indentar:
6593
+ let indentColIdx = null;
6594
+ if (hasNumbering && numberColIdx + 1 < columns.length) {
6595
+ indentColIdx = numberColIdx + 1;
6596
+ }
6597
+ else {
6598
+ const nameIdx = columns.findIndex(c => (c.columnName ?? "").trim().toLowerCase() === "name" ||
6599
+ (c.displayColumnName ?? "").trim().toLowerCase().includes("name"));
6600
+ if (nameIdx !== -1)
6601
+ indentColIdx = nameIdx;
6602
+ }
5985
6603
  for (let rowIndex = 0; rowIndex < numberRows; rowIndex++) {
5986
6604
  const rowValues = [];
5987
6605
  for (let colIndex = 0; colIndex < columns.length; colIndex++) {
5988
- rowValues.push(colIndex === 0 ? `${rowIndex + 1}` : rows[rowIndex][columns[colIndex].columnName] ?? "");
6606
+ if (hasNumbering && colIndex === numberColIdx) {
6607
+ rowValues.push(isHierarchical ? rows[rowIndex].__hier : (rowIndex + 1));
6608
+ }
6609
+ else {
6610
+ rowValues.push(rows[rowIndex][columns[colIndex].columnName] ?? "");
6611
+ }
5989
6612
  }
5990
6613
  const insertedRow = worksheet.addRow(rowValues);
5991
6614
  insertedRow.eachCell((cell, colNumber) => {
5992
6615
  const col = columns[colNumber - 1];
5993
- if (col.formatNumber) {
5994
- cell.numFmt = this.GetNumberFormat(col.formatNumber);
5995
- cell.value = Number(cell.value);
6616
+ if (col?.formatNumber) {
6617
+ const fmt = this.GetNumberFormat(col.formatNumber);
6618
+ if (fmt)
6619
+ cell.numFmt = fmt;
5996
6620
  }
5997
6621
  cell.alignment = {
5998
6622
  vertical: "middle",
5999
- horizontal: col.alignHorizontal ?? "left",
6623
+ horizontal: col?.alignHorizontal ?? "left",
6000
6624
  wrapText: true,
6001
6625
  };
6002
6626
  });
6627
+ // Indentación: si hay jerarquía y hay columna definida para indentar
6628
+ if (isHierarchical && indentColIdx !== null && indentColIdx < columns.length) {
6629
+ const indentCell = insertedRow.getCell(indentColIdx + 1); // 1-based
6630
+ indentCell.alignment = {
6631
+ ...(indentCell.alignment ?? {}),
6632
+ indent: Math.min(rows[rowIndex].__level, 10),
6633
+ };
6634
+ }
6003
6635
  }
6004
6636
  //Formato nombre de columnas
6005
6637
  columnsCell.forEach(cellRef => {
@@ -6035,6 +6667,13 @@ class HtmlToExcelService {
6035
6667
  name: "Arial",
6036
6668
  size: 10,
6037
6669
  color: { argb: "203764" },
6670
+ ...(isHierarchical
6671
+ ? (() => {
6672
+ const dataIndex = rowIndex - firstDataRow;
6673
+ const hasKids = rows?.[dataIndex]?.__hasChildren;
6674
+ return hasKids ? { bold: true } : {};
6675
+ })()
6676
+ : {}),
6038
6677
  };
6039
6678
  });
6040
6679
  });
@@ -6149,7 +6788,7 @@ class HtmlToExcelService {
6149
6788
  rows.forEach((rowData, rowIndex) => {
6150
6789
  const rowValues = allColumns.map((col, colIndex) => {
6151
6790
  if (orderColumn && colIndex === 0) {
6152
- return (rowIndex + 1).toString();
6791
+ return (rowIndex + 1);
6153
6792
  }
6154
6793
  const originalColIndex = orderColumn ? colIndex - 1 : colIndex;
6155
6794
  return rowData[columns[originalColIndex].columnName]?.toString() || "";
@@ -6197,6 +6836,28 @@ class HtmlToExcelService {
6197
6836
  };
6198
6837
  return formats[formatNumber] || "";
6199
6838
  }
6839
+ FlattenRowsForHierarchy(rows, childKey = "details", path = []) {
6840
+ const flat = [];
6841
+ rows?.forEach((item, idx) => {
6842
+ const seq = [...path, idx + 1];
6843
+ const hasChildren = Array.isArray(item?.[childKey]) && item[childKey].length > 0;
6844
+ const copy = { ...item };
6845
+ delete copy[childKey];
6846
+ flat.push({
6847
+ ...copy,
6848
+ __hier: seq.join("."), // "1" | "1.1" | "2.2.1" ...
6849
+ __level: seq.length - 1, // 0 = raíz, 1 = hijo, 2 = nieto...
6850
+ __hasChildren: hasChildren // para formateo en negrita
6851
+ });
6852
+ if (hasChildren) {
6853
+ flat.push(...this.FlattenRowsForHierarchy(item[childKey], childKey, seq));
6854
+ }
6855
+ });
6856
+ return flat;
6857
+ }
6858
+ DetectsHierarchy(rows, childKey = "details") {
6859
+ return rows?.some(r => Array.isArray(r?.[childKey]) && r[childKey].length > 0) ?? false;
6860
+ }
6200
6861
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: HtmlToExcelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6201
6862
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: HtmlToExcelService, providedIn: "root" });
6202
6863
  }
@@ -9190,5 +9851,5 @@ const IntelicaTheme = definePreset(Aura, {
9190
9851
  * Generated bundle index. Do not edit.
9191
9852
  */
9192
9853
 
9193
- export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
9854
+ export { ActionDirective, ActionsMenuComponent, ButtonSplitComponent, CheckboxFilterDirective, Color, ColumnComponent, ColumnGroupComponent, CompareByField, ConfigService, CookieAttributesGeneral, DataDirective, DateFilterDirective, DateModeOptions, DynamicInputValidation, EchartComponent, EchartService, ElementService, EmailInputValidation, ErrorInterceptor, FeatureFlagService, FilterChipsComponent, FiltersComponent, FormatAmountPipe, GetCookieAttributes, GlobalFeatureFlagService, GlobalTermService, HtmlToExcelService, InitializeConfigService, InputValidation, IntelicaCellCheckboxDirective, IntelicaTheme, ItemSplitDirective, LanguageService, MatrixColumnComponent, MatrixColumnGroupComponent, MatrixTableComponent, ModalDialogComponent, MultiSelectComponent, OrderConstants, PaginatorComponent, Patterns, PopoverComponent, ProfileService, RecordPerPageComponent, RefreshTokenInterceptor, RouteGuard, RowResumenComponent, RowResumenTreeComponent, SearchComponent, SelectDetailFilterDirective, SelectFilterDirective, SharedService, SkeletonChartComponent, SkeletonComponent, SkeletonService, SkeletonTableComponent, SortingComponent, SpinnerComponent, SpinnerService, SweetAlertService, TableComponent, TableFetchComponent, TableSortOrder, TemplateDirective, TemplateMenuComponent, TermGuard, TermPipe, TermService, TextAreaFilterDirective, TextFilterDirective, TextRangeFilterDirective, TitlesComponent, TreeColumnComponent, TreeColumnGroupComponent, TreeTableComponent, TruncatePipe, decryptData, encryptData, getColor };
9194
9855
  //# sourceMappingURL=intelica-library-ui.mjs.map