-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathview-tally-component.js
More file actions
49 lines (47 loc) · 1.45 KB
/
view-tally-component.js
File metadata and controls
49 lines (47 loc) · 1.45 KB
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
import RouterService from "../../services/router-service.js";
import Spinner from "../shared/spinner-component.js";
import ViewPlaintextBallotComponent from "../shared/view-plaintext-ballot-component.js";
export default {
props: {
decryptionId: String,
},
components: { Spinner, ViewPlaintextBallotComponent },
data() {
return { tally: null, loading: true };
},
methods: {
getElectionUrl: function (electionId) {
return RouterService.getElectionUrl(electionId);
},
getDecryptionUrl: function () {
return RouterService.getUrl(RouterService.routes.viewDecryptionAdmin, {
decryptionId: this.decryptionId,
});
},
},
async mounted() {
const result = await eel.get_tally(this.decryptionId)();
if (result.success) {
this.tally = result.result;
} else {
console.error(result.error);
}
this.loading = false;
},
template: /*html*/ `
<div v-if="tally" class="row">
<div class="col col-12 mb-3">
<a :href="getElectionUrl(tally.election_id)">{{tally.election_name}}</a>
>
<a :href="getDecryptionUrl()">{{tally.decryption_name}}</a>
>
Tally
</div>
<div class="col-md-12">
<button type="button" onclick="window.print()">Generate PDF</button>
<view-plaintext-ballot-component :ballot="tally.report"></view-plaintext-ballot-component>
</div>
</div>
<spinner :visible="loading"></spinner>
`,
};