mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-04 08:40:28 +00:00
extract QR code
This commit is contained in:
parent
fb4fecda2b
commit
12455eaefd
5 changed files with 40 additions and 29 deletions
27
frontend/components/global/PageQRCode.vue
Normal file
27
frontend/components/global/PageQRCode.vue
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<template>
|
||||||
|
<div class="dropdown dropdown-left">
|
||||||
|
<slot>
|
||||||
|
<label tabindex="0" class="btn btn-circle btn-sm">
|
||||||
|
<Icon name="mdi-qrcode" />
|
||||||
|
</label>
|
||||||
|
</slot>
|
||||||
|
<div tabindex="0" class="card compact dropdown-content shadow-lg bg-base-100 rounded-box w-64">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2 class="text-center">Page URL</h2>
|
||||||
|
<img :src="getQRCodeUrl()" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const api = useUserApi();
|
||||||
|
|
||||||
|
function getQRCodeUrl(): string {
|
||||||
|
const currentURL = window.location.href;
|
||||||
|
|
||||||
|
return `/api/v1/qrcode?data=${encodeURIComponent(currentURL)}&access_token=${api.items.attachmentToken}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
|
@ -96,7 +96,7 @@ export interface ItemOut {
|
||||||
/** @example "0" */
|
/** @example "0" */
|
||||||
purchasePrice: string;
|
purchasePrice: string;
|
||||||
/** Purchase */
|
/** Purchase */
|
||||||
purchaseTime: Date;
|
purchaseTime: string;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
serialNumber: string;
|
serialNumber: string;
|
||||||
soldNotes: string;
|
soldNotes: string;
|
||||||
|
@ -148,7 +148,7 @@ export interface ItemUpdate {
|
||||||
/** @example "0" */
|
/** @example "0" */
|
||||||
purchasePrice: string;
|
purchasePrice: string;
|
||||||
/** Purchase */
|
/** Purchase */
|
||||||
purchaseTime: Date;
|
purchaseTime: string;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
/** Identifications */
|
/** Identifications */
|
||||||
serialNumber: string;
|
serialNumber: string;
|
||||||
|
@ -228,7 +228,7 @@ export interface LocationUpdate {
|
||||||
export interface MaintenanceEntry {
|
export interface MaintenanceEntry {
|
||||||
/** @example "0" */
|
/** @example "0" */
|
||||||
cost: string;
|
cost: string;
|
||||||
date: Date;
|
date: string;
|
||||||
description: string;
|
description: string;
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -237,7 +237,7 @@ export interface MaintenanceEntry {
|
||||||
export interface MaintenanceEntryCreate {
|
export interface MaintenanceEntryCreate {
|
||||||
/** @example "0" */
|
/** @example "0" */
|
||||||
cost: string;
|
cost: string;
|
||||||
date: Date;
|
date: string;
|
||||||
description: string;
|
description: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ export interface MaintenanceEntryCreate {
|
||||||
export interface MaintenanceEntryUpdate {
|
export interface MaintenanceEntryUpdate {
|
||||||
/** @example "0" */
|
/** @example "0" */
|
||||||
cost: string;
|
cost: string;
|
||||||
date: Date;
|
date: string;
|
||||||
description: string;
|
description: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ export interface MaintenanceLog {
|
||||||
itemId: string;
|
itemId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PaginationResultRepoItemSummary {
|
export interface PaginationResultItemSummary {
|
||||||
items: ItemSummary[];
|
items: ItemSummary[];
|
||||||
page: number;
|
page: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
|
@ -294,7 +294,7 @@ export interface ValueOverTime {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ValueOverTimeEntry {
|
export interface ValueOverTimeEntry {
|
||||||
date: Date;
|
date: string;
|
||||||
name: string;
|
name: string;
|
||||||
value: number;
|
value: number;
|
||||||
}
|
}
|
||||||
|
@ -347,13 +347,13 @@ export interface EnsureAssetIDResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupInvitation {
|
export interface GroupInvitation {
|
||||||
expiresAt: Date;
|
expiresAt: string;
|
||||||
token: string;
|
token: string;
|
||||||
uses: number;
|
uses: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupInvitationCreate {
|
export interface GroupInvitationCreate {
|
||||||
expiresAt: Date;
|
expiresAt: string;
|
||||||
uses: number;
|
uses: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +363,6 @@ export interface ItemAttachmentToken {
|
||||||
|
|
||||||
export interface TokenResponse {
|
export interface TokenResponse {
|
||||||
attachmentToken: string;
|
attachmentToken: string;
|
||||||
expiresAt: Date;
|
expiresAt: string;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,12 +335,6 @@
|
||||||
closeDialog();
|
closeDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getQRCodeUrl(): string {
|
|
||||||
const currentURL = window.location.href;
|
|
||||||
|
|
||||||
return `/api/v1/qrcode?data=${encodeURIComponent(currentURL)}&access_token=${api.items.attachmentToken}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentPath = computed(() => {
|
const currentPath = computed(() => {
|
||||||
return route.path;
|
return route.path;
|
||||||
});
|
});
|
||||||
|
@ -438,21 +432,9 @@
|
||||||
<input v-model="preferences.showEmpty" type="checkbox" class="toggle toggle-primary" />
|
<input v-model="preferences.showEmpty" type="checkbox" class="toggle toggle-primary" />
|
||||||
<span class="label-text ml-4"> Show Empty </span>
|
<span class="label-text ml-4"> Show Empty </span>
|
||||||
</label>
|
</label>
|
||||||
<div class="flex flex-wrap justify-end gap-2 ml-auto">
|
<PageQRCode />
|
||||||
<div class="dropdown dropdown-left">
|
|
||||||
<label tabindex="0" class="btn btn-circle btn-sm">
|
|
||||||
<Icon name="mdi-qrcode" />
|
|
||||||
</label>
|
|
||||||
<div tabindex="0" class="card compact dropdown-content shadow-lg bg-base-100 rounded-box w-64">
|
|
||||||
<div class="card-body">
|
|
||||||
<img :src="getQRCodeUrl()" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<DetailsSection :details="itemDetails" />
|
<DetailsSection :details="itemDetails" />
|
||||||
</BaseCard>
|
</BaseCard>
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@
|
||||||
<Icon class="mr-1" name="mdi-delete" />
|
<Icon class="mr-1" name="mdi-delete" />
|
||||||
Delete
|
Delete
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
|
<PageQRCode />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
<Icon class="mr-1" name="mdi-delete" />
|
<Icon class="mr-1" name="mdi-delete" />
|
||||||
Delete
|
Delete
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
|
<PageQRCode />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue