This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { n as noop, g as getContext, e as escape_html } from "../../chunks/index.js";
|
||||
import { j as getContext, c as escape_html } from "../../chunks/index2.js";
|
||||
import "clsx";
|
||||
import { w as writable } from "../../chunks/exports.js";
|
||||
import "../../chunks/state.svelte.js";
|
||||
import "@sveltejs/kit/internal";
|
||||
import "../../chunks/exports.js";
|
||||
import "../../chunks/utils2.js";
|
||||
import { w as writable } from "../../chunks/index.js";
|
||||
import "@sveltejs/kit/internal/server";
|
||||
import "../../chunks/root.js";
|
||||
import "@sveltejs/kit/internal";
|
||||
import "../../chunks/utils.js";
|
||||
function create_updated_store() {
|
||||
const { set, subscribe } = writable(false);
|
||||
{
|
||||
@@ -15,19 +17,6 @@ function create_updated_store() {
|
||||
};
|
||||
}
|
||||
}
|
||||
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
|
||||
if (is_legacy) {
|
||||
({
|
||||
data: {},
|
||||
form: null,
|
||||
error: null,
|
||||
params: {},
|
||||
route: { id: null },
|
||||
state: {},
|
||||
status: -1,
|
||||
url: new URL("https://example.com")
|
||||
});
|
||||
}
|
||||
const stores = {
|
||||
updated: /* @__PURE__ */ create_updated_store()
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { s as slot } from "../../chunks/index.js";
|
||||
import { i as slot } from "../../chunks/index2.js";
|
||||
function _layout($$renderer, $$props) {
|
||||
$$renderer.push(`<!--[-->`);
|
||||
slot($$renderer, $$props, "default", {});
|
||||
$$renderer.push(`<!--]-->`);
|
||||
$$renderer.component(($$renderer2) => {
|
||||
$$renderer2.push(`<div class="app-shell"><!--[-->`);
|
||||
slot($$renderer2, $$props, "default", {});
|
||||
$$renderer2.push(`<!--]--></div>`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
_layout as default
|
||||
|
||||
@@ -2,7 +2,7 @@ const COLLECTION = "Stackq_Items";
|
||||
const load = async ({ locals }) => {
|
||||
const list = await locals.pb.collection(COLLECTION).getFullList({ sort: "-created", expand: "Parent" }).catch(() => []);
|
||||
const itemsForParent = list.map((i) => ({ id: i.id, Item: i.Item, SKU: i.SKU }));
|
||||
return { itemsForParent };
|
||||
return { items: list, itemsForParent };
|
||||
};
|
||||
export {
|
||||
load
|
||||
|
||||
@@ -1,96 +1,65 @@
|
||||
import "clsx";
|
||||
import { a as attributes, c as clsx, b as bind_props } from "../../chunks/index.js";
|
||||
import { c as cn } from "../../chunks/utils2.js";
|
||||
import { tv } from "tailwind-variants";
|
||||
const buttonVariants = tv({
|
||||
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs",
|
||||
destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs",
|
||||
outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
|
||||
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs",
|
||||
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline"
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
"icon-sm": "size-8",
|
||||
"icon-lg": "size-10"
|
||||
}
|
||||
},
|
||||
defaultVariants: { variant: "default", size: "default" }
|
||||
});
|
||||
function Button($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
class: className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
ref = null,
|
||||
href = void 0,
|
||||
type = "button",
|
||||
disabled,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
if (href) {
|
||||
$$renderer2.push("<!--[-->");
|
||||
$$renderer2.push(`<a${attributes({
|
||||
"data-slot": "button",
|
||||
class: clsx(cn(buttonVariants({ variant, size }), className)),
|
||||
href: disabled ? void 0 : href,
|
||||
"aria-disabled": disabled,
|
||||
role: disabled ? "link" : void 0,
|
||||
tabindex: disabled ? -1 : void 0,
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></a>`);
|
||||
} else {
|
||||
$$renderer2.push("<!--[!-->");
|
||||
$$renderer2.push(`<button${attributes({
|
||||
"data-slot": "button",
|
||||
class: clsx(cn(buttonVariants({ variant, size }), className)),
|
||||
type,
|
||||
disabled,
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></button>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]-->`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function _page($$renderer) {
|
||||
import { B as Button } from "../../chunks/button.js";
|
||||
function _page($$renderer, $$props) {
|
||||
let { data } = $$props;
|
||||
{
|
||||
$$renderer.push("<!--[!-->");
|
||||
$$renderer.push(`<main class="flex min-h-screen flex-col items-center justify-center gap-6 p-8"><h1 class="text-2xl font-semibold">Stackq</h1> <p class="text-muted-foreground">Svelte 5 + shadcn-svelte + PocketBase</p> <div class="flex w-full max-w-xs flex-col gap-2"><a href="/items" class="block">`);
|
||||
$$renderer.push(`<main class="flex min-h-screen flex-col items-center justify-center gap-6 p-6 sm:p-8"><h1 class="text-2xl font-semibold">Stackq</h1> <div class="flex w-full max-w-xs flex-col gap-3"><a href="/items" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "w-full",
|
||||
class: "h-12 w-full min-h-12",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Items table`);
|
||||
$$renderer2.push(`<!---->Scan`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a> <a href="/transactions" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "h-12 min-h-12 w-full",
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->New Transaction`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a> <a href="/items" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "w-full",
|
||||
class: "h-12 min-h-12 w-full",
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->New item`);
|
||||
$$renderer2.push(`<!---->New Item`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a></div> <div class="text-muted-foreground w-full max-w-xs border-t pt-4 text-center text-sm">Go to</div> <div class="flex w-full max-w-xs flex-col gap-2"><a href="/items" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "h-12 min-h-12 w-full",
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Items`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a> <a href="/transactions" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "h-12 min-h-12 w-full",
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Transactions`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a> <a href="/accounts" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "h-12 min-h-12 w-full",
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Accounts`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></a> <a href="/logout" class="block">`);
|
||||
Button($$renderer, {
|
||||
class: "w-full",
|
||||
class: "h-12 min-h-12 w-full",
|
||||
variant: "outline",
|
||||
children: ($$renderer2) => {
|
||||
$$renderer2.push(`<!---->Log out`);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { h as head } from "../../../chunks/index2.js";
|
||||
import { B as Button } from "../../../chunks/button.js";
|
||||
import { C as Card, a as Card_content } from "../../../chunks/card-content.js";
|
||||
import "clsx";
|
||||
function _page($$renderer) {
|
||||
head("11yx1mx", $$renderer, ($$renderer2) => {
|
||||
$$renderer2.title(($$renderer3) => {
|
||||
$$renderer3.push(`<title>Accounts – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
$$renderer.push(`<main class="container mx-auto flex flex-col gap-6 px-4 py-6 sm:px-6 sm:py-8"><div class="flex items-center gap-3"><a href="/" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to main">Back</a> <h1 class="text-xl font-semibold sm:text-2xl">Accounts</h1></div> `);
|
||||
Card($$renderer, {
|
||||
children: ($$renderer2) => {
|
||||
Card_content($$renderer2, {
|
||||
class: "flex flex-col items-center justify-center gap-4 py-12",
|
||||
children: ($$renderer3) => {
|
||||
$$renderer3.push(`<p class="text-muted-foreground text-center text-sm">No accounts yet.</p> <p class="text-muted-foreground text-center text-xs">Accounts will appear here once this feature is available.</p> <a href="/">`);
|
||||
Button($$renderer3, {
|
||||
variant: "outline",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<!---->Back to home`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!----></a>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></main>`);
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
import { fail, redirect, error } from "@sveltejs/kit";
|
||||
const COLLECTION = "Stackq_Items";
|
||||
function parseNum(val) {
|
||||
if (val === "" || val === null || val === void 0) return void 0;
|
||||
const n = Number(val);
|
||||
return Number.isFinite(n) ? n : void 0;
|
||||
}
|
||||
function parseBool(val) {
|
||||
return val === "on" || val === "true" || val === true;
|
||||
}
|
||||
const load = async ({ params, locals }) => {
|
||||
const id = params.id;
|
||||
if (!id) throw error(404, "Item not found");
|
||||
try {
|
||||
const item = await locals.pb.collection(COLLECTION).getOne(id, { expand: "Parent" });
|
||||
const list = await locals.pb.collection(COLLECTION).getFullList({ sort: "-created", expand: "Parent" }).catch(() => []);
|
||||
const itemsForParent = list.map((i) => ({ id: i.id, Item: i.Item, SKU: i.SKU }));
|
||||
return { item, itemsForParent };
|
||||
} catch {
|
||||
throw error(404, "Item not found");
|
||||
}
|
||||
};
|
||||
const actions = {
|
||||
update: async ({ request, locals, params }) => {
|
||||
const id = params.id;
|
||||
if (!id) return fail(400, { error: "Missing id", form: "update" });
|
||||
const form = await request.formData();
|
||||
const Item = form.get("Item")?.trim() ?? "";
|
||||
const SKU = form.get("SKU")?.trim() ?? "";
|
||||
const Description = form.get("Description")?.trim() ?? "";
|
||||
const UOM = form.get("UOM")?.trim() ?? "";
|
||||
const Cost = parseNum(form.get("Cost"));
|
||||
const Vendor = form.get("Vendor")?.trim() ?? "";
|
||||
const Catagory = form.get("Catagory")?.trim() ?? "";
|
||||
const Sub_Catagory = form.get("Sub_Catagory")?.trim() ?? "";
|
||||
const Has_Parent = parseBool(form.get("Has_Parent"));
|
||||
const Parent = form.get("Parent")?.trim() ?? "";
|
||||
const Stock = parseBool(form.get("Stock"));
|
||||
const Image = form.get("Image");
|
||||
const imageFile = Image && Image.size > 0 ? Image : void 0;
|
||||
if (!Item) return fail(400, { error: "Item name is required", form: "update" });
|
||||
try {
|
||||
const body = {
|
||||
Item,
|
||||
SKU,
|
||||
Description,
|
||||
UOM: UOM || void 0,
|
||||
Cost: Cost ?? 0,
|
||||
Vendor,
|
||||
Catagory: Catagory || void 0,
|
||||
Sub_Catagory: Sub_Catagory || void 0,
|
||||
Has_Parent: !!Has_Parent,
|
||||
Parent: Parent || null,
|
||||
Stock: !!Stock
|
||||
};
|
||||
if (imageFile) body.Image = imageFile;
|
||||
await locals.pb.collection(COLLECTION).update(id, body);
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Update failed";
|
||||
return fail(500, { error: message, form: "update" });
|
||||
}
|
||||
return { success: true };
|
||||
},
|
||||
delete: async ({ locals, params }) => {
|
||||
const id = params.id;
|
||||
if (!id) return fail(400, { error: "Missing id", form: "delete" });
|
||||
try {
|
||||
await locals.pb.collection(COLLECTION).delete(id);
|
||||
} catch (e) {
|
||||
const message = e && typeof e === "object" && "message" in e ? String(e.message) : "Delete failed";
|
||||
return fail(500, { error: message, form: "delete" });
|
||||
}
|
||||
throw redirect(303, "/items");
|
||||
}
|
||||
};
|
||||
export {
|
||||
actions,
|
||||
load
|
||||
};
|
||||
@@ -0,0 +1,168 @@
|
||||
import { d as attributes, f as clsx, g as bind_props, h as head, c as escape_html, a as attr, e as ensure_array_like, b as stringify } from "../../../../chunks/index2.js";
|
||||
import "../../../../chunks/button.js";
|
||||
import { C as Card, a as Card_content } from "../../../../chunks/card-content.js";
|
||||
import "clsx";
|
||||
import { c as cn } from "../../../../chunks/utils.js";
|
||||
import "@sveltejs/kit/internal";
|
||||
import "../../../../chunks/exports.js";
|
||||
import "../../../../chunks/utils2.js";
|
||||
import "@sveltejs/kit/internal/server";
|
||||
import "../../../../chunks/root.js";
|
||||
import "../../../../chunks/state.svelte.js";
|
||||
import PocketBase from "pocketbase";
|
||||
function Card_header($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card-header",
|
||||
class: clsx(cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
const POCKETBASE_URL = "https://pocketbase.ccllc.pro";
|
||||
const POCKETBASE_BASE_URL = POCKETBASE_URL;
|
||||
let _pb = null;
|
||||
function getPb() {
|
||||
if (typeof window === "undefined") {
|
||||
throw new Error("PocketBase client is only available in the browser. Use load/actions for server data.");
|
||||
}
|
||||
if (!_pb) _pb = new PocketBase(POCKETBASE_URL);
|
||||
return _pb;
|
||||
}
|
||||
new Proxy({}, {
|
||||
get(_, prop) {
|
||||
if (prop === "baseUrl") return POCKETBASE_BASE_URL;
|
||||
return getPb()[prop];
|
||||
}
|
||||
});
|
||||
function _page($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let { data } = $$props;
|
||||
const item = data?.item;
|
||||
data?.itemsForParent ?? [];
|
||||
const PB_BASE = "https://pocketbase.ccllc.pro";
|
||||
const COLLECTION = "Stackq_Items";
|
||||
function imageUrl(i) {
|
||||
if (!i?.Image) return null;
|
||||
return `${PB_BASE}/api/files/${COLLECTION}/${i.id}/${i.Image}`;
|
||||
}
|
||||
function asList(val) {
|
||||
if (val == null) return [];
|
||||
return Array.isArray(val) ? val : [val];
|
||||
}
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
return new Date(iso).toLocaleDateString(void 0, { dateStyle: "short", timeStyle: "short" });
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
data?.form === "update" ? data?.error ?? null : null;
|
||||
let $$settled = true;
|
||||
let $$inner_renderer;
|
||||
function $$render_inner($$renderer3) {
|
||||
head("1r2vy7b", $$renderer3, ($$renderer4) => {
|
||||
$$renderer4.title(($$renderer5) => {
|
||||
$$renderer5.push(`<title>${escape_html(item?.Item ?? "Item")} – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
if (item) {
|
||||
$$renderer3.push("<!--[-->");
|
||||
$$renderer3.push(`<main class="container mx-auto flex flex-col gap-4 px-4 py-6 sm:gap-6 sm:px-6 sm:py-8"><div class="flex flex-wrap items-center gap-2 sm:gap-4 min-w-0"><a href="/" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to main">Home</a> <a href="/items" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to items">Back to items</a> <h1 class="text-xl font-semibold truncate min-w-0 flex-1 sm:text-2xl">${escape_html(item.Item ?? "—")}</h1> `);
|
||||
{
|
||||
$$renderer3.push("<!--[!-->");
|
||||
}
|
||||
$$renderer3.push(`<!--]--></div> <div class="grid gap-6 md:grid-cols-2">`);
|
||||
Card($$renderer3, {
|
||||
children: ($$renderer4) => {
|
||||
Card_header($$renderer4, {
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<h2 class="text-lg font-medium">Details</h2>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!----> `);
|
||||
Card_content($$renderer4, {
|
||||
class: "space-y-4",
|
||||
children: ($$renderer5) => {
|
||||
if (imageUrl(item)) {
|
||||
$$renderer5.push("<!--[-->");
|
||||
$$renderer5.push(`<div><a${attr("href", imageUrl(item))} target="_blank" rel="noopener noreferrer" class="block overflow-hidden rounded-lg border"><img${attr("src", imageUrl(item))} alt="" class="max-h-64 w-full object-contain"/></a></div>`);
|
||||
} else {
|
||||
$$renderer5.push("<!--[!-->");
|
||||
}
|
||||
$$renderer5.push(`<!--]--> <dl class="grid gap-2 text-sm"><div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">SKU</dt> <dd class="font-mono">${escape_html(item.SKU ?? "—")}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Description</dt> <dd>${escape_html(item.Description ?? "—")}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">UOM</dt> <dd>${escape_html(item.UOM ?? "—")}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Cost</dt> <dd>${escape_html(item.Cost != null ? Number(item.Cost).toLocaleString() : "—")}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Vendor</dt> <dd>${escape_html(item.Vendor ?? "—")}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Category</dt> <dd><!--[-->`);
|
||||
const each_array = ensure_array_like(asList(item.Catagory));
|
||||
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
||||
let cat = each_array[$$index];
|
||||
$$renderer5.push(`<span class="mr-1 rounded bg-muted px-1.5 py-0.5 text-xs">${escape_html(cat)}</span>`);
|
||||
}
|
||||
$$renderer5.push(`<!--]--> `);
|
||||
if (asList(item.Catagory).length === 0) {
|
||||
$$renderer5.push("<!--[-->");
|
||||
$$renderer5.push(`—`);
|
||||
} else {
|
||||
$$renderer5.push("<!--[!-->");
|
||||
}
|
||||
$$renderer5.push(`<!--]--></dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Sub-category</dt> <dd><!--[-->`);
|
||||
const each_array_1 = ensure_array_like(asList(item.Sub_Catagory));
|
||||
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
|
||||
let sub = each_array_1[$$index_1];
|
||||
$$renderer5.push(`<span class="mr-1 rounded border px-1.5 py-0.5 text-xs">${escape_html(sub)}</span>`);
|
||||
}
|
||||
$$renderer5.push(`<!--]--> `);
|
||||
if (asList(item.Sub_Catagory).length === 0) {
|
||||
$$renderer5.push("<!--[-->");
|
||||
$$renderer5.push(`—`);
|
||||
} else {
|
||||
$$renderer5.push("<!--[!-->");
|
||||
}
|
||||
$$renderer5.push(`<!--]--></dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Has Parent</dt> <dd>${escape_html(item.Has_Parent ? "Yes" : "No")}</dd></div> `);
|
||||
if (item.Has_Parent && item.expand?.Parent) {
|
||||
$$renderer5.push("<!--[-->");
|
||||
$$renderer5.push(`<div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Parent</dt> <dd><a${attr("href", `/items/${stringify(item.Parent)}`)} class="text-primary hover:underline">${escape_html(item.expand.Parent.Item ?? item.expand.Parent.SKU ?? item.Parent)}</a></dd></div>`);
|
||||
} else {
|
||||
$$renderer5.push("<!--[!-->");
|
||||
}
|
||||
$$renderer5.push(`<!--]--> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Stock</dt> <dd>${escape_html(item.Stock ? "Yes" : "No")}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Created</dt> <dd>${escape_html(formatDate(item.created))}</dd></div> <div class="flex gap-2"><dt class="text-muted-foreground w-24 shrink-0">Updated</dt> <dd>${escape_html(formatDate(item.updated))}</dd></div></dl>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!----></div></main> `);
|
||||
{
|
||||
$$renderer3.push("<!--[!-->");
|
||||
}
|
||||
$$renderer3.push(`<!--]-->`);
|
||||
} else {
|
||||
$$renderer3.push("<!--[!-->");
|
||||
$$renderer3.push(`<main class="container mx-auto py-8"><p class="text-muted-foreground">Item not found.</p></main>`);
|
||||
}
|
||||
$$renderer3.push(`<!--]-->`);
|
||||
}
|
||||
do {
|
||||
$$settled = true;
|
||||
$$inner_renderer = $$renderer2.copy();
|
||||
$$render_inner($$inner_renderer);
|
||||
} while (!$$settled);
|
||||
$$renderer2.subsume($$inner_renderer);
|
||||
});
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -1,127 +1,35 @@
|
||||
import { a as attributes, c as clsx, b as bind_props, d as element, h as head, e as escape_html, f as ensure_array_like, i as attr } from "../../../chunks/index.js";
|
||||
import { c as cn } from "../../../chunks/utils2.js";
|
||||
import { j as getContext, k as element, g as bind_props, d as attributes, f as clsx, l as store_get, h as head, c as escape_html, e as ensure_array_like, a as attr, b as stringify, u as unsubscribe_stores } from "../../../chunks/index2.js";
|
||||
import "clsx";
|
||||
import "@sveltejs/kit/internal";
|
||||
import "../../../chunks/exports.js";
|
||||
import "../../../chunks/utils2.js";
|
||||
import "@sveltejs/kit/internal/server";
|
||||
import "../../../chunks/root.js";
|
||||
import "../../../chunks/state.svelte.js";
|
||||
import { c as cn } from "../../../chunks/utils.js";
|
||||
import { tv } from "tailwind-variants";
|
||||
function Table($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div data-slot="table-container" class="relative w-full overflow-x-auto"><table${attributes({
|
||||
"data-slot": "table",
|
||||
class: clsx(cn("w-full caption-bottom text-sm", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></table></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_body($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<tbody${attributes({
|
||||
"data-slot": "table-body",
|
||||
class: clsx(cn("[&_tr:last-child]:border-0", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></tbody>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_cell($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<td${attributes({
|
||||
"data-slot": "table-cell",
|
||||
class: clsx(cn("bg-clip-padding p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></td>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_head($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<th${attributes({
|
||||
"data-slot": "table-head",
|
||||
class: clsx(cn("text-foreground h-10 bg-clip-padding px-2 text-start align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pe-0", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></th>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_header($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<thead${attributes({
|
||||
"data-slot": "table-header",
|
||||
class: clsx(cn("[&_tr]:border-b", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></thead>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Table_row($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<tr${attributes({
|
||||
"data-slot": "table-row",
|
||||
class: clsx(cn("hover:[&,&>svelte-css-wrapper]:[&>th,td]:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></tr>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
import { C as Card, a as Card_content } from "../../../chunks/card-content.js";
|
||||
const getStores = () => {
|
||||
const stores$1 = getContext("__svelte__");
|
||||
return {
|
||||
/** @type {typeof page} */
|
||||
page: {
|
||||
subscribe: stores$1.page.subscribe
|
||||
},
|
||||
/** @type {typeof navigating} */
|
||||
navigating: {
|
||||
subscribe: stores$1.navigating.subscribe
|
||||
},
|
||||
/** @type {typeof updated} */
|
||||
updated: stores$1.updated
|
||||
};
|
||||
};
|
||||
const page = {
|
||||
subscribe(fn) {
|
||||
const store = getStores().page;
|
||||
return store.subscribe(fn);
|
||||
}
|
||||
};
|
||||
const badgeVariants = tv({
|
||||
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",
|
||||
variants: {
|
||||
@@ -165,61 +73,11 @@ function Badge($$renderer, $$props) {
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Card($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card",
|
||||
class: clsx(cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function Card_content($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let {
|
||||
ref = null,
|
||||
class: className,
|
||||
children,
|
||||
$$slots,
|
||||
$$events,
|
||||
...restProps
|
||||
} = $$props;
|
||||
$$renderer2.push(`<div${attributes({
|
||||
"data-slot": "card-content",
|
||||
class: clsx(cn("px-6", className)),
|
||||
...restProps
|
||||
})}>`);
|
||||
children?.($$renderer2);
|
||||
$$renderer2.push(`<!----></div>`);
|
||||
bind_props($$props, { ref });
|
||||
});
|
||||
}
|
||||
function _page($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
var $$store_subs;
|
||||
let { data } = $$props;
|
||||
function asList(val) {
|
||||
if (val == null) return [];
|
||||
return Array.isArray(val) ? val : [val];
|
||||
}
|
||||
function formatDate(iso) {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
return new Date(iso).toLocaleDateString(void 0, { dateStyle: "short", timeStyle: "short" });
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
store_get($$store_subs ??= {}, "$page", page).url.searchParams.get("q") ?? "";
|
||||
const items = data?.items ?? [];
|
||||
const PB_BASE = "https://pocketbase.ccllc.pro";
|
||||
const COLLECTION = "Stackq_Items";
|
||||
@@ -234,411 +92,84 @@ function _page($$renderer, $$props) {
|
||||
});
|
||||
{
|
||||
$$renderer2.push("<!--[!-->");
|
||||
$$renderer2.push(`<main class="container mx-auto flex flex-col gap-6 py-8"><div class="flex items-center justify-between"><h1 class="text-2xl font-semibold">Stackq Items</h1> <span class="text-muted-foreground text-sm">${escape_html(items.length)} items</span></div> `);
|
||||
Card($$renderer2, {
|
||||
children: ($$renderer3) => {
|
||||
Card_content($$renderer3, {
|
||||
class: "p-0",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push("<!---->");
|
||||
Table?.($$renderer4, {
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push("<!---->");
|
||||
Table_header?.($$renderer5, {
|
||||
children: ($$renderer6) => {
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Image`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Item`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->SKU`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "max-w-[200px]",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Description`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->UOM`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "text-right",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Cost`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Vendor`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Catagory`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Sub_Catagory`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Has Parent`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Parent`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->Stock`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->created`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_head?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->updated`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer6.push(`<!---->`);
|
||||
$$renderer2.push(`<main class="container mx-auto flex flex-col gap-6 px-4 py-8"><div class="flex items-center justify-between"><h1 class="text-2xl font-semibold">Stackq Items</h1> <span class="text-muted-foreground text-sm">${escape_html(items.length)} items</span></div> `);
|
||||
if (items.length === 0) {
|
||||
$$renderer2.push("<!--[-->");
|
||||
Card($$renderer2, {
|
||||
children: ($$renderer3) => {
|
||||
Card_content($$renderer3, {
|
||||
class: "flex h-32 items-center justify-center",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<p class="text-muted-foreground text-sm">No items.</p>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer2.push("<!--[!-->");
|
||||
$$renderer2.push(`<div class="flex flex-col gap-2"><!--[-->`);
|
||||
const each_array = ensure_array_like(items);
|
||||
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
||||
let item = each_array[$$index];
|
||||
Card($$renderer2, {
|
||||
class: "overflow-hidden",
|
||||
children: ($$renderer3) => {
|
||||
Card_content($$renderer3, {
|
||||
class: "flex flex-row items-center gap-3 p-3",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<div class="size-12 shrink-0 overflow-hidden rounded border">`);
|
||||
if (imageUrl(item)) {
|
||||
$$renderer4.push("<!--[-->");
|
||||
$$renderer4.push(`<img${attr("src", imageUrl(item))} alt="" class="size-full object-cover" loading="lazy"/>`);
|
||||
} else {
|
||||
$$renderer4.push("<!--[!-->");
|
||||
$$renderer4.push(`<span class="text-muted-foreground flex size-full items-center justify-center text-xs">—</span>`);
|
||||
}
|
||||
$$renderer4.push(`<!--]--></div> <div class="min-w-0 flex-1"><a${attr("href", `/items/${stringify(item.id)}`)} class="font-medium hover:underline">${escape_html(item.Item ?? "—")}</a> <span class="text-muted-foreground font-mono text-xs">· ${escape_html(item.SKU ?? "—")}</span> `);
|
||||
if (item.Description) {
|
||||
$$renderer4.push("<!--[-->");
|
||||
$$renderer4.push(`<span class="text-muted-foreground ml-1 truncate text-xs">· ${escape_html(item.Description)}</span>`);
|
||||
} else {
|
||||
$$renderer4.push("<!--[!-->");
|
||||
}
|
||||
$$renderer4.push(`<!--]--></div> <div class="flex shrink-0 items-center gap-2 text-xs">`);
|
||||
Badge($$renderer4, {
|
||||
variant: "outline",
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<!---->${escape_html(item.UOM ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer5.push(`<!----> `);
|
||||
$$renderer5.push("<!---->");
|
||||
Table_body?.($$renderer5, {
|
||||
children: ($$renderer6) => {
|
||||
if (items.length === 0) {
|
||||
$$renderer6.push("<!--[-->");
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
colspan: "14",
|
||||
class: "h-24 text-center text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->No items.`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer6.push(`<!---->`);
|
||||
} else {
|
||||
$$renderer6.push("<!--[!-->");
|
||||
$$renderer6.push(`<!--[-->`);
|
||||
const each_array = ensure_array_like(items);
|
||||
for (let $$index_2 = 0, $$length = each_array.length; $$index_2 < $$length; $$index_2++) {
|
||||
let item = each_array[$$index_2];
|
||||
$$renderer6.push("<!---->");
|
||||
Table_row?.($$renderer6, {
|
||||
children: ($$renderer7) => {
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "w-16",
|
||||
children: ($$renderer8) => {
|
||||
if (imageUrl(item)) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`<img${attr("src", imageUrl(item))} alt="" class="size-14 rounded border object-cover" loading="lazy"/>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground text-xs">—</span>`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "font-medium",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Item ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "font-mono text-xs",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.SKU ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "max-w-[200px] truncate",
|
||||
title: item.Description ?? "",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Description ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
Badge($$renderer8, {
|
||||
variant: "outline",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->${escape_html(item.UOM ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-right tabular-nums",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Cost != null ? Number(item.Cost).toLocaleString() : "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(item.Vendor ?? "—")}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!--[-->`);
|
||||
const each_array_1 = ensure_array_like(asList(item.Catagory));
|
||||
for (let $$index = 0, $$length2 = each_array_1.length; $$index < $$length2; $$index++) {
|
||||
let cat = each_array_1[$$index];
|
||||
Badge($$renderer8, {
|
||||
variant: "secondary",
|
||||
class: "mr-1 text-xs",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->${escape_html(cat)}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
}
|
||||
$$renderer8.push(`<!--]--> `);
|
||||
if (asList(item.Catagory).length === 0) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">—</span>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!--[-->`);
|
||||
const each_array_2 = ensure_array_like(asList(item.Sub_Catagory));
|
||||
for (let $$index_1 = 0, $$length2 = each_array_2.length; $$index_1 < $$length2; $$index_1++) {
|
||||
let sub = each_array_2[$$index_1];
|
||||
Badge($$renderer8, {
|
||||
variant: "outline",
|
||||
class: "mr-1 text-xs",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->${escape_html(sub)}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
}
|
||||
$$renderer8.push(`<!--]--> `);
|
||||
if (asList(item.Sub_Catagory).length === 0) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">—</span>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
if (item.Has_Parent) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
Badge($$renderer8, {
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->Yes`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">No</span>`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground",
|
||||
children: ($$renderer8) => {
|
||||
if (item.expand?.Parent) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
$$renderer8.push(`${escape_html(item.expand.Parent.Item ?? item.expand.Parent.SKU ?? item.Parent)}`);
|
||||
} else if (item.Parent) {
|
||||
$$renderer8.push("<!--[1-->");
|
||||
$$renderer8.push(`<span class="font-mono text-xs">${escape_html(item.Parent)}</span>`);
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`—`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
children: ($$renderer8) => {
|
||||
if (item.Stock) {
|
||||
$$renderer8.push("<!--[-->");
|
||||
Badge($$renderer8, {
|
||||
variant: "default",
|
||||
children: ($$renderer9) => {
|
||||
$$renderer9.push(`<!---->Stock`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer8.push("<!--[!-->");
|
||||
$$renderer8.push(`<span class="text-muted-foreground">—</span>`);
|
||||
}
|
||||
$$renderer8.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground text-xs",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(formatDate(item.created))}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!----> `);
|
||||
$$renderer7.push("<!---->");
|
||||
Table_cell?.($$renderer7, {
|
||||
class: "text-muted-foreground text-xs",
|
||||
children: ($$renderer8) => {
|
||||
$$renderer8.push(`<!---->${escape_html(formatDate(item.updated))}`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer7.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer6.push(`<!---->`);
|
||||
}
|
||||
$$renderer6.push(`<!--]-->`);
|
||||
}
|
||||
$$renderer6.push(`<!--]-->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer5.push(`<!---->`);
|
||||
$$renderer4.push(`<!----> <span class="tabular-nums">${escape_html(item.Cost != null ? Number(item.Cost).toLocaleString() : "—")}</span> `);
|
||||
if (item.Stock) {
|
||||
$$renderer4.push("<!--[-->");
|
||||
Badge($$renderer4, {
|
||||
variant: "default",
|
||||
class: "text-xs",
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<!---->Stock`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer4.push("<!--[!-->");
|
||||
}
|
||||
$$renderer4.push(`<!--]--></div>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!---->`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer2.push(`<!----></main>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]--></div>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]--></main>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]-->`);
|
||||
if ($$store_subs) unsubscribe_stores($$store_subs);
|
||||
});
|
||||
}
|
||||
export {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { h as head, c as escape_html } from "../../../../chunks/index2.js";
|
||||
import { B as Button } from "../../../../chunks/button.js";
|
||||
import { C as Card, a as Card_content } from "../../../../chunks/card-content.js";
|
||||
import "clsx";
|
||||
function _page($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let { data, params } = $$props;
|
||||
head("8mhk6q", $$renderer2, ($$renderer3) => {
|
||||
$$renderer3.title(($$renderer4) => {
|
||||
$$renderer4.push(`<title>Receipt – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
$$renderer2.push(`<main class="container mx-auto flex flex-col gap-6 px-4 py-6 sm:px-6 sm:py-8"><div class="flex items-center gap-3"><a href="/receipts" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to receipts">Back</a> <h1 class="text-xl font-semibold sm:text-2xl">Receipt</h1></div> `);
|
||||
Card($$renderer2, {
|
||||
children: ($$renderer3) => {
|
||||
Card_content($$renderer3, {
|
||||
class: "flex flex-col gap-4 py-8",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<p class="text-muted-foreground text-sm">Receipt ${escape_html(params.id)}</p> <a href="/receipts">`);
|
||||
Button($$renderer4, {
|
||||
variant: "outline",
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<!---->Back to receipts`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!----></a>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer2.push(`<!----></main>`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
const load = async () => {
|
||||
return { receipts: [] };
|
||||
};
|
||||
export {
|
||||
load
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
import { h as head, e as ensure_array_like, a as attr, b as stringify, c as escape_html } from "../../../chunks/index2.js";
|
||||
import { B as Button } from "../../../chunks/button.js";
|
||||
import { C as Card, a as Card_content } from "../../../chunks/card-content.js";
|
||||
import "clsx";
|
||||
function _page($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let { data } = $$props;
|
||||
const receipts = data?.receipts ?? [];
|
||||
head("16kr07e", $$renderer2, ($$renderer3) => {
|
||||
$$renderer3.title(($$renderer4) => {
|
||||
$$renderer4.push(`<title>Receipts – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
$$renderer2.push(`<main class="container mx-auto flex flex-col gap-6 px-4 py-6 sm:px-6 sm:py-8"><div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"><div class="flex items-center gap-3"><a href="/" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to main">Back</a> <h1 class="text-xl font-semibold sm:text-2xl">Receipts</h1></div> <a href="/receipts/new" class="block shrink-0">`);
|
||||
Button($$renderer2, {
|
||||
class: "w-full sm:w-auto",
|
||||
children: ($$renderer3) => {
|
||||
$$renderer3.push(`<!---->New receipt`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer2.push(`<!----></a></div> `);
|
||||
if (receipts.length === 0) {
|
||||
$$renderer2.push("<!--[-->");
|
||||
Card($$renderer2, {
|
||||
children: ($$renderer3) => {
|
||||
Card_content($$renderer3, {
|
||||
class: "flex flex-col items-center justify-center gap-4 py-12",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<p class="text-muted-foreground text-center text-sm">No receipts yet.</p> <p class="text-muted-foreground text-center text-xs">Create a receipt to get started.</p> <a href="/receipts/new">`);
|
||||
Button($$renderer4, {
|
||||
variant: "outline",
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<!---->New receipt`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!----></a> <a href="/">`);
|
||||
Button($$renderer4, {
|
||||
variant: "ghost",
|
||||
children: ($$renderer5) => {
|
||||
$$renderer5.push(`<!---->Back to home`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer4.push(`<!----></a>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
} else {
|
||||
$$renderer2.push("<!--[!-->");
|
||||
$$renderer2.push(`<div class="flex flex-col gap-2"><!--[-->`);
|
||||
const each_array = ensure_array_like(receipts);
|
||||
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
||||
let receipt = each_array[$$index];
|
||||
Card($$renderer2, {
|
||||
children: ($$renderer3) => {
|
||||
Card_content($$renderer3, {
|
||||
class: "p-4",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<a${attr("href", `/receipts/${stringify(receipt.id)}`)} class="font-medium hover:underline">Receipt ${escape_html(receipt.id)}</a>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
}
|
||||
$$renderer2.push(`<!--]--></div>`);
|
||||
}
|
||||
$$renderer2.push(`<!--]--></main>`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
import { h as head } from "../../../../chunks/index2.js";
|
||||
import { B as Button } from "../../../../chunks/button.js";
|
||||
import { C as Card, a as Card_content } from "../../../../chunks/card-content.js";
|
||||
import "clsx";
|
||||
function _page($$renderer) {
|
||||
head("1mqc1bt", $$renderer, ($$renderer2) => {
|
||||
$$renderer2.title(($$renderer3) => {
|
||||
$$renderer3.push(`<title>New receipt – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
$$renderer.push(`<main class="container mx-auto flex flex-col gap-6 px-4 py-6 sm:px-6 sm:py-8"><div class="flex items-center gap-3"><a href="/receipts" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to receipts">Back</a> <h1 class="text-xl font-semibold sm:text-2xl">New receipt</h1></div> `);
|
||||
Card($$renderer, {
|
||||
children: ($$renderer2) => {
|
||||
Card_content($$renderer2, {
|
||||
class: "flex flex-col gap-4 py-8",
|
||||
children: ($$renderer3) => {
|
||||
$$renderer3.push(`<p class="text-muted-foreground text-center text-sm">Receipt creation will be available here.</p> <div class="flex justify-center gap-2"><a href="/receipts">`);
|
||||
Button($$renderer3, {
|
||||
variant: "outline",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<!---->Back to receipts`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!----></a> <a href="/">`);
|
||||
Button($$renderer3, {
|
||||
variant: "ghost",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<!---->Home`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!----></a></div>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></main>`);
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
import { h as head } from "../../../chunks/index2.js";
|
||||
import { B as Button } from "../../../chunks/button.js";
|
||||
import { C as Card, a as Card_content } from "../../../chunks/card-content.js";
|
||||
import "clsx";
|
||||
function _page($$renderer) {
|
||||
head("1q0dtg6", $$renderer, ($$renderer2) => {
|
||||
$$renderer2.title(($$renderer3) => {
|
||||
$$renderer3.push(`<title>Transactions – Stackq</title>`);
|
||||
});
|
||||
});
|
||||
$$renderer.push(`<main class="container mx-auto flex flex-col gap-6 px-4 py-6 sm:px-6 sm:py-8"><div class="flex items-center gap-3"><a href="/" class="text-muted-foreground hover:text-foreground shrink-0 text-sm" title="Back to main">Back</a> <h1 class="text-xl font-semibold sm:text-2xl">Transactions</h1></div> `);
|
||||
Card($$renderer, {
|
||||
children: ($$renderer2) => {
|
||||
Card_content($$renderer2, {
|
||||
class: "flex flex-col items-center justify-center gap-4 py-12",
|
||||
children: ($$renderer3) => {
|
||||
$$renderer3.push(`<p class="text-muted-foreground text-center text-sm">No transactions yet.</p> <p class="text-muted-foreground text-center text-xs">Transactions will appear here once this feature is available.</p> <a href="/">`);
|
||||
Button($$renderer3, {
|
||||
variant: "outline",
|
||||
children: ($$renderer4) => {
|
||||
$$renderer4.push(`<!---->Back to home`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer3.push(`<!----></a>`);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$renderer.push(`<!----></main>`);
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
Reference in New Issue
Block a user