Skip to content

Commit

Permalink
enterprises: smoother entries counting (fixes #6950) (#7738)
Browse files Browse the repository at this point in the history
Co-authored-by: mutugiii <[email protected]>
Co-authored-by: dogi <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2024
1 parent 911586e commit cc76f66
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.15.37",
"version": "0.15.38",
"myplanet": {
"latest": "v0.20.86",
"min": "v0.19.86"
Expand Down
5 changes: 3 additions & 2 deletions src/app/shared/table-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const filterSpecificFields = (filterFields: string[]): any => {
const normalizedFilter = filter.trim().toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '');
for (let i = 0; i < filterFields.length; i++) {
const fieldValue = getProperty(data, filterFields[i]);
if (typeof fieldValue === 'string' &&
if (typeof fieldValue === 'string' &&
fieldValue.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').indexOf(normalizedFilter) > -1) {
return true;
}
Expand All @@ -47,7 +47,8 @@ export const filterSpecificFields = (filterFields: string[]): any => {

export const filterSpecificFieldsByWord = (filterFields: string[]): any => {
return (data: any, filter: string) => {
const words = filter.split(' ').map(value => value.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '')); // Normalize each word
// Normalize each word
const words = filter.split(' ').map(value => value.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, ''));
return words.every(word => {
return filterFields.some(field => {
const fieldValue = getProperty(data, field);
Expand Down
5 changes: 4 additions & 1 deletion src/app/teams/teams-view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,15 @@ <h3 *ngIf="mode==='services'" class="margin-lr-3 ellipsis-title">{{configuration
</mat-tab>
<mat-tab *ngIf="mode!=='team'">
<ng-template mat-tab-label>
<ng-container i18n>Finances</ng-container>
<ng-container i18n>Finances</ng-container> ({{ financesCount }})
</ng-template>
<planet-teams-view-finances [finances]="finances" [team]="team" [getMembers]="getMembers" (financesChanged)="resetData()" [editable]="userStatus === 'member'"></planet-teams-view-finances>
</mat-tab>
</ng-container>
<mat-tab *ngIf="mode==='enterprise'" i18n-label label="Reports">
<ng-template mat-tab-label>
<ng-container i18n>Reports</ng-container> ({{ reportsCount }})
</ng-template>
<planet-teams-reports [reports]="reports" [editable]="userStatus === 'member'" [team]="team" (reportsChanged)="resetData()"></planet-teams-reports>
</mat-tab>
<ng-container *ngIf="team?.public === true || userStatus === 'member'">
Expand Down
4 changes: 4 additions & 0 deletions src/app/teams/teams-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export class TeamsViewComponent implements OnInit, AfterViewChecked, OnDestroy {
tabSelectedIndex = 0;
initTab;
taskCount = 0;
reportsCount = 0;
financesCount = 0;
configuration = this.stateService.configuration;
deviceType: DeviceType;
deviceTypes: typeof DeviceType = DeviceType;
Expand Down Expand Up @@ -215,7 +217,9 @@ export class TeamsViewComponent implements OnInit, AfterViewChecked, OnDestroy {
this.requests = docsWithName.filter(mem => mem.docType === 'request');
this.disableAddingMembers = this.members.length >= this.team.limit;
this.finances = docs.filter(doc => doc.docType === 'transaction');
this.financesCount = this.finances.length;
this.reports = docs.filter(doc => doc.docType === 'report').sort((a, b) => (b.startDate - a.startDate) || (a.endDate - b.endDate));
this.reportsCount = this.reports.length;
this.setStatus(this.team, this.leader, this.userService.get());
this.setTasks(this.tasks);
return this.teamsService.getTeamResources(docs.filter(doc => doc.docType === 'resourceLink'));
Expand Down

0 comments on commit cc76f66

Please sign in to comment.