Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions frontend/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -962,10 +962,6 @@
width: 100%;
overflow-x: hidden;
}
body {
-webkit-user-select: none;
-webkit-touch-callout: none;
}
}

.text-no-transform {
Expand Down
10 changes: 7 additions & 3 deletions frontend/components/Form/Checkbox.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<div v-if="!inline" class="flex w-full items-center gap-1.5">
<Checkbox :id="id" v-model="value" class="size-6" />
<Label :for="id" class="cursor-pointer">
<Checkbox :id="id" v-model="value" class="size-6" :aria-label="ariaLabel || undefined" />
<Label v-if="label" :for="id" class="cursor-pointer">
{{ label }}
</Label>
</div>
<div v-else class="sm:grid sm:grid-cols-4 sm:items-start sm:gap-4">
<Label :for="id" class="flex w-full cursor-pointer px-1 py-2">
{{ label }}
</Label>
<Checkbox :id="id" v-model="value" class="size-6" />
<Checkbox :id="id" v-model="value" class="size-6" :aria-label="ariaLabel || undefined" />
</div>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
</template>

Expand All @@ -30,6 +30,10 @@
type: String,
default: "",
},
ariaLabel: {
type: String,
default: "",
},
});

const value = useVModel(props, "modelValue");
Expand Down
15 changes: 12 additions & 3 deletions frontend/components/Item/CreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@
import BaseModal from "@/components/App/CreateModal.vue";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import type { EntityCreate, EntityTemplateOut, EntityTemplateSummary, EntityOut } from "~~/lib/api/types/data-contracts";
import type {
EntityCreate,
EntityTemplateOut,
EntityTemplateSummary,
EntityOut,
} from "~~/lib/api/types/data-contracts";
import { useTagStore } from "~/stores/tags";
import { useLocationStore } from "~~/stores/locations";
import MdiBarcode from "~icons/mdi/barcode";
Expand Down Expand Up @@ -390,7 +395,11 @@
if (et?.defaultTemplateId && et.defaultTemplate) {
const { data, error } = await api.templates.get(et.defaultTemplateId);
if (!error && data) {
selectedTemplate.value = { id: data.id, name: data.name, description: data.description } as EntityTemplateSummary;
selectedTemplate.value = {
id: data.id,
name: data.name,
description: data.description,
} as EntityTemplateSummary;
templateData.value = data;
form.quantity = data.defaultQuantity;
if (data.defaultName) form.name = data.defaultName;
Expand Down Expand Up @@ -657,7 +666,7 @@
} else {
// Normal item creation without template
const out: EntityCreate = {
parentId: form.parentId || form.location.id as string,
parentId: form.parentId || (form.location.id as string),
name: form.name,
quantity: form.quantity,
description: form.description,
Expand Down
9 changes: 2 additions & 7 deletions frontend/components/Location/CreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@

<template v-if="showAdvanced">
<TagSelector v-model="form.tags" :tags="tags ?? []" />
<FormTextArea
v-model="form.notes"
label="Notes"
:max-length="1000"
/>
<FormTextArea v-model="form.notes" label="Notes" :max-length="1000" />
</template>

<div class="mt-4 flex flex-row-reverse">
Expand Down Expand Up @@ -142,8 +138,7 @@
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import BaseModal from "@/components/App/CreateModal.vue";
import type { EntityTypeSummary } from "~~/lib/api/types/data-contracts";
import type { EntitySummary } from "~~/lib/api/types/data-contracts";
import type { EntityTypeSummary, EntitySummary } from "~~/lib/api/types/data-contracts";
import { AttachmentTypes } from "~~/lib/api/types/non-generated";
import { useDialog, useDialogHotkey } from "~/components/ui/dialog-provider";
import { useTagStore } from "~/stores/tags";
Expand Down
7 changes: 5 additions & 2 deletions frontend/components/Location/Tree/Node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@
</script>

<template>
<div>
<div :data-testid="`location-tree-node-${item.name}`">
<div
class="flex items-center gap-1 rounded p-1"
:class="{
'cursor-pointer hover:bg-accent hover:text-accent-foreground': hasChildren,
}"
:data-testid="`location-tree-toggle-${item.name}`"
@click="openRef = !openRef"
>
<div
Expand All @@ -80,7 +81,9 @@
</div>
<MdiMapMarker v-if="item.type === 'location'" class="size-4" />
<MdiPackageVariant v-else class="size-4" />
<NuxtLink class="text-lg hover:underline" :to="link" @click.stop>{{ item.name }} </NuxtLink>
<NuxtLink class="text-lg hover:underline" :to="link" :data-testid="`location-tree-link-${item.name}`" @click.stop
>{{ item.name }}
</NuxtLink>
</div>
<div v-if="openRef" class="ml-4">
<LocationTreeNode
Expand Down
8 changes: 7 additions & 1 deletion frontend/components/Scanner/ARControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
<div class="pointer-events-none absolute inset-0 z-20 flex flex-col justify-between">
<!-- Top bar -->
<div class="pointer-events-auto flex items-center gap-3 bg-background/60 p-3 backdrop-blur-sm">
<Button variant="ghost" size="icon" :aria-label="t('scanner_ar.back')" :title="t('scanner_ar.back')" @click="$emit('back')">
<Button
variant="ghost"
size="icon"
:aria-label="t('scanner_ar.back')"
:title="t('scanner_ar.back')"
@click="$emit('back')"
>
<MdiArrowLeft class="size-5" />
</Button>
<span class="text-sm font-semibold text-foreground">{{ t("scanner_ar.title") }}</span>
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/Scanner/AROverlayCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
<span class="truncate text-sm font-semibold text-foreground">{{ entity.location.name }}</span>
<div class="flex flex-wrap items-center gap-1.5">
<span v-if="entity.location.children.length > 0" class="text-xs text-muted-foreground">
{{ entity.location.children.length }} {{ t("scanner_ar.children", { count: entity.location.children.length }) }}
{{ entity.location.children.length }}
{{ t("scanner_ar.children", { count: entity.location.children.length }) }}
</span>
</div>
<span v-if="entity.location.totalPrice" class="text-xs text-muted-foreground">
Expand Down
13 changes: 11 additions & 2 deletions frontend/components/Template/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,22 @@
</script>

<template>
<Card>
<Card :data-testid="`template-card-${template.name}`">
<CardHeader>
<CardTitle class="truncate">{{ template.name }}</CardTitle>
<CardDescription v-if="template.description" class="line-clamp-2">
{{ template.description }}
</CardDescription>
</CardHeader>
<CardFooter class="flex justify-end gap-1">
<Button size="icon" variant="outline" class="size-8" as-child :title="$t('components.template.card.edit')">
<Button
size="icon"
variant="outline"
class="size-8"
as-child
:title="$t('components.template.card.edit')"
data-testid="template-card-edit"
>
<NuxtLink :to="`/template/${template.id}`">
<MdiPencil class="size-4" />
</NuxtLink>
Expand All @@ -101,6 +108,7 @@
variant="outline"
class="size-8"
:title="$t('components.template.card.duplicate')"
data-testid="template-card-duplicate"
@click="handleDuplicate"
>
<MdiContentCopy class="size-4" />
Expand All @@ -110,6 +118,7 @@
variant="destructive"
class="size-8"
:title="$t('components.template.card.delete')"
data-testid="template-card-delete"
@click="handleDelete"
>
<MdiDelete class="size-4" />
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/Template/CreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<p v-else class="text-sm text-muted-foreground">{{ $t("components.template.form.no_custom_fields") }}</p>

<div class="mt-4 flex justify-end">
<Button type="submit" :loading="loading">{{ $t("global.create") }}</Button>
<Button data-testid="template-create-submit" type="submit" :loading="loading">{{ $t("global.create") }}</Button>
</div>
</form>
</BaseModal>
Expand Down
1 change: 1 addition & 0 deletions frontend/components/Template/Selector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PopoverTrigger as-child>
<Button
:id="id"
data-testid="template-selector-compact"
variant="outline"
size="icon"
role="combobox"
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/global/StatCard/StatCard.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<Card class="flex flex-col items-center bg-secondary p-3 text-secondary-foreground shadow">
<Card data-testid="stat-card" class="flex flex-col items-center bg-secondary p-3 text-secondary-foreground shadow">
<CardHeader class="p-0">
<CardTitle class="text-sm font-medium">{{ title }}</CardTitle>
</CardHeader>
<CardContent class="p-0 text-2xl font-bold">
<CardContent data-testid="stat-card-value" class="p-0 text-2xl font-bold">
<Currency v-if="type === 'currency'" :amount="value" />
<template v-if="type === 'number'">{{ value }}</template>
</CardContent>
Expand Down
4 changes: 3 additions & 1 deletion frontend/lib/api/classes/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ export class ItemsApi extends BaseAPI {
// =========================================================================

async getLocations(q: LocationsQuery = { filterChildren: false }) {
const resp = await this.http.get<{ items: EntitySummary[] }>({ url: route("/entities", { ...q, isLocation: true }) });
const resp = await this.http.get<{ items: EntitySummary[] }>({
url: route("/entities", { ...q, isLocation: true }),
});
// Unwrap paginated response to flat array for backward compat
return {
...resp,
Expand Down
36 changes: 12 additions & 24 deletions frontend/pages/collection/index/entity-types.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
import { Badge } from "@/components/ui/badge";
import { Card } from "@/components/ui/card";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { useDialog } from "@/components/ui/dialog-provider";
import { DialogID } from "~/components/ui/dialog-provider/utils";
import FormTextField from "~/components/Form/TextField.vue";
Expand Down Expand Up @@ -98,7 +92,11 @@
updateForm.icon = et.icon;
updateForm.isLocation = et.isLocation;
updateTemplate.value = et.defaultTemplate
? { id: et.defaultTemplate.id, name: et.defaultTemplate.name, description: et.defaultTemplate.description } as EntityTemplateSummary
? ({
id: et.defaultTemplate.id,
name: et.defaultTemplate.name,
description: et.defaultTemplate.description,
} as EntityTemplateSummary)
: null;
openDialog(DialogID.UpdateEntityType);
}
Expand Down Expand Up @@ -154,13 +152,7 @@
<DialogTitle>Create Entity Type</DialogTitle>
</DialogHeader>
<form class="flex flex-col gap-3" @submit.prevent="create">
<FormTextField
v-model="createForm.name"
:autofocus="true"
label="Name"
:max-length="255"
:min-length="1"
/>
<FormTextField v-model="createForm.name" :autofocus="true" label="Name" :max-length="255" :min-length="1" />
<FormCheckbox v-model="createForm.isLocation" label="Is a container / location type" />
<TemplateSelector v-model="createTemplate" />

Expand All @@ -178,13 +170,7 @@
<DialogTitle>Update Entity Type</DialogTitle>
</DialogHeader>
<form class="flex flex-col gap-3" @submit.prevent="update">
<FormTextField
v-model="updateForm.name"
:autofocus="true"
label="Name"
:max-length="255"
:min-length="1"
/>
<FormTextField v-model="updateForm.name" :autofocus="true" label="Name" :max-length="255" :min-length="1" />
<FormCheckbox v-model="updateForm.isLocation" label="Is a container / location type" />
<TemplateSelector v-model="updateTemplate" />

Expand All @@ -196,7 +182,7 @@
</Dialog>

<!-- Page Content -->
<div class="flex items-center justify-between mb-4">
<div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-medium">Entity Types</h3>
<Button size="sm" @click="openDialog(DialogID.CreateEntityType)">
<MdiPlus class="mr-1 size-4" />
Expand All @@ -207,7 +193,9 @@
<div v-if="entityTypes && entityTypes.length > 0" class="space-y-2">
<Card v-for="et in entityTypes" :key="et.id" class="p-4">
<div class="flex items-center gap-3">
<div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-secondary text-secondary-foreground">
<div
class="flex size-10 shrink-0 items-center justify-center rounded-full bg-secondary text-secondary-foreground"
>
<MdiMapMarkerOutline v-if="et.isLocation" class="size-5" />
<MdiPackageVariantClosed v-else class="size-5" />
</div>
Expand Down
24 changes: 19 additions & 5 deletions frontend/pages/item/[id]/index/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -692,25 +692,33 @@
</div>
<button
v-else
data-testid="attachment-upload-button"
class="grid h-24 w-full place-content-center border-2 border-dashed border-primary"
@click="clickUpload"
>
<input ref="refAttachmentInput" hidden type="file" @change="uploadImage" />
<input
ref="refAttachmentInput"
data-testid="attachment-file-input"
hidden
type="file"
@change="uploadImage"
/>
<p>{{ $t("items.drag_and_drop") }}</p>
</button>
</div>

<div class="border-t p-4">
<ul role="list" class="divide-y rounded-md border">
<ul role="list" data-testid="attachments-list" class="divide-y rounded-md border">
<li
v-for="attachment in item.attachments"
:key="attachment.id"
:data-testid="`attachment-row-${attachment.title}`"
class="grid grid-cols-6 justify-between py-3 pl-3 pr-4 text-sm"
>
<p class="col-span-4 my-auto">
{{ attachment.title }}
</p>
<p class="my-auto">
<p data-testid="attachment-type" class="my-auto">
{{ $t(`items.${attachment.type}`) }}
</p>
<div class="flex justify-end gap-2">
Expand All @@ -719,6 +727,7 @@
<Button
variant="outline"
size="icon"
data-testid="attachment-view"
@click="
openDialog(DialogID.ItemImage, {
params: {
Expand All @@ -743,15 +752,20 @@
</Tooltip>
<Tooltip>
<TooltipTrigger as-child>
<Button variant="destructive" size="icon" @click="deleteAttachment(attachment.id)">
<Button
variant="destructive"
size="icon"
data-testid="attachment-delete"
@click="deleteAttachment(attachment.id)"
>
<MdiDelete />
</Button>
</TooltipTrigger>
<TooltipContent>{{ $t("global.delete") }}</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger as-child>
<Button size="icon" @click="openAttachmentEditDialog(attachment)">
<Button size="icon" data-testid="attachment-edit" @click="openAttachmentEditDialog(attachment)">
<MdiPencil />
</Button>
</TooltipTrigger>
Expand Down
6 changes: 2 additions & 4 deletions frontend/pages/location/[id]/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
import BaseContainer from "@/components/Base/Container.vue";

definePageMeta({
middleware: ["auth"],
});
Expand All @@ -9,7 +11,3 @@
<NuxtPage />
</BaseContainer>
</template>

<script lang="ts">
import BaseContainer from "@/components/Base/Container.vue";
</script>
Loading
Loading