@@ -54,7 +60,7 @@
Campaigns
{{
getProject(campaign.project.id).peopleGivingTimeRef.length }} / 3 |
{{ campaign.totalDonations.toFixed(2) }} € |
-
{{ campaign.donationsRequired.toFixed(2) }} € |
+
{{ campaign.totalRequired.toFixed(2) }} € |
In Progress
@@ -191,4 +197,18 @@ Accounts State
-
\ No newline at end of file
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/app/report/report.component.ts b/src/app/app/report/report.component.ts
index d8c1053..a1c487c 100644
--- a/src/app/app/report/report.component.ts
+++ b/src/app/app/report/report.component.ts
@@ -1,9 +1,10 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, TemplateRef } from '@angular/core';
import { UntypedFormBuilder } from '@angular/forms';
-import { Account, Budget, User } from 'src/app/_entities';
+import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
+import { Account, Budget, Content, User } from 'src/app/_entities';
import { AccountModel, CampaignModel, DataPage, ProjectModel } from 'src/app/_models';
import { Pager } from 'src/app/_models/pagination/pager/pager';
-import { AuthenticationService, BudgetService, OrganizationService, PagerService, ProjectService } from 'src/app/_services';
+import { AuthenticationService, BudgetService, ContentService, OrganizationService, PagerService, ProjectService } from 'src/app/_services';
@Component({
selector: 'app-report',
@@ -22,6 +23,10 @@ export class ReportComponent implements OnInit {
budget: [0]
});
+ // Rules Modal
+ viewRulesModal = new BsModalRef();
+ rules = new Content();
+
// Campaigns Box
private rawProjectsResponse = new DataPage();
campaignPager = new Pager();
@@ -37,12 +42,14 @@ export class ReportComponent implements OnInit {
accountsSyncStatus = 'idle';
constructor(
+ private modalService: BsModalService,
+ private fb: UntypedFormBuilder,
private authenticationService: AuthenticationService,
private budgetService: BudgetService,
+ private contentService: ContentService,
private organizationService: OrganizationService,
private projectService: ProjectService,
- private pagerService: PagerService,
- private fb: UntypedFormBuilder) { }
+ private pagerService: PagerService) { }
ngOnInit() {
this.refresh();
@@ -56,7 +63,7 @@ export class ReportComponent implements OnInit {
});
this.selectBudgetForm.controls['budget'].valueChanges.subscribe(val => {
const budgetFound = this.budgets.find(budget => budget.id === +val);
- if(budgetFound !== undefined) {
+ if (budgetFound !== undefined) {
this.budget = budgetFound;
this.budgetUsage = this.computeNumberPercent(this.budget.totalDonations, this.authenticationService.currentOrganizationValue.membersRef.length * this.budget.amountPerMember) + "%";
this.refreshCampaigns(this.campaignPager.currentPage);
@@ -69,32 +76,39 @@ export class ReportComponent implements OnInit {
if (this.pagerService.canChangePage(this.campaignPager, page)) {
this.campaignsSyncStatus = 'running';
this.budgetService.getCampaigns(this.selectBudgetForm.controls['budget'].value, page - 1, this.campaignsPageSize)
- .subscribe(response => {
- this.rawProjectsResponse = response;
- this.setCampaignsPage(page);
- const projectIds: number[] = [];
- this.pagedCampaigns.forEach(campaign => {
- if(campaign.project.id > 0) {
- projectIds.push(campaign.project.id);
- }
- });
- this.projectService.getAllByIds(projectIds)
- .subscribe(response => {
- response.forEach(prj => this.projects.set(prj.id, prj))
- },
- error => {
- console.log(error);
+ .subscribe({
+ next: (response) => {
+ this.rawProjectsResponse = response;
+ this.setCampaignsPage(page);
+ const projectIds: number[] = [];
+ this.pagedCampaigns.forEach(campaign => {
+ if (campaign.project.id > 0) {
+ projectIds.push(campaign.project.id);
+ }
});
- this.campaignsSyncStatus = 'success';
- setTimeout(() => {
- this.campaignsSyncStatus = 'idle';
- }, 1000);
- }, error => {
- this.campaignsSyncStatus = 'error';
- console.log(error);
- setTimeout(() => {
- this.campaignsSyncStatus = 'idle';
- }, 1000);
+ this.projectService.getAllByIds(projectIds)
+ .subscribe({
+ next: (response) => response.forEach(prj => this.projects.set(prj.id, prj)),
+ complete: () => { },
+ error: error => {
+ console.log(error);
+ }
+ });
+ this.campaignsSyncStatus = 'success';
+ setTimeout(() => {
+ this.campaignsSyncStatus = 'idle';
+ }, 1000);
+
+ },
+ complete: () => { },
+ error: error => {
+ this.campaignsSyncStatus = 'error';
+ console.log(error);
+ setTimeout(() => {
+ this.campaignsSyncStatus = 'idle';
+ }, 1000);
+
+ }
});
}
}
@@ -147,7 +161,7 @@ export class ReportComponent implements OnInit {
getProject(id: number): ProjectModel {
let entity = this.projects.get(id);
- if(entity === undefined) {
+ if (entity === undefined) {
entity = new ProjectModel();
}
return entity;
@@ -159,4 +173,12 @@ export class ReportComponent implements OnInit {
}
return 100 * number / max;
}
+
+ onViewTermsOfUse(template: TemplateRef) {
+ this.contentService.getById(this.budget.rules.id)
+ .subscribe(content => {
+ this.rules = Content.fromModel(content);
+ this.viewRulesModal = this.modalService.show(template);
+ });
+ }
}
diff --git a/src/locale/messages.fr.xlf b/src/locale/messages.fr.xlf
index e790c6b..db345cc 100644
--- a/src/locale/messages.fr.xlf
+++ b/src/locale/messages.fr.xlf
@@ -68,6 +68,9 @@
Coût d'une heure
+
+ Règles d'utilisation
+
Certains champs ont été désactivés car le budget est déjà distribué entre les membres de l'organisation.
@@ -562,6 +565,12 @@
Je souhaite porter la réalisation de cette idée
+
+ Règles associées
+
+
+ Afficher les règles
+
Utilisation
diff --git a/src/locale/messages.xlf b/src/locale/messages.xlf
index d91bf97..ee5df89 100644
--- a/src/locale/messages.xlf
+++ b/src/locale/messages.xlf
@@ -110,7 +110,7 @@
src/app/app/profile/profile.component.html
- 53
+ 52
src/app/app/projects/view/view-project.component.html
@@ -209,6 +209,13 @@
127
+
+
+
+ src/app/app/budgets/budgets.component.html
+ 158
+
+
@@ -224,12 +231,16 @@
src/app/app/profile/profile.component.html
- 157
+ 156
src/app/app/projects/view/view-project.component.html
536
+
+ src/app/app/report/report.component.html
+ 212
+
@@ -251,7 +262,7 @@
src/app/app/profile/profile.component.html
- 119
+ 118
src/app/app/projects/edit/edit-project.component.html
@@ -299,7 +310,7 @@
src/app/app/profile/profile.component.html
- 51
+ 50
src/app/app/projects/edit/edit-project.component.html
@@ -419,11 +430,11 @@
src/app/app/profile/profile.component.html
- 100
+ 99
src/app/app/profile/profile.component.html
- 101
+ 100
src/app/app/users/users.component.html
@@ -487,11 +498,11 @@
src/app/app/report/report.component.html
- 78
+ 84
src/app/app/report/report.component.html
- 158
+ 164
src/app/app/users/users.component.html
@@ -522,11 +533,11 @@
src/app/app/report/report.component.html
- 80
+ 86
src/app/app/report/report.component.html
- 160
+ 166
src/app/app/users/users.component.html
@@ -557,11 +568,11 @@
src/app/app/report/report.component.html
- 82
+ 88
src/app/app/report/report.component.html
- 162
+ 168
src/app/app/users/users.component.html
@@ -592,11 +603,11 @@
src/app/app/report/report.component.html
- 84
+ 90
src/app/app/report/report.component.html
- 164
+ 170
src/app/app/users/users.component.html
@@ -819,14 +830,14 @@
src/app/app/profile/profile.component.html
- 47
+ 46
src/app/app/profile/profile.component.html
- 52
+ 51
src/app/app/projects/edit/edit-project.component.html
@@ -841,49 +852,49 @@
src/app/app/profile/profile.component.html
- 61
+ 60
src/app/app/profile/profile.component.html
- 62
+ 61
src/app/app/profile/profile.component.html
- 63
+ 62
src/app/app/profile/profile.component.html
- 64
+ 63
src/app/app/profile/profile.component.html
- 65
+ 64
src/app/app/profile/profile.component.html
- 71
+ 70
src/app/app/profile/profile.component.html
- 75
+ 74
src/app/app/projects/view/view-project.component.html
@@ -906,7 +917,7 @@
src/app/app/profile/profile.component.html
- 76
+ 75
src/app/app/projects/view/view-project.component.html
@@ -917,14 +928,14 @@
src/app/app/profile/profile.component.html
- 77
+ 76
src/app/app/profile/profile.component.html
- 78
+ 77
src/app/app/projects/view/view-project.component.html
@@ -939,14 +950,14 @@
src/app/app/profile/profile.component.html
- 97
+ 96
src/app/app/profile/profile.component.html
- 104
+ 103
src/app/app/users/users.component.html
@@ -961,7 +972,7 @@
src/app/app/profile/profile.component.html
- 105
+ 104
src/app/app/users/users.component.html
@@ -972,11 +983,11 @@
src/app/app/profile/profile.component.html
- 108
+ 107
src/app/app/profile/profile.component.html
- 109
+ 108
src/app/app/users/users.component.html
@@ -991,11 +1002,11 @@
src/app/app/profile/profile.component.html
- 112
+ 111
src/app/app/profile/profile.component.html
- 113
+ 112
src/app/app/users/users.component.html
@@ -1010,11 +1021,11 @@
src/app/app/profile/profile.component.html
- 116
+ 115
src/app/app/profile/profile.component.html
- 117
+ 116
src/app/app/users/users.component.html
@@ -1029,21 +1040,21 @@
src/app/app/profile/profile.component.html
- 122
+ 121
src/app/app/profile/profile.component.html
- 143
+ 142
src/app/app/profile/profile.component.html
- 148
+ 147
@@ -1612,95 +1623,109 @@
576
+
+
+
+ src/app/app/report/report.component.html
+ 12
+
+
+
+
+
+ src/app/app/report/report.component.html
+ 13
+
+
src/app/app/report/report.component.html
- 12
+ 18
src/app/app/report/report.component.html
- 24
+ 30
src/app/app/report/report.component.html
- 37
+ 43
src/app/app/report/report.component.html
- 38
+ 44
src/app/app/report/report.component.html
- 39
+ 45
src/app/app/report/report.component.html
- 40
+ 46
src/app/app/report/report.component.html
- 41
+ 47
src/app/app/report/report.component.html
- 42
+ 48
src/app/app/report/report.component.html
- 43
+ 49
src/app/app/report/report.component.html
- 60
+ 66
src/app/app/report/report.component.html
- 62
+ 68
src/app/app/report/report.component.html
- 64
+ 70
src/app/app/report/report.component.html
- 121
+ 127
|