@@ -201,13 +201,13 @@ export class ViewProjectComponent implements OnInit {
201
201
202
202
openContributingModal ( template : TemplateRef < any > , campaign : Campaign ) {
203
203
this . selectedCampaign = campaign ;
204
- this . donationForm . controls . amount . setValidators ( [ Validators . required , Validators . min ( 0 ) , Validators . max (
204
+ this . donationForm . controls . amount . setValidators ( [ Validators . required , Validators . min ( 0.01 ) , Validators . max (
205
205
+ ( this . min ( this . accounts [ this . donationForm . controls . budget . value ] . amount , campaign . donationsRequired - campaign . totalDonations ) ) . toFixed ( 2 ) ) ] ) ;
206
206
this . contributeFinanciallyModalRef = this . modalService . show ( template ) ;
207
207
}
208
208
209
209
onAccountSelectionChange ( ) {
210
- this . donationForm . controls . amount . setValidators ( [ Validators . required , Validators . min ( 0 ) , Validators . max (
210
+ this . donationForm . controls . amount . setValidators ( [ Validators . required , Validators . min ( 0.01 ) , Validators . max (
211
211
+ ( this . min ( this . accounts [ this . donationForm . controls . budget . value ] . amount , this . selectedCampaign . donationsRequired - this . selectedCampaign . totalDonations ) ) . toFixed ( 2 ) ) ] ) ;
212
212
}
213
213
@@ -250,6 +250,10 @@ export class ViewProjectComponent implements OnInit {
250
250
}
251
251
252
252
openAddFundingModal ( template : TemplateRef < any > ) {
253
+ this . campaign = new Campaign ( ) ;
254
+ this . formFunding . controls [ 'budget' ] . enable ( ) ;
255
+ this . formFunding . controls [ 'fundingDeadline' ] . enable ( ) ;
256
+ this . formFunding . controls [ 'donationsRequired' ] . setValidators ( [ Validators . required , Validators . min ( 0.01 ) ] ) ;
253
257
this . nowPlus3Months . setMonth ( this . now . getMonth ( ) + 3 ) ;
254
258
this . fundingDeadlineValue . setMonth ( this . now . getMonth ( ) + 1 ) ;
255
259
this . openFundingModal ( template ) ;
@@ -364,4 +368,9 @@ export class ViewProjectComponent implements OnInit {
364
368
return val1 ;
365
369
}
366
370
}
371
+
372
+ get filterByCampaignBudgets ( ) {
373
+ return this . accounts . filter ( a => this . selectedCampaign . budgetsRef . includes ( a . budget . id ) ) ;
374
+ }
367
375
}
376
+
0 commit comments