Skip to content

Commit

Permalink
Merge branch 'release-v5.0.3-nvsk' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
pandutibil committed Nov 8, 2023
2 parents 5bb1378 + 9364a4f commit cf7bcfd
Show file tree
Hide file tree
Showing 40 changed files with 1,177 additions and 142 deletions.
20 changes: 19 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var routes: Routes = [];
if (environment.loginNeeded) {
routes = [
{
path: '/', redirectTo: `summary-statistics`, pathMatch: 'full'
path: '', redirectTo: `summary-statistics`, pathMatch: 'full'
},
{
path: 'public', redirectTo: 'summary-statistics', pathMatch: 'full'
Expand Down Expand Up @@ -150,6 +150,15 @@ if (environment.loginNeeded) {
canLoad: [AuthGuard],
data: { nameSpace: 'nipun_bharat' }
},
{
path: 'pmShri',
loadChildren: () =>
import('./views/pm-shri/pm-shri.module').then(
(module) => module.PmShriModule
),
canLoad: [AuthGuard],
data: { nameSpace: 'pm_shri' }
},
],
},
];
Expand Down Expand Up @@ -320,6 +329,15 @@ else {
canLoad: [AuthGuard],
data: { nameSpace: 'nipun_bharat' }
},
{
path: 'pmShri',
loadChildren: () =>
import('./views/pm-shri/pm-shri.module').then(
(module) => module.PmShriModule
),
canLoad: [AuthGuard],
data: { nameSpace: 'pm_shri' }
},
],
},
];
Expand Down
7 changes: 3 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, HostListener } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError, Event, ActivatedRoute } from '@angular/router';
import { filter, map } from 'rxjs/operators';
import { Title } from '@angular/platform-browser';
Expand All @@ -18,7 +17,7 @@ declare var dataLayer: Array<any>;
export class AppComponent {
title = 'cQube National';
loadingDataImg: boolean = false;
constructor(private translate: TranslateService, private titleService: Title,
constructor(private titleService: Title,
private router: Router, private activatedRoute: ActivatedRoute, public config: AppConfig, private http: HttpClient, private pageTrackerService: PageTrackerService) {
// translate.setDefaultLang('en');
// translate.use('en');
Expand All @@ -45,7 +44,7 @@ export class AppComponent {
router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
if (event.url !== '/login') {
this.pageTrackerService.onPageChange(event);
//this.pageTrackerService.onPageChange(event);
}
}
});
Expand Down Expand Up @@ -112,7 +111,7 @@ export class AppComponent {
@HostListener('window:beforeunload', ['$event'])
handleUnload(event: Event): void {
if (this.router.url !== '/login') {
this.pageTrackerService.onPageChange(event);
//this.pageTrackerService.onPageChange(event);
}
}
}
7 changes: 5 additions & 2 deletions src/app/core/config/configMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {config as quiz} from '../../views/ncert-quiz/config/quiz_config';
import{config as microImprovement} from '../../views/micro-improvements/config/microimprovements_config';
import {config as nipunBharatConfig } from '../../views/nipun-bharat/config/nipun_bharat_config';
import { config as telemetryConfig} from '../../views/telemetry/config/telemetry_config';
import {config as pmShriConfig } from '../../views/pm-shri/config/pm_shri_config';

export const configFiles = {
std_att: studentAttendaceConfig,
Expand All @@ -33,8 +34,8 @@ export const configFiles = {
quiz:quiz,
micro_improvements:microImprovement,
nipun_bharat:nipunBharatConfig,
telemetry:telemetryConfig

telemetry:telemetryConfig,
pm_shri: pmShriConfig
};

export const programFolderNames = {
Expand All @@ -51,6 +52,7 @@ export const programFolderNames = {
ncf:'ncf',
quiz:'quiz',
microImprovement:'microImprovement',
pmShri: 'pm_shri'
}

export const stateProgramsFolderNames = {
Expand All @@ -67,4 +69,5 @@ export const stateProgramsFolderNames = {
ncf:'',
quiz:'',
microImprovement:'',
pmShri: ''
}
2 changes: 0 additions & 2 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { MatTooltipModule, MatTooltipDefaultOptions, MAT_TOOLTIP_DEFAULT_OPTIONS
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { TranslocoCoreModule } from './transloco/transloco.module';
import { RouterModule } from '@angular/router';

import { LayoutComponent } from './components/layout/layout.component';
Expand Down Expand Up @@ -38,7 +37,6 @@ const DECLARATIONS = [
imports: [
CommonModule,
RouterModule,
TranslocoCoreModule,
NgxSpinnerModule,
MatTooltipModule,
IMPORTS
Expand Down
55 changes: 27 additions & 28 deletions src/app/core/services/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,31 @@ export class DataService {
return new Promise((resolve, reject) => {
this.spinner.show();
let { bigNumber } = options ?? {};
let { valueSuffix, property, title } = bigNumber ?? {};
let { valueSuffix, property, title, formatter } = bigNumber ?? {};
let reportData = {
...prevReportData,
valueSuffix: valueSuffix,
reportName: title
valueSuffix,
reportName: title,
formatter
}
if (indicator === 'averagePercentage') {

if (query === "" || isNaN(Number(query))) {
this._commonService.getReportDataNew(query).subscribe((res: any) => {
if (res) {
let rows = res;
reportData = {
...reportData,
averagePercentage: rows[0]?.[property]
[indicator]: rows[0]?.[property]
}
resolve(reportData)
}
})
}
else if (indicator === 'differencePercentage') {
this._commonService.getReportDataNew(query).subscribe((res: any) => {
if (res) {
let rows = res;
reportData = {
...reportData,
differencePercentage: rows[0]?.[property]
}
resolve(reportData)
}
})
});
} else {
reportData = {
...reportData,
[indicator]: !isNaN(Number(query)) ? Number(query) : query
}
resolve(reportData)
}
this.spinner.hide()
});
Expand Down Expand Up @@ -321,6 +317,10 @@ export class DataService {
tooltip: row.tooltip ? row.tooltip : this._wrapperService.constructTooltip(tooltipMetrics, row, metricFilter ? metricFilter.value : indicator)
};

if (indicator) {
row.indicator = isNaN(row[indicator]) ? row[indicator] : Number(row[indicator]);
}

return row;
}),
options: {
Expand Down Expand Up @@ -458,9 +458,8 @@ export class DataService {

mapGroupBy(data: any, groupByLabel: any, metricLabelProp: string, metricValueProp: string, tooltipMetrics: any, metricFilterValue: any) {
let result = _.chain(data).groupBy(groupByLabel).map((objs, key) => {
data = {
[groupByLabel]: key,
}
let row = objs.find(obj => obj[metricLabelProp] === metricFilterValue)

objs?.forEach((obj: any, index: any) => {
let modifiedTooltipMetrics = tooltipMetrics.filter(metric => metricLabelProp === metric.value).map((metric: any) => {
return {
Expand All @@ -469,18 +468,18 @@ export class DataService {
value: obj[metricLabelProp]
}
})
data = {
...data,
...obj,
// district_code: obj['district_id'] ? Number(obj['district_id']) : null,

row = {
...row,
[obj[metricLabelProp]]: obj[metricValueProp]
}

if (index === 0) {
data['tooltip'] = this._wrapperService.constructTooltip(tooltipMetrics.filter(metric => metricLabelProp !== metric.value), data, metricFilterValue)
row['tooltip'] = this._wrapperService.constructTooltip(tooltipMetrics.filter(metric => metricLabelProp !== metric.value), row, metricFilterValue)
}
data['tooltip'] += this._wrapperService.constructTooltip(modifiedTooltipMetrics, data, metricFilterValue)
row['tooltip'] += this._wrapperService.constructTooltip(modifiedTooltipMetrics, row, metricFilterValue)
});
return data;
return row;
}).value()
return result;
}
Expand Down
32 changes: 0 additions & 32 deletions src/app/core/transloco/transloco.http-loader.ts

This file was deleted.

50 changes: 0 additions & 50 deletions src/app/core/transloco/transloco.module.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/app/shared/components/big-number/big-number.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ export class BigNumberComponent implements OnInit, OnChanges {
differenceInPercentage: any;
differenceIndicator: any= undefined;
valueSuffix: any;
formatter: any;

constructor() { }

ngOnInit(): void {

}

ngOnChanges(): void {
this.updateValues();
}

updateValues(): void {
this.formatter = this.bigNumberReportData?.formatter;
this.averagePercentage = this.bigNumberReportData?.averagePercentage;
this.valueSuffix = this.bigNumberReportData?.valueSuffix ? this.bigNumberReportData?.valueSuffix : '';
if(this.bigNumberReportData && this.bigNumberReportData.differencePercentage && this.bigNumberReportData.averagePercentage) {
Expand All @@ -42,7 +44,7 @@ export class BigNumberComponent implements OnInit, OnChanges {
}

formatNumber(input: any) {
return formatNumberForReport(Number(input))
return formatNumberForReport(Number(input), this.formatter);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[name]="'filter-'+filter.name" [multiple]="isFilterMulti()" [closeOnSelect]="false"
placeholder="Select {{filter.name}}" [clearable]="resetOthers" [(ngModel)]="filter.value"
(ngModelChange)="onSelectOption($event, i, selectRef)" appChange>
<ng-option *ngFor="let option of filter.options" [value]="option.value">{{ option.label }}</ng-option>
<ng-option *ngFor="let option of filter.options" [value]="option.value">{{ convertNativeMetricLabelToReadable(option.label) }}</ng-option>
</ng-select>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ export class FilterPanelComponent implements OnInit, OnChanges {
isFilterMulti(): boolean {
return this.isMulti;
}

convertNativeMetricLabelToReadable(label: string): string {
if (typeof label !== 'string') {
return label;
}

return label.split('_').map(word => word[0]?.toUpperCase() + word?.substring(1).toLowerCase()).join(' ')
}
}
13 changes: 7 additions & 6 deletions src/app/utilities/NumberFomatter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { environment } from "src/environments/environment";

function formatNumber(number: number, config: any): string {
function formatNumber(number: number, formatter: any): string {

if (config.format === 'short') {
if (config.locale === 'en-IN') {
if (formatter.format === 'short') {
if (formatter.locale === 'en-IN') {
if (number < 1000) {
return `${number}`;
} else if (number > 999 && number <= 99999) {
Expand All @@ -26,7 +26,7 @@ function formatNumber(number: number, config: any): string {
}
}

return new Intl.NumberFormat(config.locale).format(number);
return new Intl.NumberFormat(formatter.locale).format(number);
}

function numberLabelFormat(number: number, config: any, axisRef?: any): string {
Expand Down Expand Up @@ -89,8 +89,9 @@ function removeFormat(string, config) {

}

export function formatNumberForReport(number: number): string {
return formatNumber(number, environment.numberFormat.reports);
export function formatNumberForReport(number: number, formatter?: any): string {
formatter = formatter ? formatter : environment.numberFormat.reports;
return formatNumber(number, formatter);
}

export function numberLabelFormatForReport(number: number, axisRef?: any): string {
Expand Down
Loading

0 comments on commit cf7bcfd

Please sign in to comment.