|
1 | 1 | <template>
|
2 |
| - <div class="container f-col p-3"> |
| 2 | + <div class="p-3"> |
3 | 3 |
|
4 |
| - <div class="f-row items-center justify-between mb-5"> |
| 4 | + <section class="f-row items-center justify-between"> |
5 | 5 | <label for="target" class="inline-block">
|
6 | 6 | Target
|
7 | 7 | </label>
|
8 |
| - <input type="number" id="target" min="0" step="0.01" autofocus |
9 |
| - class="inline-block w-1/3" |
| 8 | + <input type="number" id="target" min="0" max="1000" step="0.01" maxlength="3" autofocus |
| 9 | + style="width: 6rem;" |
10 | 10 | v-model.number.lazy="target" @change="targetChanged($event)"/>
|
11 |
| - <auto-toggle-button v-model="auto"></auto-toggle-button> |
12 |
| - </div> |
| 11 | + <div class="inline-block text-center" style="width: 120px;"> |
| 12 | + <auto-toggle-button class="my-1" v-model="auto"></auto-toggle-button> |
| 13 | + <button type="button" class="btn btn-primary clear-btn my-1" |
| 14 | + @click="reset()" |
| 15 | + :disabled="this.target === null && this.ticketTotal === 0"> |
| 16 | + Clear |
| 17 | + </button> |
| 18 | + </div> |
| 19 | + </section> |
13 | 20 |
|
14 |
| - <div class="solution-buttons-container px-5"> |
| 21 | + <section class="solution-buttons-container pb-1"> |
15 | 22 | <solution-buttons v-if="solutions && auto"
|
16 | 23 | :solutions="solutions"
|
17 | 24 | @select="selectSolution"/>
|
18 |
| - </div> |
19 |
| - |
20 |
| - <hr> |
21 |
| - |
22 |
| - <div class="f-col"> |
| 25 | + </section> |
23 | 26 |
|
| 27 | + <section class="f-col"> |
24 | 28 | <div class="w-full text-center my-3" v-if="ticketQuantities.length === 0">
|
25 | 29 | <router-link to="/settings" class="btn btn-primary-reverse border-2 border-primary">
|
26 | 30 | + Add tickets
|
27 | 31 | </router-link>
|
28 | 32 | </div>
|
29 |
| - |
30 | 33 | <ticket-quantity-row v-for="(ticketQuantity, index) in ticketQuantities" :key="index"
|
31 | 34 | :ticket-quantity="ticketQuantity"
|
32 | 35 | :buttons-disabled="calcButtonsDisabled" />
|
33 |
| - </div> |
| 36 | + </section> |
34 | 37 |
|
35 |
| - <hr> |
36 |
| - |
37 |
| - <div class="f-col"> |
| 38 | + <section class="f-col"> |
38 | 39 | <div class="f-row mt-2">
|
39 | 40 | <span class="col-start">Ticket total</span>
|
40 | 41 | <div class="col-end-value">
|
41 |
| - <span class="input-value result-value">{{ ticketTotal | fixed2 }}</span> |
| 42 | + <span class="input-value result-value" |
| 43 | + :class="{'the-price-is-right': ticketTotal && this.thePriceIsRight}"> |
| 44 | + {{ ticketTotal | fixed2 }} |
| 45 | + </span> |
42 | 46 | </div>
|
43 | 47 | </div>
|
44 |
| - <div class="f-row mt-2" :class="{'invisible': !target}"> |
| 48 | + <div class="f-row mt-2" v-if="target && balance"> |
45 | 49 | <span class="col-start">
|
46 | 50 | {{ balanceLabel }}
|
47 | 51 | </span>
|
48 | 52 | <div class="col-end-value">
|
49 |
| - <span class="input-value result-value font-semibold" :class="balanceClass"> |
| 53 | + <span class="input-value result-value font-semibold" :class="{ |
| 54 | + 'the-price-is-right': this.thePriceIsRight, |
| 55 | + 'has-remaining': this.hasRemaining, |
| 56 | + 'has-extra': this.hasExtra, |
| 57 | + }"> |
50 | 58 | {{ balance | abs | fixed2 }}
|
51 | 59 | </span>
|
52 | 60 | </div>
|
53 | 61 | </div>
|
54 |
| - </div> |
55 |
| - |
56 |
| - <div class="flex justify-end mt-4 text-base"> |
57 |
| - <div class="col-end"> |
58 |
| - <button class="btn btn-primary" type="button" |
59 |
| - @click="reset()" |
60 |
| - :disabled="this.target === null && this.ticketTotal === 0"> |
61 |
| - Clear |
62 |
| - </button> |
63 |
| - </div> |
64 |
| - </div> |
| 62 | + </section> |
65 | 63 |
|
66 | 64 | </div>
|
67 | 65 | </template>
|
|
88 | 86 | },
|
89 | 87 | data() {
|
90 | 88 | return {
|
91 |
| - target: null, |
| 89 | + target: 32, |
92 | 90 | ticketQuantities: [],
|
93 | 91 | solutions: null,
|
94 | 92 | auto: true,
|
|
155 | 153 |
|
156 | 154 | <style>
|
157 | 155 |
|
| 156 | + section { |
| 157 | + @apply py-2 border-b-2; |
| 158 | + } |
| 159 | + section:last-child { |
| 160 | + @apply border-b-0; |
| 161 | + } |
158 | 162 | .col-start {
|
159 | 163 | @apply flex-grow pl-2;
|
160 | 164 | }
|
161 |
| - .col-end { |
162 |
| - @apply inline-block text-center; |
163 |
| - width: 8rem; |
164 |
| - } |
165 | 165 | .col-end-value {
|
166 | 166 | @apply text-right pr-6;
|
167 | 167 | }
|
|
171 | 171 | margin-left: -2%;
|
172 | 172 | }
|
173 | 173 |
|
| 174 | + .clear-btn { |
| 175 | + width: 115px; |
| 176 | + } |
174 | 177 | .solution-buttons-container {
|
175 |
| - min-height: 2.5rem; /*min-h-10*/ |
| 178 | + min-height: 3.4rem; |
176 | 179 | }
|
177 | 180 |
|
178 | 181 | .result-value {
|
|
181 | 184 | }
|
182 | 185 | .has-remaining { @apply text-positive; }
|
183 | 186 | .has-extra { @apply text-negative; }
|
184 |
| - .the-price-is-right { @apply text-equal; } |
| 187 | + .the-price-is-right { @apply text-equal font-semibold; } |
185 | 188 |
|
186 | 189 | </style>
|
0 commit comments