|
1 | | -<script type="text/javascript"> |
2 | | - (function() { |
3 | | - 'use strict' |
4 | | - |
5 | | - function GeneralizedTime(generalizedTime) { |
6 | | - this.rawData = generalizedTime; |
7 | | - } |
8 | | - |
9 | | - GeneralizedTime.prototype.getYear = function () { |
10 | | - return parseInt(this.rawData.substring(0, 4), 10); |
11 | | - } |
12 | | - |
13 | | - GeneralizedTime.prototype.getMonth = function () { |
14 | | - return parseInt(this.rawData.substring(4, 6), 10) - 1; |
15 | | - } |
16 | | - |
17 | | - GeneralizedTime.prototype.getDay = function () { |
18 | | - return parseInt(this.rawData.substring(6, 8), 10) |
19 | | - }, |
20 | | - |
21 | | - GeneralizedTime.prototype.getHours = function () { |
22 | | - return parseInt(this.rawData.substring(8, 10), 10) |
23 | | - }, |
24 | | - |
25 | | - GeneralizedTime.prototype.getMinutes = function () { |
26 | | - var minutes = parseInt(this.rawData.substring(10, 12), 10) |
27 | | - if (minutes) return minutes |
28 | | - return 0 |
29 | | - }, |
30 | | - |
31 | | - GeneralizedTime.prototype.getSeconds = function () { |
32 | | - var seconds = parseInt(this.rawData.substring(12, 14), 10) |
33 | | - if (seconds) return seconds |
34 | | - return 0 |
35 | | - }, |
36 | | - |
37 | | - GeneralizedTime.prototype.getMilliseconds = function () { |
38 | | - var startIdx |
39 | | - if (time.indexOf('.') !== -1) { |
40 | | - startIdx = this.rawData.indexOf('.') + 1 |
41 | | - } else if (time.indexOf(',') !== -1) { |
42 | | - startIdx = this.rawData.indexOf(',') + 1 |
43 | | - } else { |
44 | | - return 0 |
45 | | - } |
46 | | - |
47 | | - var stopIdx = time.length - 1 |
48 | | - var fraction = '0' + '.' + time.substring(startIdx, stopIdx) |
49 | | - var ms = parseFloat(fraction) * 1000 |
50 | | - return ms |
51 | | - }, |
52 | | - |
53 | | - GeneralizedTime.prototype.getTimeZone = function () { |
54 | | - let time = this.rawData; |
55 | | - var length = time.length |
56 | | - var symbolIdx |
57 | | - if (time.charAt(length - 1 ) === 'Z') return 0 |
58 | | - if (time.indexOf('+') !== -1) { |
59 | | - symbolIdx = time.indexOf('+') |
60 | | - } else if (time.indexOf('-') !== -1) { |
61 | | - symbolIdx = time.indexOf('-') |
62 | | - } else { |
63 | | - return NaN |
64 | | - } |
65 | | - |
66 | | - var minutes = time.substring(symbolIdx + 2) |
67 | | - var hours = time.substring(symbolIdx + 1, symbolIdx + 2) |
68 | | - var one = (time.charAt(symbolIdx) === '+') ? 1 : -1 |
69 | | - |
70 | | - var intHr = one * parseInt(hours, 10) * 60 * 60 * 1000 |
71 | | - var intMin = one * parseInt(minutes, 10) * 60 * 1000 |
72 | | - var ms = minutes ? intHr + intMin : intHr |
73 | | - return ms |
74 | | - } |
75 | | - |
76 | | - if (typeof exports === 'object') { |
77 | | - module.exports = GeneralizedTime |
78 | | - } else if (typeof define === 'function' && define.amd) { |
79 | | - define(GeneralizedTime) |
80 | | - } else { |
81 | | - window.GeneralizedTime = GeneralizedTime |
82 | | - } |
83 | | - }()) |
84 | | -</script> |
85 | 1 | <script type="text/javascript"><![CDATA[ |
86 | 2 | class Token { |
87 | 3 | constructor(tokenInstance) { |
88 | 4 | this.props = tokenInstance |
89 | 5 | } |
90 | 6 |
|
91 | | - formatGeneralizedTimeToDate(str) { |
92 | | - const d = new GeneralizedTime(str) |
93 | | - return new Date(d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds()).toLocaleDateString() |
94 | | - } |
95 | | - formatGeneralizedTimeToTime(str) { |
96 | | - const d = new GeneralizedTime(str) |
97 | | - return new Date(d.getYear(), d.getMonth(), d.getDay(), d.getHours(), d.getMinutes(), d.getSeconds()).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}) |
| 7 | + redeemed() { |
| 8 | + if(this.props.redeemed === "1") { |
| 9 | + return "ticket-redeemed" |
| 10 | + } else { |
| 11 | + return "ticket" |
| 12 | + } |
98 | 13 | } |
99 | 14 |
|
100 | 15 | render() { |
101 | | - let time; |
102 | | - let date; |
103 | | - if (this.props.time == null) { |
104 | | - time = "" |
105 | | - date = "" |
106 | | - } else { |
107 | | - time = this.formatGeneralizedTimeToTime(this.props.time.generalizedTime) |
108 | | - date = this.props.time == null ? "": this.formatGeneralizedTimeToDate(this.props.time.generalizedTime) |
109 | | - } |
110 | | - let redeemedMessage = ""; |
111 | | - //might not have loaded so only set if actually loaded |
112 | | - if(this.props.redeemed === "1") { |
113 | | - redeemedMessage = "(Redeemed)" |
114 | | - } else if(this.props.redeemed === "0") { |
115 | | - redeemedMessage = "(Not redeemed)" |
116 | | - } |
117 | | - return `<div> |
118 | | - <div> |
119 | | - <span class="tbml-count">x${this.props._count}</span> |
120 | | - <span class="tbml-category">${this.props.category}</span> |
121 | | - <span class="tbml-category">${redeemedMessage}</span> |
122 | | - </div> |
123 | | - <div> |
124 | | - <span class="tbml-venue">${this.props.venue}</span> |
125 | | - </div> |
126 | | - <div style="margin: 0px; padding:0px; clear: both; height: 6px"> |
127 | | - |
128 | | - </div> |
129 | | - <div> |
130 | | - <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABGdBTUEAALGPC/xhBQAABw9JREFUaAXtWt1vFFUUP3d224JVqHyVXTSCjzYVBFMx/eTJJ1tQ+yA+iBLEIDGa+CBP4h+gMcYXYgR8sDxUacs/YD8DkgjWBB+lpHa3hbZQpNDdzs71nNmZ3Xvv3PlYk+IWd5LNnM/fPWdm7p1zzyyDEo8DYzMvW2buFAB/Gl17qtuSH/YylguD6b58c2t2yTwLHJqBwVj1mvih3qYt06F+nMeyw6mv0e4gAJs04rGjfc31F8P8RL0hMmE055xZOfNHDryRA9Th79jyaPpwmB/pM0vml+j/Cvo+Tmfio/gRPo2TH4832uNjHFF8XZuSknz9l/ltnEPSdaazBdAk8n40RiXZqbyfn4pP41McfvY6eUlJWjwb94Bw8Mo8RrZAtVN5vZcGXxuH3ts7cPc1Xp1ZuNVg5HLrRR/D4NfPNydviDIdvX8k3SHKGRi3+1rrx0WZjt4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CzqxzaEoKHCf04EBbcp/OiRpecba8QdLFanI/vbRhCv0kHNGG+iy5O+mEKCOadhNBxTYudMzuseYyMdHX5FXz1KASZS6N+0lcA+SmWKSFxwVwgD3ghSXTNVTOTiI3FHEo61y4v0INQwwizckQjLJX/y+SLOlxpTlpxMyN4q0zWLUZdU5aBi4XzkEtjKhzUv0sYOXic35z0sUXz5HuJC0AXcNTp8FaXrCy1nXxZ2aWJruGU5P0SU8EdumuodTRzGxqwTT5hOSHPHa675DetRXPhEe4hC/6EU1xUDwUl+jjR0dK8rWx9AGsMN6xKzE90rb8N0tZ+ealmXpccqk9skbW5DnEXEt6slP1Dp7+6xUmR/FQXKqfjo+UZI4DfXANOeyPspLN0jJsxUopZErweN5OckXGi6daRIsrYjFQYxkX8NW9qA6i8D0KDztbtlzDgt5pQqlah0e9bedVe/BkE7aYj0uW6riQq5x3oSIYdyFN+IgE7kLUAajoxl1Ix30I3oWoxTnh0Gd63IWMB+1CetvCi3PCKqniIYdyP3QVT6Q5We6JhcVXSTLsCq0WfaSFh5KptD8AKu2PwMe60v4IvDzwUNsfuLdIBbU/MFTpm6YQ+hJW2L7tD8IVbIvkSrY/3ro0t26RZ6X2x3+x1apl1fM/7N14t5h1kdIVA5FXV4JxgD3gYfudSvujeBNWjKpUPCt2aR8ycOVOPuQLvmLDMVxyF7B3s84dAf/CsoDtod9cfrWdsY+/C/8HVfy/LmN347j8X8FmUoebjG3Aod3lV9sZc1GPq/ifIfhWlT5KPP4N9JQx0JLsoS9Ej1Jibi64qp7ub912rlCsdI2mDuKH3yN4u3eLc9R1WDVnnIMY61W6g5Qgxf0P/UFw0L/BhyIAAAAASUVORK5CYII=" class="data-icon"/> |
131 | | - <span class="tbml-date">${date}</span> |
132 | | - </div> |
133 | | - <div> |
134 | | - <span class="tbml-time">${time}, ${this.props.locality}</span> |
135 | | - </div> |
| 16 | + return `<div class=${this.redeemed()}> |
| 17 | + <div class="content"> |
| 18 | + <div class="type-section"> |
| 19 | + <span class="type"> |
| 20 | + TYPE ${this.props.category} |
| 21 | + </span> |
| 22 | + </div> |
| 23 | + </div> |
136 | 24 | </div>`; |
137 | 25 | } |
138 | 26 | } |
|
0 commit comments