-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (161 loc) · 5.15 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Keep track of your [Hero] Protector of Stars set grinding !">
<meta name="author" content="jballanger">
<link rel="icon" href="favicon.ico">
<title>DS Pos</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="app">
<div class="actions">
<button @click="showFilters = true">Filters</button>
<button @click="showExport = true">Export</button>
<button @click="showImport = true">Import</button>
</div>
<export v-if="showExport" :data="exportData" @close="showExport = false"></export>
<import v-if="showImport" v-model="importedData" @close="showImport = false"></import>
<table-filters v-if="showFilters" :filters="filters" @close="showFilters = false"></table-filters>
<pos-table :mats="data"></pos-table>
<div class="loader" v-if="!data"></div>
</div>
<script type="text/x-template" id="table-filters-template">
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper" @click="$emit('close')">
<div class="modal-container" @click.stop>
<div class="modal-header">
<slot name="header">
<h3>Filters</h3>
</slot>
</div>
<div class="modal-body">
<slot name="body">
<div class="parts">
<h3>I want:</h3>
<template v-for="part in parts">
<div class="part">
<input type="checkbox" :id="part | formatId" v-model="filters.want[part]"/>
<label :for="part | formatId">{{ part | formatLabel }}</label>
</div>
</template>
<h3>I have:</h3>
<template v-for="part in parts">
<div class="part" style="padding: 5px 0px">
<select v-model="filters.have[part]">
<option :value="undefined">No</option>
<option value="0" v-if="part !== 'wings'">Normal</option>
<option value="1">Rare</option>
<option value="2">Hero</option>
</select>
<label :for="part | formatId">{{ part | formatLabel }}</label>
</div>
</template>
</div>
</slot>
</div>
<div class="modal-footer">
<slot name="footer">
<button class="modal-default-button" @click="$emit('close')">Close</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
<script type="text/x-template" id="pos-table-template">
<div class="responsive-table">
<table v-if="mats">
<thead>
<th>#</th>
<th>Item</th>
<th>Need</th>
<th>Have</th>
<th>Left</th>
</thead>
<tbody>
<template v-for="(item, index) in mats">
<tr class="table-primary">
<th>{{ index | formatIndex }}</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<template v-for="(quantity, name) in item">
<tr :class="[ ((quantity.need - quantity.have) > 0) ? 'table-danger' : 'table-success' ]">
<th></th>
<th>{{ name | formatName }}</th>
<th>{{ quantity.need }}</th>
<th><input v-model="quantity.have" class="have-input"/></th>
<th>{{ (quantity.need - quantity.have) | formatLeft }}</th>
</tr>
</template>
</template>
</tbody>
</table>
</div>
</script>
<script type="text/x-template" id="export-template">
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper" @click="$emit('close')">
<div class="modal-container" @click.stop>
<div class="modal-header">
<slot name="header">
<h3>Export JSON</h3>
<h5>
<a href="https://www.json.org/" target="_blank" rel="noopener noreferrer">What is JSON ?</a> <img src="confused.gif">
</h5>
</slot>
</div>
<div class="modal-body">
<slot name="body">
<textarea v-model="jsonData" rows="5" cols="40" @click="$event.target.select()"></textarea>
</slot>
</div>
<div class="modal-footer">
<slot name="footer">
<button class="modal-default-button" @click="$emit('close')">Close</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
<script type="text/x-template" id="import-template">
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper" @click="$emit('close')">
<div class="modal-container" @click.stop>
<div class="modal-header">
<slot name="header">
<h3>Import JSON</h3>
</slot>
</div>
<div class="modal-body">
<slot name="body">
<h5 class="text-danger">{{ error }}</h5>
<textarea v-model="value" rows="5" cols="40"></textarea>
</slot>
</div>
<div class="modal-footer">
<slot name="footer">
<button class="modal-default-button" @click="importData">Import</button>
<button class="modal-default-button" @click="$emit('close')">Close</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="script.js"></script>
</body>
</html>