@@ -16,7 +16,7 @@ export default Component.extend(FormMixin, {
1616 } ) ,
1717
1818 shouldDisableOrderButton : computed ( 'isUnverified' , 'hasTicketsInOrder' , function ( ) {
19- return ! this . hasTicketsInOrder ;
19+ return ! this . hasTicketsInOrder || ! this . donationPriceValid ;
2020 } ) ,
2121
2222 showTaxIncludedMessage : computed ( 'taxInfo.isTaxIncludedInPrice' , function ( ) {
@@ -40,6 +40,21 @@ export default Component.extend(FormMixin, {
4040 ) > 0 ;
4141 } ) ,
4242
43+ donationTickets : computed ( function ( ) {
44+ return this . data . filterBy ( 'type' , 'donation' ) ;
45+ } ) ,
46+
47+ donationPriceValid :
computed ( '[email protected] ' , '[email protected] ' , function ( ) { 48+ if ( this . donationTickets ) {
49+ return sumBy ( this . donationTickets . toArray ( ) ,
50+ donationTicket => ( donationTicket . price )
51+ ) > 0 ;
52+ } else {
53+ return true ;
54+ }
55+
56+ } ) ,
57+
4358 total :
computed ( '[email protected] ' , '[email protected] ' , function ( ) { 4459 if ( this . taxInfo !== null ) {
4560 return sumBy ( this . tickets . toArray ( ) ,
@@ -190,6 +205,19 @@ export default Component.extend(FormMixin, {
190205 prompt : this . l10n . t ( 'Please enter the promotional Code' )
191206 }
192207 ]
208+ } ,
209+ price : {
210+ identifier : 'price' ,
211+ rules : [
212+ {
213+ type : 'number' ,
214+ prompt : this . l10n . t ( 'Invalid number' )
215+ } ,
216+ {
217+ type : 'integer[1..]' ,
218+ prompt : this . l10n . t ( 'Ticket price should be greater than 0' )
219+ }
220+ ]
193221 }
194222 }
195223 } ;
0 commit comments