forked from szerko/Respond2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.php
363 lines (273 loc) · 12 KB
/
account.php
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<?php
include 'app.php'; // import php files
$authUser = new AuthUser(); // get auth user
$authUser->Authenticate('Admin');
Utilities::SetLanguage($authUser->Language); // set language
?>
<!DOCTYPE html>
<html lang="<?php print str_replace('_', '-', $authUser->Language) ?>">
<head>
<title><?php print _("Account"); ?>—<?php print $authUser->SiteName; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- include css -->
<?php include 'modules/css.php'; ?>
<link type="text/css" href="css/messages.css?v=<?php print VERSION; ?>" rel="stylesheet">
</head>
<body data-currpage="account" data-pubkey="<?php print STRIPE_PUB_KEY; ?>">
<?php include 'modules/menu.php'; ?>
<!-- messages -->
<input id="msg-unsubscribing" value="<?php print _("Unsubscribing..."); ?>" type="hidden">
<input id="msg-unsubscribe-success" value="<?php print _("You have successfully unsubscribed"); ?>" type="hidden">
<input id="msg-select-a-plan" value="<?php print _("Select a Plan"); ?>" type="hidden">
<input id="msg-updating-plan" value="<?php print _("Updating..."); ?>" type="hidden">
<input id="msg-update-successful" value="<?php print _("Update Successful"); ?>" type="hidden">
<input id="msg-change-plan-error" value="<?php print _("There was a problem changing the plan"); ?>" type="hidden">
<input id="msg-validating-card" value="<?php print _("Validating..."); ?>" type="hidden">
<input id="msg-updating-card" value="<?php print _("Updating..."); ?>" type="hidden">
<input id="msg-updating-card-successful" value="<?php print _("Credit Card Update Successful"); ?>" type="hidden">
<input id="msg-add-card" value="<?php print _("Adding..."); ?>" type="hidden">
<input id="msg-card-added" value="<?php print _("New card added"); ?>" type="hidden">
<input id="msg-card-declined" value="<?php print _("Credit Card declined"); ?>" type="hidden">
<input id="msg-updating-card-error" value="<?php print _("There was a problem updating the card"); ?>" type="hidden">
<input id="msg-validating-payment" value="<?php print _("Validating..."); ?>" type="hidden">
<input id="msg-paying" value="<?php print _("Paying..."); ?>" type="hidden">
<input id="msg-payment-successful" value="<?php print _("Payment successful"); ?>" type="hidden">
<input id="msg-subscription-problem" value="<?php print _("There was a problem paying for the subscription"); ?>" type="hidden">
<section class="main">
<nav>
<a class="show-menu"><i class="fa fa-bars fa-lg"></i></a>
<ul>
<li class="static active"><a><?php print _("Account"); ?></a></li>
</ul>
</nav>
<!-- /nav -->
<div class="container">
<div class="row">
<div class="col-md-12">
<table class="read-only-table table table-bordered">
<col width="20%">
<tr>
<th><?php print _("Type:"); ?></th>
<td>
<span class="loading" data-bind="visible: customerLoading()"><i class="fa fa-refresh fa-spin"></i> Loading account...</span>
<span data-bind="text:type"></span>
</td>
</tr>
<tr>
<th><?php print _("Status"); ?></th>
<td>
<span data-bind="text:status"></span>
<a class="btn btn-default" data-bind="visible: (status().toUpperCase()=='TRIAL' || status().toUpperCase()=='UNSUBSCRIBED'), click: showSubscribe"><?php print _("Subscribe"); ?></a>
</td>
</tr>
<tr data-bind="visible: (type().toUpperCase() == 'SUBSCRIPTION')">
<th><?php print _("Plan:"); ?></th>
<td>
<span data-bind="text:planName()"></span>
<small data-bind="text:amountReadable()"></small>
<a class="btn btn-default" data-bind="visible: (status().toUpperCase()=='ACTIVE'), click: showChangePlans"><?php print _("Change Plan"); ?></a>
<a class="btn btn-default" data-bind="visible: (status().toUpperCase()=='ACTIVE'), click: showUnsubscribe"><?php print _("Unsubscribe"); ?></a>
</td>
</tr>
<tr data-bind="visible: (type().toUpperCase() == 'SUBSCRIPTION')">
<th><?php print _("Renewal Date:"); ?></th>
<td>
<span data-bind="text:renewalReadable"></span>
</td>
</tr>
<tr data-bind="visible: hasCard">
<th><?php print _("Payment:"); ?></th>
<td>
<span data-bind="text:cardReadable"></span>
<small data-bind="text:cardExpires"></small>
<a class="btn btn-default" data-bind="click:showUpdatePayment">Update Payment</a>
</td>
</tr>
</table>
<!-- /.table -->
</div>
<!-- /.col-md-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</section>
<!-- /.main -->
<div class="modal fade" id="unsubscribeDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Unsubscribe"); ?></h3>
</div>
<div class="modal-body">
<p>
<?php print _("Are you sure that you want to unsubscribe?"); ?>
</p>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: unsubscribe"><?php print _("Unsubscribe"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="changePlanDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Change Plan"); ?></h3>
</div>
<div class="modal-body">
<p class="modal-info">
<?php print _("Select your new plan from the list below."); ?>
</p>
<div class="form-group separator">
<div>
<!-- ko foreach: plans -->
<label class="radio">
<input type="radio" name="plan" data-bind="value:id, checked:$parent.planId()">
<span data-bind="text:name"></span><br>
<small data-bind="text:readable"></small>
</label>
<!-- /ko -->
<span class="loading" data-bind="visible: plansLoading()"><i class="fa fa-refresh fa-spin"></i> <?php print _("Loading plans..."); ?></span>
</div>
</div>
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: changePlan"><?php print _("Change Plan"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="updatePaymentDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Update Payment"); ?></h3>
</div>
<div class="modal-body">
<form data-bind="visible: (showNewCard() == false)">
<p class="modal-info">
<?php print _("Update the expiration date for your card. If you want to add a new card, click the New Card button."); ?>
</p>
<div class="form-group">
<div>
<span class="read-only">
<span data-bind="text:cardReadable"></span>
<small data-bind="text:cardExpires"></small>
</span>
</div>
</div>
<div class="form-group">
<label for="expires"><?php print _("Expires:"); ?></label>
<div>
<input id="changeMM" type="number" placeholder="MM" class="inline form-control input-2" maxlength="2" data-bind="value: cardExpiredMonth"> / <input id="changeYY" type="number" maxlength="4" placeholder="YYYY" class="inline form-control input-4" data-bind="value: cardExpiredYear">
</div>
</div>
</form>
<!-- /.form-horizontal -->
<form action="" method="POST" id="newcard-form" data-bind="visible: showNewCard">
<p class="modal-info">
<?php print _("Enter the details for your new credit card."); ?>
</p>
<div class="form-group">
<label for="update-cc"><?php print _("Credit Card #:"); ?></label>
<input id="update-cc" type="text" maxlength="20" data-stripe="number" class="form-control">
</div>
<div class="form-group">
<label for="update-cvc"><?php print _("Card Code (CVC):"); ?></label>
<input id="update-cvc" type="text" placeholder="CVC" class="form-control input-4" maxlength="4" data-stripe="cvc">
</div>
<div class="form-group separator">
<label for="update-expiresMM"><?php print _("Expires:"); ?></label>
<div>
<input id="update-expiresMM" type="text" placeholder="MM" class="inline form-control input-2" maxlength="2" data-stripe="exp-month"> / <input id="update-expiresYY" type="text" maxlength="4" placeholder="YYYY" class="inline form-control input-4" data-stripe="exp-year">
</div>
</div>
</form>
<!-- /.form-horizontal -->
</div>
<div class="modal-footer">
<button class="tertiary-button" data-bind="click: newCard, visible: (showNewCard()==false)"><?php print _("New Card"); ?></button>
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: updatePayment"><?php print _("Update Payment"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="subscribeDialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3><?php print _("Subscribe"); ?></h3>
</div>
<div class="modal-body">
<form action="" method="POST" id="subscribe-form">
<p class="modal-info">
<?php print _("Select a plan and enter your credit card information to subscribe."); ?>
</p>
<div class="form-group separator">
<div>
<!-- ko foreach: plans -->
<label class="radio">
<input type="radio" name="plan" data-bind="value:id, checked:$parent.planId()">
<span data-bind="text:name"></span><br>
<small data-bind="text:readable"></small>
</label>
<!-- /ko -->
</div>
</div>
<div class="form-group">
<label for="address"><?php print _("Credit Card #:"); ?></label>
<input id="cc" type="text" maxlength="20" data-stripe="number" class="form-control">
</div>
<div class="form-group">
<label for="cvc"><?php print _("Card Code (CVC):"); ?></label>
<input id="cvc" type="text" placeholder="CVC" class="form-control input-4" maxlength="4" data-stripe="cvc">
</div>
<div class="form-group">
<label for="expires"><?php print _("Expires:"); ?></label>
<div>
<input id="expiresMM" type="text" placeholder="MM" class="inline form-control input-2" maxlength="2" data-stripe="exp-month"> / <input id="expiresYY" type="text" maxlength="4" placeholder="YYYY" class="inline form-control input-4" data-stripe="exp-year">
</div>
</div>
</form>
<!-- /.form-horizontal -->
</div>
<div class="modal-footer">
<button class="secondary-button" data-dismiss="modal"><?php print _("Close"); ?></button>
<button class="primary-button" data-bind="click: subscribe"><?php print _("Subscribe"); ?></button>
</div>
<!-- /.modal-footer -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</body>
<!-- include js -->
<?php include 'modules/js.php'; ?>
<script type="text/javascript" src="<?php print STRIPE_JS; ?>"></script>
<script type="text/javascript" src="js/viewModels/models.js?v=<?php print VERSION; ?>"></script>
<script type="text/javascript" src="js/viewModels/accountModel.js?v=<?php print VERSION; ?>"></script>
</html>