Skip to content

Commit 028b405

Browse files
shreyanshdwivedikushthedude
authored andcommitted
feat: implementation of paid route for event invoices (#3350)
1 parent dadc0c7 commit 028b405

File tree

7 files changed

+251
-0
lines changed

7 files changed

+251
-0
lines changed

app/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ router.map(function() {
213213

214214
this.route('event-invoice', function() {
215215
this.route('review', { path: '/:invoice_identifier/review' });
216+
this.route('paid', { path: '/:invoice_identifier/paid' });
216217
});
217218
});
218219

app/routes/event-invoice/paid.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Route from '@ember/routing/route';
2+
3+
export default class extends Route {
4+
5+
titleToken(model) {
6+
let invoice_identifier = model.get('identifier');
7+
return this.l10n.t(`Paid Event Invoice -${invoice_identifier}`);
8+
}
9+
10+
model(params) {
11+
return this.store.findRecord('event-invoice', params.invoice_identifier, {
12+
include : 'event,user',
13+
reload : true
14+
});
15+
}
16+
17+
afterModel(model) {
18+
if (model.get('status') === 'due') {
19+
this.transitionTo('event-invoice.review', model.get('identifier'));
20+
} else if (model.get('status') === 'paid') {
21+
this.transitionTo('event-invoice.paid', model.get('identifier'));
22+
}
23+
}
24+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<div class="ui segments">
2+
<div class="ui secondary segment">
3+
<h3 class="weight-400">{{t 'Billing Info'}}</h3>
4+
</div>
5+
<div class="ui padded segment">
6+
<div class="ui list">
7+
<div class="item">
8+
<strong>{{t 'From'}}:</strong> {{user.billingContactName}}
9+
</div>
10+
<div class="item">
11+
<strong>{{t 'Phone'}}:</strong> {{user.billingPhone}}
12+
</div>
13+
<div class="item">
14+
<strong>{{t 'Email'}}:</strong> {{user.email}}
15+
</div>
16+
<div class="item">
17+
<strong>{{t 'Billing Address'}}:</strong> {{user.billingAddress}}
18+
</div>
19+
<div class="item">
20+
<strong>{{t 'Zip Code'}}:</strong> {{user.billingZipCode}}
21+
</div>
22+
<div class="item">
23+
<strong>{{t 'Country'}}:</strong> {{user.billingCountry}}
24+
</div>
25+
</div>
26+
</div>
27+
<div class="ui padded segment">
28+
<div class="ui list">
29+
<div class="item">
30+
<strong>{{t 'To'}}:</strong> {{this.settings.adminBillingContactName}}
31+
</div>
32+
<div class="item">
33+
<strong>{{t 'Company'}}:</strong> {{this.settings.adminCompany}}
34+
</div>
35+
<div class="item">
36+
<strong>{{t 'Phone'}}:</strong> {{this.settings.adminBillingPhone}}
37+
</div>
38+
<div class="item">
39+
<strong>{{t 'Email'}}:</strong> {{this.settings.adminBillingEmail}}
40+
</div>
41+
<div class="item">
42+
<strong>{{t 'Zip Code'}}:</strong> {{this.settings.adminBillingZip}}
43+
</div>
44+
<div class="item">
45+
<strong>{{t 'Country'}}:</strong> {{this.settings.adminBillingCountry}}
46+
</div>
47+
</div>
48+
</div>
49+
</div>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<div class="ui segments">
2+
<div class="ui orange inverted segment center aligned">
3+
<div class="ui inverted mini statistic horizontal">
4+
<div class="value">
5+
{{t 'Event Information'}}
6+
</div>
7+
</div>
8+
</div>
9+
<div class="ui secondary segment">
10+
<h3 class="weight-400">{{t 'When & Where'}}</h3>
11+
</div>
12+
<div class="ui padded segment">
13+
<strong>{{t 'At'}} {{event.locationName}}</strong>
14+
<br>
15+
<strong>{{t 'From'}}:</strong> {{header-date event.startsAt}}
16+
<br>
17+
<strong>{{t 'To'}}:</strong> {{header-date event.endsAt}}
18+
{{#if event.ownerName}}
19+
<br>
20+
<strong>{{t 'Organized By'}}:</strong> {{event.ownerName}}
21+
{{/if}}
22+
</div>
23+
</div>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<div class="ui segments">
2+
<div class="ui green inverted segment center aligned">
3+
<div class="ui inverted mini statistic horizontal">
4+
<div class="value">
5+
{{t 'Paid'}}
6+
</div>
7+
<div class="label">
8+
{{t 'Your invoice payment completed successfully.'}}
9+
<br>
10+
{{t 'Find all the details related to your invoice below.'}}
11+
</div>
12+
</div>
13+
</div>
14+
<div class="ui secondary segment">
15+
<h3 class="weight-400">{{t 'Invoice Details'}}</h3>
16+
</div>
17+
<table class="ui very basic tablet stackable table order-summary center aligned">
18+
<thead>
19+
<tr>
20+
<th class="four wide">{{t 'Event Name'}}</th>
21+
<th class="four wide">{{t 'Date Issued'}}</th>
22+
<th class="four wide">{{t 'Date Completed'}}</th>
23+
<th class="ui aligned two wide">{{t 'Amount Payable'}}</th>
24+
</tr>
25+
</thead>
26+
<tbody>
27+
<tr>
28+
<td>{{event.name}}</td>
29+
<td>{{moment-format data.createdAt 'MM/DD/YYYY'}}</td>
30+
<td>{{moment-format data.completedAt 'MM/DD/YYYY'}}</td>
31+
<td>{{currency-symbol eventCurrency}} {{format-number data.amount}}</td>
32+
</tr>
33+
</tbody>
34+
</table>
35+
</div>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<form class="ui form">
2+
<div class="ui segments">
3+
<div class="ui aligned secondary segment">
4+
<h3 class="weight-400">{{t 'Payee Information'}}</h3>
5+
</div>
6+
<div class="ui padded segment">
7+
<h4 class="weight-300">
8+
{{t 'Name '}}
9+
</h4>
10+
<span>
11+
{{payer.firstName}} {{payer.lastName}}
12+
</span>
13+
<div class="ui divider"></div>
14+
15+
<h4 class="weight-300">
16+
{{t 'Email '}}
17+
</h4>
18+
<span>
19+
{{payer.email}}
20+
</span>
21+
{{#if (not-eq data.paymentMode 'free')}}
22+
<div class="ui divider"></div>
23+
{{#if (eq data.paymentMode 'paypal')}}
24+
<h3 class="ui header">
25+
<div class="content">
26+
{{t 'Payment Mode'}}
27+
</div>
28+
</h3>
29+
<img src="/images/payment-logos/paypal.png" alt="paypal" class="ui tiny image">
30+
{{#if (eq data.status 'paid')}}
31+
<div class="ui very relaxed divided list">
32+
<div class="item">
33+
<div class="content">
34+
<div class="header">
35+
{{t 'Transaction ID'}}
36+
</div>
37+
<div class="description">
38+
{{data.transactionId}}
39+
</div>
40+
</div>
41+
</div>
42+
</div>
43+
{{/if}}
44+
{{else if (eq data.paymentMode 'stripe')}}
45+
<h3 class="ui header">
46+
<div class="content">{{t 'Payment Mode'}}</div>
47+
<i class="big stripe icon"></i>
48+
49+
</h3>
50+
{{#if (eq data.status 'paid')}}
51+
<div class="ui very relaxed divided list">
52+
<div class="item">
53+
<div class="content">
54+
<div class="header">{{t 'Card Type'}}</div>
55+
<div class="description">
56+
{{#if (payment-icon data.brand)}}
57+
<i class="{{payment-icon data.brand}}"></i>
58+
{{else}}
59+
{{data.brand}}
60+
{{/if}}
61+
</div>
62+
</div>
63+
</div>
64+
<div class="item">
65+
<div class="content">
66+
<div class="header">{{t 'Card Number'}}</div>
67+
<div class="description">**** {{data.last4}}</div>
68+
</div>
69+
</div>
70+
<div class="item">
71+
<div class="content">
72+
<div class="header">{{t 'Exp Date'}}</div>
73+
<div class="description">{{data.expMonth}}/{{data.expYear}}</div>
74+
</div>
75+
</div>
76+
</div>
77+
{{/if}}
78+
{{/if}}
79+
{{/if}}
80+
</div>
81+
</div>
82+
</form>

app/templates/event-invoice/paid.hbs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<div class="ui one column container stackable doubling left grid">
2+
<div class="row print">
3+
<div class="column">
4+
<h2>{{model.event.name}}</h2>
5+
</div>
6+
</div>
7+
<div class="row">
8+
<div class="ten wide column print">
9+
{{event-invoice/invoice-summary data=model
10+
event=model.event
11+
eventCurrency=model.event.paymentCurrency}}
12+
</div>
13+
<div class="mobile hidden six wide column">
14+
{{event-invoice/event-info event=model.event}}
15+
</div>
16+
</div>
17+
<div class="row">
18+
<div class="column right aligned">
19+
<button {{action 'downloadEventInvoice' model.event.name model.identifier }} class="ui labeled icon blue {{if isLoadingInvoice 'loading'}} button">
20+
<i class="print alternate icon"></i>
21+
{{t 'Print Invoice'}}
22+
</button>
23+
</div>
24+
</div>
25+
<div class="row">
26+
<div class="ten wide column">
27+
{{event-invoice/billing-info user=model.user}}
28+
</div>
29+
<div class="six wide column">
30+
<div class="row">
31+
<div class="mobile hidden row">
32+
{{event-invoice/payee-info data=model payer=model.user}}
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>

0 commit comments

Comments
 (0)