@@ -15,8 +15,8 @@ export default Component.extend(FormMixin, {
1515 && ! this . get ( 'authManager.currentUser.isVerified' ) ;
1616 } ) ,
1717
18- shouldDisableOrderButton : computed ( 'isUnverified ' , 'hasTicketsInOrder ' , function ( ) {
19- return ! this . hasTicketsInOrder ;
18+ shouldDisableOrderButton : computed ( 'hasTicketsInOrder ' , 'isDonationPriceValid ' , function ( ) {
19+ return ! ( this . hasTicketsInOrder && this . isDonationPriceValid ) ;
2020 } ) ,
2121
2222 showTaxIncludedMessage : computed ( 'taxInfo.isTaxIncludedInPrice' , function ( ) {
@@ -40,6 +40,24 @@ export default Component.extend(FormMixin, {
4040 ) > 0 ;
4141 } ) ,
4242
43+ donationTickets : computed ( 'data' , function ( ) {
44+ return this . data . filterBy ( 'type' , 'donation' ) ;
45+ } ) ,
46+
47+ isDonationPriceValid :
computed ( 'donationTickets' , '[email protected] ' , '[email protected] ' , function ( ) { 48+ let returnValue = false ;
49+ this . donationTickets . forEach ( donationTicket => {
50+ if ( donationTicket . get ( 'orderQuantity' ) >= 0 ) {
51+ if ( donationTicket . get ( 'price' ) > 0 ) {
52+ returnValue = true ;
53+ } else {
54+ returnValue = false ;
55+ }
56+ }
57+ } ) ;
58+ return returnValue ;
59+ } ) ,
60+
4361 total :
computed ( '[email protected] ' , '[email protected] ' , function ( ) { 4462 if ( this . taxInfo !== null ) {
4563 return sumBy ( this . tickets . toArray ( ) ,
@@ -190,6 +208,19 @@ export default Component.extend(FormMixin, {
190208 prompt : this . l10n . t ( 'Please enter the promotional Code' )
191209 }
192210 ]
211+ } ,
212+ price : {
213+ identifier : 'price' ,
214+ rules : [
215+ {
216+ type : 'number' ,
217+ prompt : this . l10n . t ( 'Invalid number' )
218+ } ,
219+ {
220+ type : 'integer[1..]' ,
221+ prompt : this . l10n . t ( 'Donation should be greater than 0' )
222+ }
223+ ]
193224 }
194225 }
195226 } ;
0 commit comments