Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Jun 19, 2024
1 parent 60833ae commit 487cf36
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ <h3 [style.margin-left]='(16 * (3-level)) + "px"'>{{item.header}}</h3>
<div class='line'>
<div class='stat'>
<ng-container *ngIf='!item.item.deleted'>
<span class='status complete' *ngIf='item.item.complete'>
<i class="fas fa-check-circle"></i> הסתיים
</span>
<ng-container *ngIf='item.item.complete'>
<ng-container *ngIf='item.item.updated'>
<span class='status complete'>
<i class="fas fa-check-circle"></i> הסתיים
</span>
</ng-container>
<ng-container *ngIf='!item.item.updated'>
<span class='status update-needed'>
<i class="fas fa-check-circle"></i> נדרש עדכון
</span>
</ng-container>
</ng-container>
<span class='status incomplete' *ngIf='!item.item.complete'>
<i class="fas fa-dot-circle "></i> בעבודה
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
.deleted {
color: gray;
}
.update-needed {
color: lightgreen;
}
}
.name {
a {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ export class SocialServiceListItemComponent implements OnChanges {
}
let ret: any = null;
if (item.item) {
const updated = item.item.manualBudget && item.item.manualBudget.length > 0 &&
item.item.manualBudget[0].year >= MAX_YEAR;
const manualBudget = (item.item.manualBudget || []).filter(x => x.approved || x.executed);
const beneficiaries = (item.item.beneficiaries || []).filter(x => x.num_beneficiaries);
const updated = (
manualBudget.length > 0 && manualBudget[0].year >= MAX_YEAR &&
beneficiaries.length > 0 && beneficiaries[0].year >= MAX_YEAR
);
// && (item.item.tenders || []).every((tender) => !tender.survey || tender.survey.submitted);
item.item['updated'] = updated;
const complete = !!item.item.complete && !item.item.deleted;
const keepPrivate = !!item.item.keepPrivate;
const incomplete = !item.item.complete && !item.item.deleted;
Expand Down Expand Up @@ -114,12 +119,12 @@ export class SocialServiceListItemComponent implements OnChanges {

get yearRange() {
const minYear = Math.max(
Math.min(...(this.item.item.budgetItems || []).map(x => x.year)),
Math.min(...(this.item.item.beneficiaries || []).map(x => x.year)),
Math.min(...(this.item.item.manualBudget || []).filter(x => x.approved || x.executed).map(x => x.year)),
Math.min(...(this.item.item.beneficiaries || []).filter(x => x.num_beneficiaries).map(x => x.year)),
);
const maxYear = Math.min(
Math.max(...(this.item.item.budgetItems || []).map(x => x.year)),
Math.max(...(this.item.item.beneficiaries || []).map(x => x.year)),
Math.max(...(this.item.item.manualBudget || []).filter(x => x.approved || x.executed).map(x => x.year)),
Math.max(...(this.item.item.beneficiaries || []).filter(x => x.num_beneficiaries).map(x => x.year)),
);
if (Number.isFinite(minYear) && Number.isFinite(maxYear)) {
return `${minYear} - ${maxYear}`;
Expand Down
11 changes: 7 additions & 4 deletions ui/src/app/social-service-list/item-filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ export class ItemFilterPublished extends ItemFilter {

export class ItemFilterUpdateNeeded extends ItemFilter {
public condition(item: any): boolean {
const tenders = item.tenders || [];
return !item.deleted && item.complete && (
(item.manualBudget && item.manualBudget.length > 0 && item.manualBudget[0].year < MAX_YEAR)
// || tenders.any((tender) => tender.survey && !tender.survey.submitted)
// const tenders = item.tenders || [];
const manualBudget = (item.manualBudget || []).filter(x => x.approved || x.executed);
const beneficiaries = (item.beneficiaries || []).filter(x => x.num_beneficiaries);
const updated = (
manualBudget.length > 0 && manualBudget[0].year >= MAX_YEAR &&
beneficiaries.length > 0 && beneficiaries[0].year >= MAX_YEAR
);
return !item.deleted && item.complete && !updated;
}
}

Expand Down

0 comments on commit 487cf36

Please sign in to comment.