|
40 | 40 |
|
41 | 41 | <div v-else-if="!isPublicMode" class="mt-3"> |
42 | 42 | <div class="alert alert-info"> |
43 | | - <strong>Generate Public QR Code:</strong><br /> |
44 | | - This QR code requires authentication to access. You can generate a public QR code that allows |
45 | | - access without login. |
| 43 | + <strong v-if="hasExistingToken">Public QR Code Available:</strong> |
| 44 | + <strong v-else>Generate Public QR Code:</strong> |
| 45 | + <br /> |
| 46 | + <span v-if="hasExistingToken"> |
| 47 | + A public QR code already exists for this item. You can view it or generate a new one if |
| 48 | + needed. |
| 49 | + </span> |
| 50 | + <span v-else> |
| 51 | + This QR code requires authentication to access. You can generate a public QR code that |
| 52 | + allows access without login. |
| 53 | + </span> |
46 | 54 | </div> |
47 | 55 |
|
48 | 56 | <button |
49 | | - class="btn btn-warning w-100" |
| 57 | + class="btn w-100" |
| 58 | + :class="hasExistingToken ? 'btn-info' : 'btn-warning'" |
50 | 59 | :disabled="isGenerating" |
51 | 60 | @click.prevent="hasExistingToken ? switchToPublic() : generatePublicQRCode()" |
52 | 61 | > |
|
68 | 77 | </div> |
69 | 78 | </div> |
70 | 79 |
|
71 | | - <div class="d-flex justify-content-center"> |
72 | | - <button class="btn btn-sm btn-outline-primary mr-2" @click="switchToPrivate"> |
73 | | - <i class="fas fa-eye me-1"></i>View Private QRCode |
74 | | - </button> |
75 | | - <button |
76 | | - class="btn btn-sm btn-outline-danger" |
77 | | - :disabled="isInvalidating" |
78 | | - @click.stop.prevent="invalidateToken" |
79 | | - > |
80 | | - <i class="fas fa-trash me-1"></i>Delete Token |
81 | | - </button> |
| 80 | + <div class="row g-2"> |
| 81 | + <div class="col-6"> |
| 82 | + <button class="btn btn-outline-info w-100" @click="switchToPrivate"> |
| 83 | + <i class="fas fa-eye me-1"></i>View Private QRCode |
| 84 | + </button> |
| 85 | + </div> |
| 86 | + <div class="col-6"> |
| 87 | + <button |
| 88 | + class="btn btn-outline-danger w-100" |
| 89 | + :disabled="isInvalidating" |
| 90 | + @click.stop.prevent="invalidateToken" |
| 91 | + > |
| 92 | + <i class="fas fa-trash me-1"></i>Delete Token |
| 93 | + </button> |
| 94 | + </div> |
82 | 95 | </div> |
83 | 96 | </div> |
84 | 97 |
|
@@ -164,7 +177,7 @@ export default { |
164 | 177 | } |
165 | 178 | }, |
166 | 179 | hasExistingToken() { |
167 | | - return this.tokenInfo && this.publicToken && this.publicToken !== "existing-token"; |
| 180 | + return this.tokenInfo && this.publicToken === "existing-token"; |
168 | 181 | }, |
169 | 182 | }, |
170 | 183 | mounted() { |
@@ -196,8 +209,7 @@ export default { |
196 | 209 | if (response.ok && data.status === "success") { |
197 | 210 | if (data.has_token) { |
198 | 211 | this.tokenInfo = data.token_info; |
199 | | - this.isPublicMode = true; |
200 | | - this.publicToken = data.token_info.token; |
| 212 | + this.publicToken = "existing-token"; |
201 | 213 | } |
202 | 214 | } else if (response.status === 404) { |
203 | 215 | console.debug("No access to item or item not found"); |
|
0 commit comments