-
Notifications
You must be signed in to change notification settings - Fork 2
/
project-details.component.html
260 lines (208 loc) · 12.1 KB
/
project-details.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<main id="main">
<section *ngIf="isLoading; else loaded" class = "spinnerDiv">
<app-spinner></app-spinner>
</section>
<ng-template #loaded>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<br><br>
<div class="container">
<h2>{{project?.name}}</h2>
</div>
</section><!-- End Breadcrumbs -->
<!-- ======= Portfolio Details Section ======= -->
<section id="portfolio-details" class="portfolio-details">
<div class="container">
<div class="row gy-4">
<div class="card border-left-info shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xl font-weight-bold text-info text-uppercase mb-1">Raised Money
</div>
<div class="row no-gutters align-items-center">
<div class="col">
<div class="progress progress-sm mr-2">
<!-- <div class="progress-bar bg-info" role="progressbar" style="width: 10%"
aria-valuenow="{{project.currentAmount}}"
aria-valuemin="0" aria-valuemax="{{project.goal}}"></div>
<script>
var percentage = ({{project.currentAmount}} / {{project.goal}}) * 100;
document.querySelector('.progress-bar').style.width = percentage + '%';
</script> -->
<div class="progress-bar bg-info" role="progressbar" [style.width.%]="calculateProgress()"
[attr.aria-valuenow]="project?.currentAmount"
aria-valuemin="0"
[attr.aria-valuemax]="project?.goal">
</div>
</div>
</div>
<div class="col-auto">
<div class="h5 mb-0 mr-3 font-weight-bold text-gray-800">{{project?.currentAmount}}€ / {{project?.goal}}€
</div>
</div>
</div>
</div>
<div class="col-auto">
<i class="fas fa-dollar-sign fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="row gy-4">
<div class="col-lg-8">
<app-carousel [project]="project"></app-carousel>
</div>
<div class="col-lg-4">
<div class="portfolio-info">
<h3>{{project?.name}}</h3>
<ul>
<li><strong>Category</strong>: {{project?.category}}</li>
<li><strong>Owner</strong>: {{project?.owner}}</li>
<li><strong>Project date</strong>: {{project?.date}}</li>
<li><strong>Project URL</strong>: <a href="#">{{project?.url}}</a></li>
</ul>
</div>
<div class="portfolio-description">
<h2>About this project</h2>
<p>
{{project?.description}} <br><br>
</p>
<div *ngIf="privileged" class="button-container">
<a class="buttonProject" [routerLink]="['/editProject', project.id]">Edit</a>
<a *ngIf="!hasInversions" class="buttonProjectDanger" (click)="deleteProject(project.id)">Delete</a>
<a class="buttonProject" (click)="downloadPdf(this.project.id)">Download PDF</a>
</div>
</div>
</div>
<div class="row">
<!-- Area Chart -->
<div class="col-xl-8 col-lg-7">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="portfolioText">Donations over time</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="chart-area">
<div class="chartjs-size-monitor">
<div class="chartjs-size-monitor-expand">
<div class=""></div>
</div>
<div class="chartjs-size-monitor-shrink">
<div class=""></div>
</div>
</div>
<canvas #myAreaChart width="512" height="400"
style="display: block; height: 320px; width: 410px;"
class="chartjs-render-monitor"></canvas>
</div>
</div>
</div>
</div>
<!-- Pie Chart -->
<div class="col-xl-4 col-lg-5">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="portfolioText">Donations by user</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="chart-pie pt-4 pb-2">
<div class="chartjs-size-monitor">
<div class="chartjs-size-monitor-expand">
<div class=""></div>
</div>
<div class="chartjs-size-monitor-shrink">
<div class=""></div>
</div>
</div>
<canvas #myPieChart width="342" height="306"
style="display: block; height: 245px; width: 274px;"
class="chartjs-render-monitor"></canvas>
</div>
<div class="mt-4 text-center small">
<span class="mr-2">
<i class="fas fa-circle text-primary"></i> Put the cursor over the sector to see the donors
</span>
</div>
</div>
</div>
</div>
</div>
<!-- Sección que solo se muestra si el usuario está autenticado -->
<div *ngIf="user && !owner" id="donationCard">
<div class="container" class="card shadow mb-4">
<div class="donation-card">
<div class="donation-header">
<h2>Help this project grow</h2>
</div>
<div class="donation-body">
<input #donation class="input-group-text" id="howmuch" type="number" min="0" max="10000000" placeholder="0" />
<button class="donation-button" (click)="donate(donation.value, project.id)">Donate Now</button>
</div>
</div>
</div>
</div>
<!-- Comments section, también dependiente de la autenticación del usuario -->
<div class="comments-section">
<h2>Comments</h2>
<div *ngIf="user">
<form (ngSubmit)="submitComment()" class="comment-form">
<textarea name="text" [(ngModel)]="commentText" placeholder="Write your comment here..."></textarea>
<button type="submit">Send</button>
</form>
</div>
</div>
<div class="comment-container">
<div *ngFor="let comment of this.comments" class="comment">
<img class="profile-pic" [src]="comment.user.profileImage" alt="Profile picture">
<div class="comment-author">{{ comment.user.username }}</div>
<div class="comment-text">{{ comment.text }}</div>
<div *ngIf="privileged" class="button-container">
<button class="buttonProjectDanger" (click)="deleteComment(comment.id)">Delete</button>
</div>
</div>
</div>
<div class="row">
<div class="col-12 text-center">
<a id="load-more-comments-btn-rec" class="btn btn-primary" (click)="loadComments(project.id)">Load more</a>
</div>
</div>
</div>
</div>
</section><!-- End Portfolio Details Section -->
</ng-template>
</main><!-- End #main -->
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i
class="bi bi-arrow-up-short"></i></a>
<!-- Bootstrap core JavaScript-->
<script src="/assets2/vendor/jquery/jquery.min.js"></script>
<script src="/assets2/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="/assets2/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="/assets2/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="/assets2/vendor/chart.js/Chart.min.js"></script>
<!-- Page level custom scripts -->
<!-- Template Main JS File -->
<script src="/js/main.js"></script>