mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 13:23:14 +01:00
This commit is contained in:
@@ -2286,6 +2286,10 @@ const docTemplate = `{
|
||||
"archived": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"assetId": {
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -2279,6 +2279,10 @@
|
||||
"archived": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"assetId": {
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -217,6 +217,9 @@ definitions:
|
||||
properties:
|
||||
archived:
|
||||
type: boolean
|
||||
assetId:
|
||||
example: "0"
|
||||
type: string
|
||||
createdAt:
|
||||
type: string
|
||||
description:
|
||||
|
||||
@@ -115,6 +115,7 @@ type (
|
||||
ItemSummary struct {
|
||||
ImportRef string `json:"-"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
AssetID AssetID `json:"assetId,string"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Quantity int `json:"quantity"`
|
||||
@@ -190,6 +191,7 @@ func mapItemSummary(item *ent.Item) ItemSummary {
|
||||
|
||||
return ItemSummary{
|
||||
ID: item.ID,
|
||||
AssetID: AssetID(item.AssetID),
|
||||
Name: item.Name,
|
||||
Description: item.Description,
|
||||
ImportRef: item.ImportRef,
|
||||
@@ -422,6 +424,8 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Ite
|
||||
qb = qb.Order(ent.Desc(item.FieldCreatedAt))
|
||||
case "updatedAt":
|
||||
qb = qb.Order(ent.Desc(item.FieldUpdatedAt))
|
||||
case "assetId":
|
||||
qb = qb.Order(ent.Asc(item.FieldAssetID))
|
||||
default: // "name"
|
||||
qb = qb.Order(ent.Asc(item.FieldName))
|
||||
}
|
||||
|
||||
@@ -2279,6 +2279,10 @@
|
||||
"archived": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"assetId": {
|
||||
"type": "string",
|
||||
"example": "0"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -134,6 +134,8 @@ export interface ItemPath {
|
||||
|
||||
export interface ItemSummary {
|
||||
archived: boolean;
|
||||
/** @example "0" */
|
||||
assetId: string;
|
||||
createdAt: Date | string;
|
||||
description: string;
|
||||
id: string;
|
||||
|
||||
@@ -183,21 +183,20 @@
|
||||
return route(`/qrcode`, { data: encodeURIComponent(data) });
|
||||
}
|
||||
|
||||
function getItem(n: number, item: { name: string; location: { name: string } } | null): LabelData {
|
||||
function getItem(n: number, item: { assetId: string; name: string; location: { name: string } } | null): LabelData {
|
||||
// format n into - seperated string with leading zeros
|
||||
|
||||
const assetID = fmtAssetID(n);
|
||||
const assetID = fmtAssetID(n + 1);
|
||||
|
||||
return {
|
||||
url: getQRCodeUrl(assetID),
|
||||
assetID,
|
||||
assetID: item?.assetId ?? assetID,
|
||||
name: item?.name ?? "_______________",
|
||||
location: item?.location?.name ?? "_______________",
|
||||
};
|
||||
}
|
||||
|
||||
const { data: allFields } = await useAsyncData(async () => {
|
||||
const { data, error } = await api.items.getAll();
|
||||
const { data, error } = await api.items.getAll({ orderBy: "assetId" });
|
||||
|
||||
if (error) {
|
||||
return {
|
||||
@@ -220,10 +219,10 @@
|
||||
}
|
||||
|
||||
const items: LabelData[] = [];
|
||||
for (let i = displayProperties.assetRange; i < displayProperties.assetRangeMax; i++) {
|
||||
for (let i = displayProperties.assetRange - 1; i < displayProperties.assetRangeMax - 1; i++) {
|
||||
const item = allFields?.value?.items?.[i];
|
||||
if (item?.location) {
|
||||
items.push(getItem(i, item as { location: { name: string }; name: string }));
|
||||
items.push(getItem(i, item as { assetId: string; location: { name: string }; name: string }));
|
||||
} else {
|
||||
items.push(getItem(i, null));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user