@lambda-development/erp-core 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +7 -0
- package/dist/index.js +1010 -975
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as S, useEffect as se, useCallback as we, useContext as In, createContext as Ln, useRef as H, useMemo as Ce, useLayoutEffect as tn, StrictMode as sa } from "react";
|
|
3
3
|
import { createRoot as ia } from "react-dom/client";
|
|
4
|
-
import { useQueryClient as We, useQuery as
|
|
4
|
+
import { useQueryClient as We, useQuery as le, useMutation as pe, QueryClientProvider as la, QueryClient as oa } from "@tanstack/react-query";
|
|
5
5
|
import { NavLink as kt, useLocation as dt, useNavigate as Oe, Outlet as ca, Navigate as da, Link as ye, useSearchParams as wt, useParams as ut, createBrowserRouter as ua, RouterProvider as ma } from "react-router-dom";
|
|
6
6
|
import { useTranslation as Z, initReactI18next as pa } from "react-i18next";
|
|
7
7
|
import { BookOpen as ha, ShoppingCart as Bn, CreditCard as ga, FileText as jt, Package as En, BarChart3 as ya, Database as fa, Settings as ba, MessageCircle as xa, ChevronDown as Wt, ChevronRight as Kt, Plus as On, Trash2 as qn, LineChart as va, TrendingUp as Na, ArrowDownRight as Sa, ArrowUpRight as ka, Wallet as wa, Receipt as nn } from "lucide-react";
|
|
@@ -173,10 +173,10 @@ const O = {
|
|
|
173
173
|
getSettings: () => E("/auth/settings"),
|
|
174
174
|
updateSettings: (t) => E("/auth/settings", { method: "PUT", body: JSON.stringify(t) }),
|
|
175
175
|
getDemoSpend: () => E("/admin/demo-spend")
|
|
176
|
-
},
|
|
176
|
+
}, Un = Ln(null);
|
|
177
177
|
function Ea({ children: t }) {
|
|
178
|
-
const [n, a] =
|
|
179
|
-
|
|
178
|
+
const [n, a] = S(null), [s, l] = S(!0);
|
|
179
|
+
se(() => {
|
|
180
180
|
O.authMe().then((m) => a(m)).catch(() => a(null)).finally(() => l(!1));
|
|
181
181
|
}, []);
|
|
182
182
|
const i = we(async (m, d) => {
|
|
@@ -192,14 +192,14 @@ function Ea({ children: t }) {
|
|
|
192
192
|
}
|
|
193
193
|
a(null);
|
|
194
194
|
}, []);
|
|
195
|
-
return /* @__PURE__ */ e(
|
|
195
|
+
return /* @__PURE__ */ e(Un.Provider, { value: { user: n, loading: s, login: i, register: c, logout: o }, children: t });
|
|
196
196
|
}
|
|
197
197
|
function mt() {
|
|
198
|
-
const t = In(
|
|
198
|
+
const t = In(Un);
|
|
199
199
|
if (!t) throw new Error("useAuth must be used within AuthProvider");
|
|
200
200
|
return t;
|
|
201
201
|
}
|
|
202
|
-
const
|
|
202
|
+
const Vn = Ln(null), ln = {
|
|
203
203
|
quotation: { group: "Selling", item: "Quotation" },
|
|
204
204
|
"sales-order": { group: "Selling", item: "Sales Order" },
|
|
205
205
|
"sales-invoice": { group: "Selling", item: "Sales Invoice" },
|
|
@@ -278,67 +278,67 @@ function dn(t) {
|
|
|
278
278
|
function qa() {
|
|
279
279
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `req-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Ue(t) {
|
|
282
282
|
if (!t) return 0;
|
|
283
283
|
const n = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(t) ? t.replace(" ", "T") : t, a = new Date(n).getTime();
|
|
284
284
|
return Number.isNaN(a) ? 0 : a;
|
|
285
285
|
}
|
|
286
286
|
function za({ children: t }) {
|
|
287
|
-
const n = We(), [a, s] =
|
|
288
|
-
function
|
|
287
|
+
const n = We(), [a, s] = S([]), [l, i] = S({}), [c, o] = S({}), [m, d] = S({}), [u, p] = S({}), [v, D] = S({}), [h, y] = S({}), [R, B] = S({}), [C, b] = S(null), [g, _] = S("connecting"), [w, N] = S(0), q = H(null), x = H(null), z = H(/* @__PURE__ */ new Map()), j = H(null), V = H({}), Y = H({}), de = H(null);
|
|
288
|
+
function P(k) {
|
|
289
289
|
for (const G of z.current.values())
|
|
290
|
-
G.reject(new Error(
|
|
290
|
+
G.reject(new Error(k));
|
|
291
291
|
z.current.clear();
|
|
292
292
|
}
|
|
293
|
-
function K(
|
|
293
|
+
function K(k, G) {
|
|
294
294
|
i((W) => ({
|
|
295
295
|
...W,
|
|
296
|
-
[
|
|
296
|
+
[k]: G(W[k] ?? [])
|
|
297
297
|
}));
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
|
|
299
|
+
function ie(k, G) {
|
|
300
|
+
D((W) => ({ ...W, [k]: G }));
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
y((W) => ({ ...W, [
|
|
302
|
+
function oe(k, G) {
|
|
303
|
+
y((W) => ({ ...W, [k]: G }));
|
|
304
304
|
}
|
|
305
|
-
function ge(
|
|
306
|
-
|
|
305
|
+
function ge(k, G) {
|
|
306
|
+
B((W) => ({ ...W, [k]: G }));
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
310
|
-
b((W) => (W == null ? void 0 : W.group) ===
|
|
308
|
+
function T(k, G) {
|
|
309
|
+
de.current !== null && window.clearTimeout(de.current), b({ group: k, item: G, key: Date.now() }), de.current = window.setTimeout(() => {
|
|
310
|
+
b((W) => (W == null ? void 0 : W.group) === k && (W == null ? void 0 : W.item) === G ? null : W), de.current = null;
|
|
311
311
|
}, 1100);
|
|
312
312
|
}
|
|
313
|
-
function Q(
|
|
314
|
-
return [...
|
|
315
|
-
const Se =
|
|
316
|
-
return (
|
|
313
|
+
function Q(k) {
|
|
314
|
+
return [...k].sort((G, W) => {
|
|
315
|
+
const Se = Ue(V.current[G.id]) || Ue(G.last_message_at || void 0) || Ue(G.created_at);
|
|
316
|
+
return (Ue(V.current[W.id]) || Ue(W.last_message_at || void 0) || Ue(W.created_at)) - Se;
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
s((G) => Q(
|
|
319
|
+
function ce(k) {
|
|
320
|
+
s((G) => Q(k(G)));
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
const W = G || (/* @__PURE__ */ new Date()).toISOString(), Se =
|
|
324
|
-
|
|
325
|
-
...
|
|
326
|
-
[
|
|
322
|
+
function ae(k, G) {
|
|
323
|
+
const W = G || (/* @__PURE__ */ new Date()).toISOString(), Se = V.current[k];
|
|
324
|
+
Ue(W) >= Ue(Se) && (V.current = {
|
|
325
|
+
...V.current,
|
|
326
|
+
[k]: W
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
function Be(
|
|
330
|
-
const G = { ...
|
|
331
|
-
for (const W of
|
|
329
|
+
function Be(k) {
|
|
330
|
+
const G = { ...V.current };
|
|
331
|
+
for (const W of k)
|
|
332
332
|
W.last_message_at && !G[W.id] && (G[W.id] = W.last_message_at);
|
|
333
|
-
|
|
333
|
+
V.current = G;
|
|
334
334
|
}
|
|
335
|
-
function Pe(
|
|
335
|
+
function Pe(k) {
|
|
336
336
|
const G = q.current;
|
|
337
337
|
if (!G || G.readyState !== WebSocket.OPEN)
|
|
338
338
|
throw new Error("Chat is disconnected.");
|
|
339
|
-
G.send(JSON.stringify(
|
|
339
|
+
G.send(JSON.stringify(k));
|
|
340
340
|
}
|
|
341
|
-
function _e(
|
|
341
|
+
function _e(k, G, W) {
|
|
342
342
|
return new Promise((Se, fe) => {
|
|
343
343
|
const ve = qa();
|
|
344
344
|
z.current.set(ve, {
|
|
@@ -347,40 +347,40 @@ function za({ children: t }) {
|
|
|
347
347
|
reject: fe
|
|
348
348
|
});
|
|
349
349
|
try {
|
|
350
|
-
Pe({ type:
|
|
350
|
+
Pe({ type: k, request_id: ve, ...G });
|
|
351
351
|
} catch (Je) {
|
|
352
352
|
z.current.delete(ve), fe(Je instanceof Error ? Je : new Error("Chat request failed."));
|
|
353
353
|
}
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
-
|
|
357
|
-
let
|
|
356
|
+
se(() => {
|
|
357
|
+
let k = !1;
|
|
358
358
|
function G() {
|
|
359
|
-
if (
|
|
360
|
-
|
|
359
|
+
if (k) return;
|
|
360
|
+
_("connecting");
|
|
361
361
|
const Se = `${window.location.protocol === "https:" ? "wss:" : "ws:"}//${window.location.host}/ws/chat`, fe = new WebSocket(Se);
|
|
362
362
|
q.current = fe, fe.onopen = () => {
|
|
363
|
-
if (
|
|
363
|
+
if (k) {
|
|
364
364
|
fe.close();
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
-
|
|
367
|
+
_("connected"), N((ve) => ve + 1);
|
|
368
368
|
}, fe.onmessage = (ve) => {
|
|
369
369
|
var Je;
|
|
370
370
|
try {
|
|
371
|
-
const F = JSON.parse(ve.data), Ye = typeof F.request_id == "string" ? F.request_id : null,
|
|
371
|
+
const F = JSON.parse(ve.data), Ye = typeof F.request_id == "string" ? F.request_id : null, ue = typeof F.type == "string" ? F.type : null, I = typeof F.session_id == "string" ? F.session_id : null;
|
|
372
372
|
if (Ye) {
|
|
373
|
-
const
|
|
374
|
-
|
|
373
|
+
const L = z.current.get(Ye);
|
|
374
|
+
L && (ue === "error" ? (z.current.delete(Ye), L.reject(new Error(String(F.content || "Request failed.")))) : ue === L.expectedType && (z.current.delete(Ye), L.resolve(F)));
|
|
375
375
|
}
|
|
376
|
-
if (
|
|
377
|
-
const
|
|
378
|
-
Be(
|
|
376
|
+
if (ue === "sessions_list") {
|
|
377
|
+
const L = Array.isArray(F.sessions) ? F.sessions : [];
|
|
378
|
+
Be(L), s(
|
|
379
379
|
Q(
|
|
380
|
-
|
|
380
|
+
L
|
|
381
381
|
)
|
|
382
382
|
);
|
|
383
|
-
const M = new Set(
|
|
383
|
+
const M = new Set(L.map((be) => be.id)), Te = [...Qt()].filter((be) => !M.has(be));
|
|
384
384
|
Te.length > 0 && Promise.all(
|
|
385
385
|
Te.map(async (be) => {
|
|
386
386
|
try {
|
|
@@ -391,115 +391,115 @@ function za({ children: t }) {
|
|
|
391
391
|
}
|
|
392
392
|
})
|
|
393
393
|
).then((be) => {
|
|
394
|
-
const f = be.filter((
|
|
395
|
-
f.length && (Be(f),
|
|
396
|
-
...f.filter((
|
|
397
|
-
...
|
|
394
|
+
const f = be.filter((A) => !!A);
|
|
395
|
+
f.length && (Be(f), ce((A) => [
|
|
396
|
+
...f.filter((te) => !A.some((re) => re.id === te.id)),
|
|
397
|
+
...A
|
|
398
398
|
]));
|
|
399
399
|
});
|
|
400
400
|
return;
|
|
401
401
|
}
|
|
402
|
-
if (
|
|
403
|
-
const
|
|
404
|
-
if (!
|
|
405
|
-
Wn(
|
|
402
|
+
if (ue === "session_created") {
|
|
403
|
+
const L = F.session;
|
|
404
|
+
if (!L) return;
|
|
405
|
+
Wn(L.id), Be([L]), ce((M) => [L, ...M.filter(($) => $.id !== L.id)]);
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
if (
|
|
409
|
-
dn(
|
|
408
|
+
if (ue === "session_deleted" && I) {
|
|
409
|
+
dn(I), ce((M) => M.filter(($) => $.id !== I)), i((M) => {
|
|
410
410
|
const $ = { ...M };
|
|
411
|
-
return delete $[
|
|
412
|
-
}),
|
|
411
|
+
return delete $[I], $;
|
|
412
|
+
}), D((M) => {
|
|
413
413
|
const $ = { ...M };
|
|
414
|
-
return delete $[
|
|
414
|
+
return delete $[I], $;
|
|
415
415
|
}), y((M) => {
|
|
416
416
|
const $ = { ...M };
|
|
417
|
-
return delete $[
|
|
418
|
-
}),
|
|
417
|
+
return delete $[I], $;
|
|
418
|
+
}), B((M) => {
|
|
419
419
|
const $ = { ...M };
|
|
420
|
-
return delete $[
|
|
420
|
+
return delete $[I], $;
|
|
421
421
|
}), o((M) => {
|
|
422
422
|
const $ = { ...M };
|
|
423
|
-
return delete $[
|
|
423
|
+
return delete $[I], $;
|
|
424
424
|
}), d((M) => {
|
|
425
425
|
const $ = { ...M };
|
|
426
|
-
return delete $[
|
|
426
|
+
return delete $[I], $;
|
|
427
427
|
}), p((M) => {
|
|
428
428
|
const $ = { ...M };
|
|
429
|
-
return delete $[
|
|
429
|
+
return delete $[I], $;
|
|
430
430
|
});
|
|
431
|
-
const
|
|
432
|
-
delete
|
|
431
|
+
const L = { ...V.current };
|
|
432
|
+
delete L[I], V.current = L;
|
|
433
433
|
return;
|
|
434
434
|
}
|
|
435
|
-
if (
|
|
436
|
-
const
|
|
435
|
+
if (ue === "history_loaded" && I) {
|
|
436
|
+
const L = Array.isArray(F.messages) ? F.messages.map(cn) : [], M = F.before_id != null, $ = !!F.has_more, Te = typeof F.oldest_id == "number" ? F.oldest_id : null;
|
|
437
437
|
i((f) => {
|
|
438
438
|
if (M) {
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
),
|
|
442
|
-
(
|
|
439
|
+
const A = f[I] ?? [], te = new Set(
|
|
440
|
+
A.map((ne) => ne.id).filter((ne) => typeof ne == "number")
|
|
441
|
+
), re = L.filter(
|
|
442
|
+
(ne) => ne.id === void 0 || !te.has(ne.id)
|
|
443
443
|
);
|
|
444
|
-
return { ...f, [
|
|
444
|
+
return { ...f, [I]: [...re, ...A] };
|
|
445
445
|
}
|
|
446
|
-
return { ...f, [
|
|
447
|
-
}), o((f) => ({ ...f, [
|
|
446
|
+
return { ...f, [I]: L };
|
|
447
|
+
}), o((f) => ({ ...f, [I]: $ })), d((f) => ({ ...f, [I]: Te })), p((f) => ({ ...f, [I]: !1 }));
|
|
448
448
|
const be = typeof F.title == "string" ? F.title : null;
|
|
449
|
-
if (be &&
|
|
450
|
-
(f) => f.map((
|
|
449
|
+
if (be && ce(
|
|
450
|
+
(f) => f.map((A) => A.id === I ? { ...A, title: be } : A)
|
|
451
451
|
), !M) {
|
|
452
|
-
const f =
|
|
453
|
-
f != null && f.timestamp && (
|
|
452
|
+
const f = L[L.length - 1];
|
|
453
|
+
f != null && f.timestamp && (ae(I, f.timestamp), ce((A) => A));
|
|
454
454
|
}
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
if (
|
|
458
|
-
i((
|
|
457
|
+
if (ue === "history_cleared" && I) {
|
|
458
|
+
i((L) => ({ ...L, [I]: [] })), o((L) => ({ ...L, [I]: !1 })), d((L) => ({ ...L, [I]: null })), p((L) => ({ ...L, [I]: !1 })), ie(I, !1), oe(I, "idle"), ge(I, null);
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
|
-
if (
|
|
462
|
-
const
|
|
463
|
-
if (!
|
|
464
|
-
|
|
461
|
+
if (ue === "message_added" && I) {
|
|
462
|
+
const L = F.message;
|
|
463
|
+
if (!L) return;
|
|
464
|
+
ae(I, L.created_at), L.role === "user" && ge(I, null), K(I, (M) => [
|
|
465
465
|
...M.filter(($) => $.type !== "thinking"),
|
|
466
|
-
cn(
|
|
467
|
-
]),
|
|
466
|
+
cn(L)
|
|
467
|
+
]), ce((M) => M);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
if (
|
|
471
|
-
|
|
470
|
+
if (ue === "demo_started" && I) {
|
|
471
|
+
oe(I, "running"), ge(I, null);
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
474
|
-
if (
|
|
475
|
-
|
|
474
|
+
if (ue === "demo_typing" && I) {
|
|
475
|
+
oe(I, "running"), ge(I, {
|
|
476
476
|
content: String(F.content || ""),
|
|
477
477
|
seq: Math.max(0, Number(F.seq || 0)),
|
|
478
478
|
typingMs: Math.max(0, Number(F.typing_ms || 0))
|
|
479
479
|
});
|
|
480
480
|
return;
|
|
481
481
|
}
|
|
482
|
-
if (
|
|
483
|
-
|
|
482
|
+
if (ue === "demo_replay_complete" && I) {
|
|
483
|
+
oe(I, "complete"), ge(I, null);
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
|
-
if (
|
|
487
|
-
const
|
|
488
|
-
|
|
486
|
+
if (ue === "navigation_flash") {
|
|
487
|
+
const L = typeof F.group == "string" ? F.group : "", M = typeof F.item == "string" ? F.item : void 0;
|
|
488
|
+
L && T(L, M);
|
|
489
489
|
return;
|
|
490
490
|
}
|
|
491
|
-
if (
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
(M) => M.map(($) => $.id ===
|
|
491
|
+
if (ue === "session_title_updated" && I) {
|
|
492
|
+
const L = typeof F.title == "string" ? F.title : "";
|
|
493
|
+
ce(
|
|
494
|
+
(M) => M.map(($) => $.id === I ? { ...$, title: L } : $)
|
|
495
495
|
);
|
|
496
496
|
return;
|
|
497
497
|
}
|
|
498
|
-
if (
|
|
499
|
-
|
|
500
|
-
const M =
|
|
498
|
+
if (ue === "thinking" && I) {
|
|
499
|
+
ie(I, !0), K(I, (L) => {
|
|
500
|
+
const M = L.find(($) => $.type === "thinking");
|
|
501
501
|
return [
|
|
502
|
-
...
|
|
502
|
+
...L.filter(($) => $.type !== "thinking"),
|
|
503
503
|
{
|
|
504
504
|
type: "thinking",
|
|
505
505
|
content: `Thinking (step ${F.iteration})...`,
|
|
@@ -510,33 +510,33 @@ function za({ children: t }) {
|
|
|
510
510
|
});
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
|
-
if (
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
...
|
|
517
|
-
provider:
|
|
513
|
+
if (ue === "llm_provider" && I) {
|
|
514
|
+
const L = typeof F.provider == "string" ? F.provider : void 0, M = typeof F.model == "string" ? F.model : void 0, Te = (typeof F.role == "string" ? F.role : void 0) === "code_specialist" ? "Delegating to code specialist..." : void 0;
|
|
515
|
+
ie(I, !0), K(I, (be) => be.some((A) => A.type === "thinking") ? be.map((A) => A.type === "thinking" ? {
|
|
516
|
+
...A,
|
|
517
|
+
provider: L,
|
|
518
518
|
model: M,
|
|
519
519
|
...Te ? { content: Te } : {}
|
|
520
|
-
} :
|
|
520
|
+
} : A) : [
|
|
521
521
|
...be,
|
|
522
522
|
{
|
|
523
523
|
type: "thinking",
|
|
524
524
|
content: Te ?? "Thinking...",
|
|
525
|
-
provider:
|
|
525
|
+
provider: L,
|
|
526
526
|
model: M
|
|
527
527
|
}
|
|
528
528
|
]);
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
531
|
-
if (
|
|
531
|
+
if (ue === "tool_call" && I) {
|
|
532
532
|
Y.current = {
|
|
533
533
|
...Y.current,
|
|
534
|
-
[
|
|
534
|
+
[I]: {
|
|
535
535
|
tool: String(F.tool || ""),
|
|
536
536
|
args: F.args
|
|
537
537
|
}
|
|
538
|
-
}, K(
|
|
539
|
-
...
|
|
538
|
+
}, K(I, (L) => [
|
|
539
|
+
...L.filter((M) => M.type !== "thinking"),
|
|
540
540
|
{
|
|
541
541
|
type: "tool_call",
|
|
542
542
|
content: `Calling ${F.tool}...`,
|
|
@@ -546,20 +546,20 @@ function za({ children: t }) {
|
|
|
546
546
|
]);
|
|
547
547
|
return;
|
|
548
548
|
}
|
|
549
|
-
if (
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
552
|
-
if (
|
|
553
|
-
const $ = typeof F.report_id == "string" ? F.report_id : void 0, Te = typeof ((Je =
|
|
554
|
-
|
|
549
|
+
if (ue === "tool_result" && I) {
|
|
550
|
+
const L = Y.current[I];
|
|
551
|
+
if (L && L.tool === String(F.tool || "") && F.success)
|
|
552
|
+
if (L.tool === "create_custom_analytics_report" || L.tool === "update_custom_analytics_report") {
|
|
553
|
+
const $ = typeof F.report_id == "string" ? F.report_id : void 0, Te = typeof ((Je = L.args) == null ? void 0 : Je.report_id) == "string" ? L.args.report_id : void 0;
|
|
554
|
+
T("Custom Analytics", $ || Te || ""), n.invalidateQueries({ queryKey: ["runtime-drafts"] });
|
|
555
555
|
} else {
|
|
556
|
-
const $ = Oa(
|
|
557
|
-
$ &&
|
|
556
|
+
const $ = Oa(L.tool, L.args);
|
|
557
|
+
$ && T($.group, $.item);
|
|
558
558
|
}
|
|
559
559
|
Y.current = {
|
|
560
560
|
...Y.current,
|
|
561
|
-
[
|
|
562
|
-
}, K(
|
|
561
|
+
[I]: null
|
|
562
|
+
}, K(I, (M) => [
|
|
563
563
|
...M,
|
|
564
564
|
{
|
|
565
565
|
type: "tool_result",
|
|
@@ -570,15 +570,15 @@ function za({ children: t }) {
|
|
|
570
570
|
]);
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
|
-
if (
|
|
574
|
-
|
|
573
|
+
if (ue === "complete" && I) {
|
|
574
|
+
ie(I, !1), K(I, (L) => L.filter((M) => M.type !== "thinking"));
|
|
575
575
|
return;
|
|
576
576
|
}
|
|
577
|
-
if (
|
|
577
|
+
if (ue === "error") {
|
|
578
578
|
if (Ye)
|
|
579
579
|
return;
|
|
580
|
-
|
|
581
|
-
...
|
|
580
|
+
I && (ie(I, !1), K(I, (L) => [
|
|
581
|
+
...L.filter((M) => M.type !== "thinking"),
|
|
582
582
|
{ type: "error", content: String(F.content || "Chat error.") }
|
|
583
583
|
]));
|
|
584
584
|
}
|
|
@@ -587,7 +587,7 @@ function za({ children: t }) {
|
|
|
587
587
|
}, fe.onerror = () => {
|
|
588
588
|
fe.close();
|
|
589
589
|
}, fe.onclose = (ve) => {
|
|
590
|
-
if (q.current === fe && (q.current = null),
|
|
590
|
+
if (q.current === fe && (q.current = null), P("Chat disconnected."), _("disconnected"), !k) {
|
|
591
591
|
if (ve.code === 4001 || ve.code === 4003) {
|
|
592
592
|
window.location.href = "/login";
|
|
593
593
|
return;
|
|
@@ -597,7 +597,7 @@ function za({ children: t }) {
|
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
return G(), () => {
|
|
600
|
-
if (
|
|
600
|
+
if (k = !0, x.current !== null && window.clearTimeout(x.current), de.current !== null && window.clearTimeout(de.current), P("Chat disconnected."), q.current) {
|
|
601
601
|
const W = q.current;
|
|
602
602
|
q.current = null, W.close();
|
|
603
603
|
}
|
|
@@ -606,90 +606,90 @@ function za({ children: t }) {
|
|
|
606
606
|
async function $e() {
|
|
607
607
|
if (j.current)
|
|
608
608
|
return j.current;
|
|
609
|
-
const
|
|
610
|
-
j.current ===
|
|
609
|
+
const k = _e("create_session", {}, "session_created").then((G) => G.session).finally(() => {
|
|
610
|
+
j.current === k && (j.current = null);
|
|
611
611
|
});
|
|
612
|
-
return j.current =
|
|
612
|
+
return j.current = k, k;
|
|
613
613
|
}
|
|
614
|
-
async function Re(
|
|
615
|
-
|
|
614
|
+
async function Re(k) {
|
|
615
|
+
oe(k, "running"), ge(k, null);
|
|
616
616
|
try {
|
|
617
|
-
await _e("start_demo", { session_id:
|
|
617
|
+
await _e("start_demo", { session_id: k }, "demo_started");
|
|
618
618
|
} catch (G) {
|
|
619
|
-
throw
|
|
619
|
+
throw oe(k, "idle"), G;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
function he(
|
|
622
|
+
function he(k, G) {
|
|
623
623
|
try {
|
|
624
|
-
Pe({ type: "demo_typing_done", session_id:
|
|
624
|
+
Pe({ type: "demo_typing_done", session_id: k, seq: G });
|
|
625
625
|
} catch {
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
async function xe(
|
|
629
|
-
await _e("delete_session", { session_id:
|
|
628
|
+
async function xe(k) {
|
|
629
|
+
await _e("delete_session", { session_id: k }, "session_deleted");
|
|
630
630
|
}
|
|
631
|
-
async function qe(
|
|
632
|
-
await _e("load_history", { session_id:
|
|
631
|
+
async function qe(k) {
|
|
632
|
+
await _e("load_history", { session_id: k }, "history_loaded");
|
|
633
633
|
}
|
|
634
|
-
async function ze(
|
|
635
|
-
if (u[
|
|
636
|
-
const G = m[
|
|
637
|
-
if (G != null && c[
|
|
638
|
-
p((W) => ({ ...W, [
|
|
634
|
+
async function ze(k) {
|
|
635
|
+
if (u[k]) return;
|
|
636
|
+
const G = m[k];
|
|
637
|
+
if (G != null && c[k]) {
|
|
638
|
+
p((W) => ({ ...W, [k]: !0 }));
|
|
639
639
|
try {
|
|
640
640
|
await _e(
|
|
641
641
|
"load_history",
|
|
642
|
-
{ session_id:
|
|
642
|
+
{ session_id: k, before_id: G },
|
|
643
643
|
"history_loaded"
|
|
644
644
|
);
|
|
645
645
|
} catch (W) {
|
|
646
|
-
throw p((Se) => ({ ...Se, [
|
|
646
|
+
throw p((Se) => ({ ...Se, [k]: !1 })), W;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
async function Ae(
|
|
651
|
-
await _e("clear_history", { session_id:
|
|
650
|
+
async function Ae(k) {
|
|
651
|
+
await _e("clear_history", { session_id: k }, "history_cleared");
|
|
652
652
|
}
|
|
653
|
-
function nt(
|
|
653
|
+
function nt(k, G, W) {
|
|
654
654
|
const Se = G.trim(), fe = ((W == null ? void 0 : W.length) ?? 0) > 0;
|
|
655
655
|
if (!Se && !fe) return !1;
|
|
656
656
|
try {
|
|
657
|
-
|
|
657
|
+
ie(k, !0);
|
|
658
658
|
const ve = {
|
|
659
659
|
type: "send_message",
|
|
660
|
-
session_id:
|
|
660
|
+
session_id: k,
|
|
661
661
|
content: Se
|
|
662
662
|
};
|
|
663
663
|
return fe && (ve.attachment_ids = W), Pe(ve), !0;
|
|
664
664
|
} catch {
|
|
665
|
-
return
|
|
665
|
+
return ie(k, !1), !1;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
function Qe(
|
|
669
|
-
return
|
|
668
|
+
function Qe(k) {
|
|
669
|
+
return k ? l[k] ?? [] : [];
|
|
670
670
|
}
|
|
671
|
-
function at(
|
|
672
|
-
return
|
|
671
|
+
function at(k) {
|
|
672
|
+
return k ? !!v[k] : !1;
|
|
673
673
|
}
|
|
674
|
-
function _t(
|
|
675
|
-
return
|
|
674
|
+
function _t(k) {
|
|
675
|
+
return k ? !!c[k] : !1;
|
|
676
676
|
}
|
|
677
|
-
function He(
|
|
678
|
-
return
|
|
677
|
+
function He(k) {
|
|
678
|
+
return k ? !!u[k] : !1;
|
|
679
679
|
}
|
|
680
|
-
function pt(
|
|
681
|
-
return
|
|
680
|
+
function pt(k) {
|
|
681
|
+
return k ? h[k] ?? "idle" : "idle";
|
|
682
682
|
}
|
|
683
|
-
function At(
|
|
684
|
-
return
|
|
683
|
+
function At(k) {
|
|
684
|
+
return k ? R[k] ?? null : null;
|
|
685
685
|
}
|
|
686
686
|
return /* @__PURE__ */ e(
|
|
687
|
-
|
|
687
|
+
Vn.Provider,
|
|
688
688
|
{
|
|
689
689
|
value: {
|
|
690
690
|
sessions: a,
|
|
691
|
-
connectionStatus:
|
|
692
|
-
connectionVersion:
|
|
691
|
+
connectionStatus: g,
|
|
692
|
+
connectionVersion: w,
|
|
693
693
|
navigationFlash: C,
|
|
694
694
|
createSession: $e,
|
|
695
695
|
startDemo: Re,
|
|
@@ -711,7 +711,7 @@ function za({ children: t }) {
|
|
|
711
711
|
);
|
|
712
712
|
}
|
|
713
713
|
function tt() {
|
|
714
|
-
const t = In(
|
|
714
|
+
const t = In(Vn);
|
|
715
715
|
if (!t)
|
|
716
716
|
throw new Error("useChat must be used within ChatProvider.");
|
|
717
717
|
return t;
|
|
@@ -865,7 +865,7 @@ function un(t) {
|
|
|
865
865
|
localStorage.setItem(Kn, JSON.stringify([...t]));
|
|
866
866
|
}
|
|
867
867
|
function Ht(t) {
|
|
868
|
-
const [n, a] =
|
|
868
|
+
const [n, a] = S(() => !Bt().has(t)), s = we(() => {
|
|
869
869
|
a((i) => {
|
|
870
870
|
const c = Bt();
|
|
871
871
|
return i ? c.add(t) : c.delete(t), un(c), !i;
|
|
@@ -968,25 +968,25 @@ function Yt() {
|
|
|
968
968
|
}
|
|
969
969
|
);
|
|
970
970
|
}
|
|
971
|
-
function
|
|
972
|
-
const [t, n, a] = Ht("custom-analytics"), s = dt(), l = Oe(), i = We(), { t: c } = Z(), { navigationFlash: o, sessions: m, createSession: d } = tt(), u = (o == null ? void 0 : o.group) === "Custom Analytics", p = Jt["Custom Analytics"], { data: v } =
|
|
971
|
+
function Ua() {
|
|
972
|
+
const [t, n, a] = Ht("custom-analytics"), s = dt(), l = Oe(), i = We(), { t: c } = Z(), { navigationFlash: o, sessions: m, createSession: d } = tt(), u = (o == null ? void 0 : o.group) === "Custom Analytics", p = Jt["Custom Analytics"], { data: v } = le({
|
|
973
973
|
queryKey: ["runtime-drafts"],
|
|
974
974
|
queryFn: () => O.listRuntimeDrafts(),
|
|
975
975
|
staleTime: 3e4
|
|
976
|
-
}),
|
|
977
|
-
|
|
976
|
+
}), D = (v == null ? void 0 : v.drafts) ?? [];
|
|
977
|
+
se(() => {
|
|
978
978
|
(o == null ? void 0 : o.group) === "Custom Analytics" && (a(), i.invalidateQueries({ queryKey: ["runtime-drafts"] }));
|
|
979
979
|
}, [o == null ? void 0 : o.key, i, a]);
|
|
980
|
-
const
|
|
981
|
-
mutationFn: (
|
|
982
|
-
onSuccess: (
|
|
980
|
+
const h = pe({
|
|
981
|
+
mutationFn: (B) => O.deleteRuntimeDraft(B),
|
|
982
|
+
onSuccess: (B, C) => {
|
|
983
983
|
i.invalidateQueries({ queryKey: ["runtime-drafts"] }), s.search.includes(`report_id=${C}`) && l("/reports/analytics");
|
|
984
984
|
}
|
|
985
|
-
}), y = async (
|
|
986
|
-
|
|
987
|
-
},
|
|
985
|
+
}), y = async (B, C) => {
|
|
986
|
+
B.preventDefault(), B.stopPropagation(), h.mutate(C);
|
|
987
|
+
}, R = async () => {
|
|
988
988
|
var b;
|
|
989
|
-
const
|
|
989
|
+
const B = "Build me a custom analytics report: <describe what you want — e.g. top 10 customers by revenue for the last quarter, or monthly purchases trend by supplier>";
|
|
990
990
|
let C = ((b = m[0]) == null ? void 0 : b.id) || "";
|
|
991
991
|
if (!C)
|
|
992
992
|
try {
|
|
@@ -995,7 +995,7 @@ function Va() {
|
|
|
995
995
|
l("/reports/analytics");
|
|
996
996
|
return;
|
|
997
997
|
}
|
|
998
|
-
l(`/chat/${C}`, { state: { prefillMessage:
|
|
998
|
+
l(`/chat/${C}`, { state: { prefillMessage: B } });
|
|
999
999
|
};
|
|
1000
1000
|
return /* @__PURE__ */ r("div", { children: [
|
|
1001
1001
|
/* @__PURE__ */ r(
|
|
@@ -1018,7 +1018,7 @@ function Va() {
|
|
|
1018
1018
|
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ r(
|
|
1019
1019
|
"button",
|
|
1020
1020
|
{
|
|
1021
|
-
onClick:
|
|
1021
|
+
onClick: R,
|
|
1022
1022
|
className: "flex w-full items-center gap-2 px-4 py-1.5 pl-10 text-sm text-brand transition-colors hover:bg-brand/5",
|
|
1023
1023
|
children: [
|
|
1024
1024
|
/* @__PURE__ */ e(On, { className: "h-3.5 w-3.5" }),
|
|
@@ -1026,8 +1026,8 @@ function Va() {
|
|
|
1026
1026
|
]
|
|
1027
1027
|
}
|
|
1028
1028
|
) }),
|
|
1029
|
-
|
|
1030
|
-
const C = `/reports/analytics?report_id=${
|
|
1029
|
+
D.map((B) => {
|
|
1030
|
+
const C = `/reports/analytics?report_id=${B.id}`, b = s.pathname === "/reports/analytics" && s.search.includes(`report_id=${B.id}`), g = (o == null ? void 0 : o.group) === "Custom Analytics" && (o == null ? void 0 : o.item) === B.id;
|
|
1031
1031
|
return /* @__PURE__ */ r("li", { className: "group relative", children: [
|
|
1032
1032
|
/* @__PURE__ */ e(
|
|
1033
1033
|
kt,
|
|
@@ -1037,28 +1037,28 @@ function Va() {
|
|
|
1037
1037
|
"relative block truncate px-4 py-1.5 pl-10 pr-8 text-sm transition-all duration-300",
|
|
1038
1038
|
!b && "text-fg-muted hover:bg-surface-subtle hover:text-fg",
|
|
1039
1039
|
b && "bg-surface-subtle font-medium text-fg",
|
|
1040
|
-
|
|
1040
|
+
g && p
|
|
1041
1041
|
),
|
|
1042
|
-
title:
|
|
1043
|
-
children:
|
|
1042
|
+
title: B.title,
|
|
1043
|
+
children: B.title
|
|
1044
1044
|
}
|
|
1045
1045
|
),
|
|
1046
1046
|
b && /* @__PURE__ */ e(Yt, {}),
|
|
1047
1047
|
/* @__PURE__ */ e(
|
|
1048
1048
|
"button",
|
|
1049
1049
|
{
|
|
1050
|
-
onClick: (
|
|
1050
|
+
onClick: (_) => y(_, B.id),
|
|
1051
1051
|
className: "absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-fg-muted opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100",
|
|
1052
1052
|
title: c("nav.deleteReport"),
|
|
1053
1053
|
children: /* @__PURE__ */ e(qn, { className: "h-3.5 w-3.5" })
|
|
1054
1054
|
}
|
|
1055
1055
|
)
|
|
1056
|
-
] },
|
|
1056
|
+
] }, B.id);
|
|
1057
1057
|
})
|
|
1058
1058
|
] })
|
|
1059
1059
|
] });
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function Va({ group: t }) {
|
|
1062
1062
|
const [n, a] = Ht(t.label), { t: s } = Z(), { navigationFlash: l } = tt(), i = (l == null ? void 0 : l.group) === t.label, c = Jt[t.label] ?? "bg-blue-300 text-blue-950 ring-2 ring-inset ring-blue-100";
|
|
1063
1063
|
return /* @__PURE__ */ r("div", { children: [
|
|
1064
1064
|
/* @__PURE__ */ r(
|
|
@@ -1106,11 +1106,11 @@ const Ga = {
|
|
|
1106
1106
|
};
|
|
1107
1107
|
function ja({ isMobileOpen: t = !1, onClose: n }) {
|
|
1108
1108
|
var o;
|
|
1109
|
-
const { data: a } =
|
|
1109
|
+
const { data: a } = le({
|
|
1110
1110
|
queryKey: ["settings"],
|
|
1111
1111
|
queryFn: () => O.getSettings(),
|
|
1112
1112
|
staleTime: 6e4
|
|
1113
|
-
}), { data: s } =
|
|
1113
|
+
}), { data: s } = le({
|
|
1114
1114
|
queryKey: ["setup-status"],
|
|
1115
1115
|
queryFn: () => O.setupStatus(),
|
|
1116
1116
|
staleTime: 6e4
|
|
@@ -1166,8 +1166,8 @@ function ja({ isMobileOpen: t = !1, onClose: n }) {
|
|
|
1166
1166
|
] }),
|
|
1167
1167
|
/* @__PURE__ */ r("nav", { className: "flex-1 overflow-y-auto py-3", children: [
|
|
1168
1168
|
/* @__PURE__ */ e($a, {}),
|
|
1169
|
-
/* @__PURE__ */ e(
|
|
1170
|
-
c.map((m) => /* @__PURE__ */ e(
|
|
1169
|
+
/* @__PURE__ */ e(Ua, {}),
|
|
1170
|
+
c.map((m) => /* @__PURE__ */ e(Va, { group: m }, m.label))
|
|
1171
1171
|
] })
|
|
1172
1172
|
]
|
|
1173
1173
|
}
|
|
@@ -1197,8 +1197,8 @@ function Ka() {
|
|
|
1197
1197
|
return /* @__PURE__ */ e(za, { children: /* @__PURE__ */ e(Qa, {}) });
|
|
1198
1198
|
}
|
|
1199
1199
|
function Qa() {
|
|
1200
|
-
const { pathname: t } = dt(), { user: n, logout: a } = mt(), { navigationFlash: s } = tt(), { t: l } = Z(), i = Wa(t, l), [c, o] =
|
|
1201
|
-
|
|
1200
|
+
const { pathname: t } = dt(), { user: n, logout: a } = mt(), { navigationFlash: s } = tt(), { t: l } = Z(), i = Wa(t, l), [c, o] = S(!1);
|
|
1201
|
+
se(() => {
|
|
1202
1202
|
o(!1);
|
|
1203
1203
|
}, [t]);
|
|
1204
1204
|
const m = s ? Jt[s.group] : null;
|
|
@@ -1252,7 +1252,7 @@ function Ha({ children: t }) {
|
|
|
1252
1252
|
const { user: n, loading: a } = mt();
|
|
1253
1253
|
return a ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-gray-400", children: "Loading..." }) }) : n ? /* @__PURE__ */ e(Ne, { children: t }) : /* @__PURE__ */ e(da, { to: "/login", replace: !0 });
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function U({ title: t, children: n, className: a, interactive: s }) {
|
|
1256
1256
|
return /* @__PURE__ */ r(
|
|
1257
1257
|
"div",
|
|
1258
1258
|
{
|
|
@@ -1315,7 +1315,7 @@ function Zt({ status: t }) {
|
|
|
1315
1315
|
}
|
|
1316
1316
|
function Fe(t) {
|
|
1317
1317
|
var s;
|
|
1318
|
-
const { data: n } =
|
|
1318
|
+
const { data: n } = le({
|
|
1319
1319
|
queryKey: ["setup-status"],
|
|
1320
1320
|
queryFn: () => O.setupStatus(),
|
|
1321
1321
|
staleTime: 3e5
|
|
@@ -1330,7 +1330,7 @@ function Fe(t) {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
function gt({ title: t, value: n, icon: a, tone: s }) {
|
|
1332
1332
|
const l = s ?? "text-brand bg-brand/10", i = Fe();
|
|
1333
|
-
return /* @__PURE__ */ e(
|
|
1333
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-4", children: [
|
|
1334
1334
|
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
1335
1335
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-fg-muted", children: t }),
|
|
1336
1336
|
/* @__PURE__ */ e("p", { className: "mt-1.5 text-2xl font-semibold tracking-tight tabular-nums text-fg", children: ((o) => Le(o, i))(n ?? 0) })
|
|
@@ -1339,7 +1339,7 @@ function gt({ title: t, value: n, icon: a, tone: s }) {
|
|
|
1339
1339
|
] }) });
|
|
1340
1340
|
}
|
|
1341
1341
|
function yt() {
|
|
1342
|
-
return /* @__PURE__ */ e(
|
|
1342
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-4", children: [
|
|
1343
1343
|
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
|
|
1344
1344
|
/* @__PURE__ */ e("div", { className: "h-4 w-24 animate-pulse rounded bg-surface-subtle" }),
|
|
1345
1345
|
/* @__PURE__ */ e("div", { className: "mt-2.5 h-7 w-32 animate-pulse rounded bg-surface-subtle" })
|
|
@@ -1385,7 +1385,7 @@ function ot() {
|
|
|
1385
1385
|
] });
|
|
1386
1386
|
}
|
|
1387
1387
|
function tr() {
|
|
1388
|
-
const { t } = Z(), { data: n, isLoading: a } =
|
|
1388
|
+
const { t } = Z(), { data: n, isLoading: a } = le({
|
|
1389
1389
|
queryKey: ["dashboard-summary"],
|
|
1390
1390
|
queryFn: () => O.dashboardSummary()
|
|
1391
1391
|
});
|
|
@@ -1433,7 +1433,7 @@ function tr() {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
)
|
|
1435
1435
|
] }) }),
|
|
1436
|
-
/* @__PURE__ */ e(
|
|
1436
|
+
/* @__PURE__ */ e(U, { title: t("dashboard.recentDocuments"), children: /* @__PURE__ */ e("div", { className: "-mx-3 space-y-0.5", children: a ? /* @__PURE__ */ r(Ne, { children: [
|
|
1437
1437
|
/* @__PURE__ */ e(ot, {}),
|
|
1438
1438
|
/* @__PURE__ */ e(ot, {}),
|
|
1439
1439
|
/* @__PURE__ */ e(ot, {}),
|
|
@@ -1443,7 +1443,7 @@ function tr() {
|
|
|
1443
1443
|
] });
|
|
1444
1444
|
}
|
|
1445
1445
|
function nr(t, n) {
|
|
1446
|
-
const { data: a, isLoading: s, error: l, refetch: i } =
|
|
1446
|
+
const { data: a, isLoading: s, error: l, refetch: i } = le({
|
|
1447
1447
|
queryKey: ["documents", t, n],
|
|
1448
1448
|
queryFn: () => O.listDocuments(t, n),
|
|
1449
1449
|
enabled: !!t
|
|
@@ -1491,7 +1491,7 @@ function J(t, n) {
|
|
|
1491
1491
|
);
|
|
1492
1492
|
return [i, c];
|
|
1493
1493
|
}
|
|
1494
|
-
const
|
|
1494
|
+
const Ve = [
|
|
1495
1495
|
{ name: "item_code", label: "Item", type: "link", linkDoctype: "item", required: !0 },
|
|
1496
1496
|
{ name: "item_name", label: "Item Name", type: "text", readOnly: !0 },
|
|
1497
1497
|
{ name: "qty", label: "Qty", type: "number", required: !0 },
|
|
@@ -1535,7 +1535,7 @@ const Ue = [
|
|
|
1535
1535
|
{ name: "remarks", label: "Notes / Terms", type: "textarea" }
|
|
1536
1536
|
],
|
|
1537
1537
|
childTables: [
|
|
1538
|
-
{ key: "items", label: "Items", fields:
|
|
1538
|
+
{ key: "items", label: "Items", fields: Ve },
|
|
1539
1539
|
{ key: "taxes", label: "Taxes", fields: je }
|
|
1540
1540
|
],
|
|
1541
1541
|
listColumns: ["name", "customer", "transaction_date", "grand_total", "status"],
|
|
@@ -1567,7 +1567,7 @@ const Ue = [
|
|
|
1567
1567
|
{ name: "remarks", label: "Notes / Terms", type: "textarea" }
|
|
1568
1568
|
],
|
|
1569
1569
|
childTables: [
|
|
1570
|
-
{ key: "items", label: "Items", fields:
|
|
1570
|
+
{ key: "items", label: "Items", fields: Ve },
|
|
1571
1571
|
{ key: "taxes", label: "Taxes", fields: je }
|
|
1572
1572
|
],
|
|
1573
1573
|
listColumns: ["name", "customer", "transaction_date", "grand_total", "status"],
|
|
@@ -1598,7 +1598,7 @@ const Ue = [
|
|
|
1598
1598
|
{ name: "remarks", label: "Notes / Terms", type: "textarea" }
|
|
1599
1599
|
],
|
|
1600
1600
|
childTables: [
|
|
1601
|
-
{ key: "items", label: "Items", fields: [...
|
|
1601
|
+
{ key: "items", label: "Items", fields: [...Ve, { name: "income_account", label: "Income Account", type: "link", linkDoctype: "account" }] },
|
|
1602
1602
|
{ key: "taxes", label: "Taxes", fields: je }
|
|
1603
1603
|
],
|
|
1604
1604
|
listColumns: ["name", "customer", "posting_date", "grand_total", "outstanding_amount", "status"],
|
|
@@ -1625,7 +1625,7 @@ const Ue = [
|
|
|
1625
1625
|
{ name: "remarks", label: "Notes / Terms", type: "textarea" }
|
|
1626
1626
|
],
|
|
1627
1627
|
childTables: [
|
|
1628
|
-
{ key: "items", label: "Items", fields: [...
|
|
1628
|
+
{ key: "items", label: "Items", fields: [...Ve, { name: "warehouse", label: "Warehouse", type: "link", linkDoctype: "warehouse" }] },
|
|
1629
1629
|
{ key: "taxes", label: "Taxes", fields: je }
|
|
1630
1630
|
],
|
|
1631
1631
|
listColumns: ["name", "supplier", "transaction_date", "grand_total", "status"],
|
|
@@ -1667,7 +1667,7 @@ const Ue = [
|
|
|
1667
1667
|
key: "items",
|
|
1668
1668
|
label: "Items",
|
|
1669
1669
|
fields: [
|
|
1670
|
-
...
|
|
1670
|
+
...Ve,
|
|
1671
1671
|
{
|
|
1672
1672
|
name: "warehouse",
|
|
1673
1673
|
label: "Warehouse",
|
|
@@ -1870,7 +1870,7 @@ const Ue = [
|
|
|
1870
1870
|
key: "items",
|
|
1871
1871
|
label: "Items",
|
|
1872
1872
|
fields: [
|
|
1873
|
-
...
|
|
1873
|
+
...Ve,
|
|
1874
1874
|
{ name: "warehouse", label: "Warehouse", type: "link", linkDoctype: "warehouse", required: !0 }
|
|
1875
1875
|
]
|
|
1876
1876
|
},
|
|
@@ -1905,7 +1905,7 @@ const Ue = [
|
|
|
1905
1905
|
key: "items",
|
|
1906
1906
|
label: "Items",
|
|
1907
1907
|
fields: [
|
|
1908
|
-
...
|
|
1908
|
+
...Ve,
|
|
1909
1909
|
{ name: "warehouse", label: "Warehouse", type: "link", linkDoctype: "warehouse", required: !0 }
|
|
1910
1910
|
]
|
|
1911
1911
|
},
|
|
@@ -1949,7 +1949,7 @@ const Ue = [
|
|
|
1949
1949
|
key: "items",
|
|
1950
1950
|
label: "Items",
|
|
1951
1951
|
fields: [
|
|
1952
|
-
...
|
|
1952
|
+
...Ve,
|
|
1953
1953
|
{
|
|
1954
1954
|
name: "warehouse",
|
|
1955
1955
|
label: "Warehouse",
|
|
@@ -2128,7 +2128,7 @@ const ar = {
|
|
|
2128
2128
|
md: "h-10 px-4 text-sm",
|
|
2129
2129
|
lg: "h-11 px-5 text-sm"
|
|
2130
2130
|
};
|
|
2131
|
-
function
|
|
2131
|
+
function ee({
|
|
2132
2132
|
variant: t = "primary",
|
|
2133
2133
|
size: n = "md",
|
|
2134
2134
|
disabled: a,
|
|
@@ -2159,7 +2159,7 @@ function X({
|
|
|
2159
2159
|
}
|
|
2160
2160
|
);
|
|
2161
2161
|
}
|
|
2162
|
-
function
|
|
2162
|
+
function X({ label: t, hint: n, error: a, className: s, id: l, ...i }) {
|
|
2163
2163
|
const c = l || (t ? t.toLowerCase().replace(/\s+/g, "-") : void 0);
|
|
2164
2164
|
return /* @__PURE__ */ r("div", { children: [
|
|
2165
2165
|
t && /* @__PURE__ */ e(
|
|
@@ -2248,7 +2248,7 @@ function Ke({ label: t, options: n, value: a, onChange: s, className: l, require
|
|
|
2248
2248
|
] });
|
|
2249
2249
|
}
|
|
2250
2250
|
function ir({ text: t }) {
|
|
2251
|
-
const [n, a] =
|
|
2251
|
+
const [n, a] = S(!1);
|
|
2252
2252
|
return /* @__PURE__ */ r("span", { className: "relative ml-1 inline-flex", children: [
|
|
2253
2253
|
/* @__PURE__ */ e(
|
|
2254
2254
|
"button",
|
|
@@ -2268,7 +2268,7 @@ function ir({ text: t }) {
|
|
|
2268
2268
|
] });
|
|
2269
2269
|
}
|
|
2270
2270
|
function lr(t, n = !0) {
|
|
2271
|
-
const { data: a } =
|
|
2271
|
+
const { data: a } = le({
|
|
2272
2272
|
queryKey: ["currencies", ""],
|
|
2273
2273
|
queryFn: () => O.currencies(t),
|
|
2274
2274
|
enabled: n,
|
|
@@ -2298,19 +2298,19 @@ function dr({
|
|
|
2298
2298
|
disabled: s,
|
|
2299
2299
|
hideLabel: l
|
|
2300
2300
|
}) {
|
|
2301
|
-
const [i, c] =
|
|
2301
|
+
const [i, c] = S(n ?? ""), [o, m] = S(!1), { data: d } = le({
|
|
2302
2302
|
queryKey: ["link-search", t.linkDoctype, i],
|
|
2303
2303
|
queryFn: () => O.searchLink(t.linkDoctype, i),
|
|
2304
2304
|
enabled: !!t.linkDoctype && o
|
|
2305
2305
|
});
|
|
2306
|
-
return
|
|
2306
|
+
return se(() => {
|
|
2307
2307
|
c(n ?? "");
|
|
2308
2308
|
}, [n]), s ? /* @__PURE__ */ r("div", { children: [
|
|
2309
2309
|
!l && /* @__PURE__ */ e("label", { className: "mb-1.5 block text-sm font-medium text-fg", children: t.label }),
|
|
2310
2310
|
/* @__PURE__ */ e("p", { className: "py-2 text-sm text-fg", children: n || "-" })
|
|
2311
2311
|
] }) : /* @__PURE__ */ r("div", { className: "relative", children: [
|
|
2312
2312
|
/* @__PURE__ */ e(
|
|
2313
|
-
|
|
2313
|
+
X,
|
|
2314
2314
|
{
|
|
2315
2315
|
label: l ? void 0 : t.label,
|
|
2316
2316
|
value: i,
|
|
@@ -2334,7 +2334,7 @@ function dr({
|
|
|
2334
2334
|
)) })
|
|
2335
2335
|
] });
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2337
|
+
function Ut({
|
|
2338
2338
|
field: t,
|
|
2339
2339
|
value: n,
|
|
2340
2340
|
onChange: a,
|
|
@@ -2343,38 +2343,38 @@ function Vt({
|
|
|
2343
2343
|
hideLabel: i,
|
|
2344
2344
|
currency: c = "USD"
|
|
2345
2345
|
}) {
|
|
2346
|
-
var
|
|
2346
|
+
var D;
|
|
2347
2347
|
const { t: o } = Z(), m = s || !!t.readOnly, d = () => i ? null : /* @__PURE__ */ e(cr, { label: o(`fields.${t.label}`, { defaultValue: t.label }), hint: t.hint }), u = t.type === "select" && t.optionsSource === "currency", p = lr(void 0, u);
|
|
2348
2348
|
if (m) {
|
|
2349
2349
|
if (t.type === "link" && n) {
|
|
2350
|
-
const y = t.linkDoctypeField && l ? String(l[t.linkDoctypeField] ?? "").toLowerCase().replace(/\s+/g, "-") : t.linkDoctype,
|
|
2351
|
-
if (
|
|
2350
|
+
const y = t.linkDoctypeField && l ? String(l[t.linkDoctypeField] ?? "").toLowerCase().replace(/\s+/g, "-") : t.linkDoctype, R = $t(y, String(n));
|
|
2351
|
+
if (R)
|
|
2352
2352
|
return /* @__PURE__ */ r("div", { children: [
|
|
2353
2353
|
/* @__PURE__ */ e(d, {}),
|
|
2354
2354
|
/* @__PURE__ */ e("p", { className: i ? "text-sm" : "py-2 text-sm", children: /* @__PURE__ */ e(
|
|
2355
2355
|
ye,
|
|
2356
2356
|
{
|
|
2357
|
-
to:
|
|
2357
|
+
to: R,
|
|
2358
2358
|
className: "text-sky-600 hover:text-sky-800 hover:underline",
|
|
2359
2359
|
children: n
|
|
2360
2360
|
}
|
|
2361
2361
|
) })
|
|
2362
2362
|
] });
|
|
2363
2363
|
}
|
|
2364
|
-
let
|
|
2365
|
-
return t.type === "currency" && typeof n == "number" && (
|
|
2364
|
+
let h = n ?? "-";
|
|
2365
|
+
return t.type === "currency" && typeof n == "number" && (h = Le(n, c)), /* @__PURE__ */ r("div", { children: [
|
|
2366
2366
|
/* @__PURE__ */ e(d, {}),
|
|
2367
|
-
/* @__PURE__ */ e("p", { className: i ? "text-sm text-fg" : "py-2 text-sm text-fg", children:
|
|
2367
|
+
/* @__PURE__ */ e("p", { className: i ? "text-sm text-fg" : "py-2 text-sm text-fg", children: h })
|
|
2368
2368
|
] });
|
|
2369
2369
|
}
|
|
2370
2370
|
if (t.type === "link") {
|
|
2371
|
-
const
|
|
2371
|
+
const h = t.linkDoctypeField && l ? { ...t, linkDoctype: (D = l[t.linkDoctypeField]) == null ? void 0 : D.toLowerCase().replace(/\s+/g, "-") } : t;
|
|
2372
2372
|
return /* @__PURE__ */ r("div", { children: [
|
|
2373
2373
|
/* @__PURE__ */ e(d, {}),
|
|
2374
2374
|
/* @__PURE__ */ e(
|
|
2375
2375
|
dr,
|
|
2376
2376
|
{
|
|
2377
|
-
field:
|
|
2377
|
+
field: h,
|
|
2378
2378
|
value: n ?? "",
|
|
2379
2379
|
onChange: a,
|
|
2380
2380
|
disabled: m,
|
|
@@ -2384,13 +2384,13 @@ function Vt({
|
|
|
2384
2384
|
] });
|
|
2385
2385
|
}
|
|
2386
2386
|
if (t.type === "select" && (t.options || u)) {
|
|
2387
|
-
const
|
|
2387
|
+
const h = u ? n && !p.includes(n) ? [n, ...p] : p : t.options;
|
|
2388
2388
|
return /* @__PURE__ */ r("div", { children: [
|
|
2389
2389
|
/* @__PURE__ */ e(d, {}),
|
|
2390
2390
|
/* @__PURE__ */ e(
|
|
2391
2391
|
Ke,
|
|
2392
2392
|
{
|
|
2393
|
-
options:
|
|
2393
|
+
options: h,
|
|
2394
2394
|
value: n ?? "",
|
|
2395
2395
|
onChange: (y) => a(y.target.value)
|
|
2396
2396
|
}
|
|
@@ -2406,7 +2406,7 @@ function Vt({
|
|
|
2406
2406
|
className: "block w-full rounded-lg bg-surface px-3 py-2 text-sm text-fg ring-1 ring-line transition-all placeholder:text-fg-muted/70 focus:outline-none focus:ring-2 focus:ring-brand/30",
|
|
2407
2407
|
rows: 3,
|
|
2408
2408
|
value: n ?? "",
|
|
2409
|
-
onChange: (
|
|
2409
|
+
onChange: (h) => a(h.target.value)
|
|
2410
2410
|
}
|
|
2411
2411
|
)
|
|
2412
2412
|
] });
|
|
@@ -2414,13 +2414,13 @@ function Vt({
|
|
|
2414
2414
|
return /* @__PURE__ */ r("div", { children: [
|
|
2415
2415
|
/* @__PURE__ */ e(d, {}),
|
|
2416
2416
|
/* @__PURE__ */ e(
|
|
2417
|
-
|
|
2417
|
+
X,
|
|
2418
2418
|
{
|
|
2419
2419
|
type: v,
|
|
2420
2420
|
step: t.type === "currency" ? "0.01" : void 0,
|
|
2421
2421
|
value: n ?? "",
|
|
2422
|
-
onChange: (
|
|
2423
|
-
v === "number" ? parseFloat(
|
|
2422
|
+
onChange: (h) => a(
|
|
2423
|
+
v === "number" ? parseFloat(h.target.value) || 0 : h.target.value
|
|
2424
2424
|
)
|
|
2425
2425
|
}
|
|
2426
2426
|
)
|
|
@@ -2435,7 +2435,7 @@ function ur({
|
|
|
2435
2435
|
}) {
|
|
2436
2436
|
const { t: i } = Z(), c = (d, u, p) => {
|
|
2437
2437
|
const v = n.map(
|
|
2438
|
-
(
|
|
2438
|
+
(D, h) => h === d ? { ...D, [u]: p } : D
|
|
2439
2439
|
);
|
|
2440
2440
|
a(v);
|
|
2441
2441
|
}, o = () => {
|
|
@@ -2446,7 +2446,7 @@ function ur({
|
|
|
2446
2446
|
}, m = (d) => {
|
|
2447
2447
|
a(n.filter((u, p) => p !== d));
|
|
2448
2448
|
};
|
|
2449
|
-
return /* @__PURE__ */ r(
|
|
2449
|
+
return /* @__PURE__ */ r(U, { title: i(`tables.${t.key}`, { defaultValue: t.label }), children: [
|
|
2450
2450
|
/* @__PURE__ */ e("div", { className: "-mx-6 overflow-x-auto px-6", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-line text-sm", children: [
|
|
2451
2451
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
|
|
2452
2452
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-left text-xs font-medium uppercase tracking-wide text-fg-muted", children: "#" }),
|
|
@@ -2463,7 +2463,7 @@ function ur({
|
|
|
2463
2463
|
/* @__PURE__ */ e("tbody", { className: "divide-y divide-line", children: n.map((d, u) => /* @__PURE__ */ r("tr", { children: [
|
|
2464
2464
|
/* @__PURE__ */ e("td", { className: "px-2 py-1 text-fg-muted", children: u + 1 }),
|
|
2465
2465
|
t.fields.map((p) => /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e(
|
|
2466
|
-
|
|
2466
|
+
Ut,
|
|
2467
2467
|
{
|
|
2468
2468
|
field: p,
|
|
2469
2469
|
value: d[p.name],
|
|
@@ -2475,7 +2475,7 @@ function ur({
|
|
|
2475
2475
|
}
|
|
2476
2476
|
) }, p.name)),
|
|
2477
2477
|
!s && /* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(
|
|
2478
|
-
|
|
2478
|
+
ee,
|
|
2479
2479
|
{
|
|
2480
2480
|
variant: "ghost",
|
|
2481
2481
|
size: "sm",
|
|
@@ -2485,7 +2485,7 @@ function ur({
|
|
|
2485
2485
|
) })
|
|
2486
2486
|
] }, u)) })
|
|
2487
2487
|
] }) }),
|
|
2488
|
-
!s && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(
|
|
2488
|
+
!s && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(ee, { variant: "secondary", size: "sm", onClick: o, children: i("common.addRow") }) })
|
|
2489
2489
|
] });
|
|
2490
2490
|
}
|
|
2491
2491
|
function mr({
|
|
@@ -2504,12 +2504,12 @@ function mr({
|
|
|
2504
2504
|
if (!i) return null;
|
|
2505
2505
|
const p = !t && n && a ? `/api/documents/${n}/${encodeURIComponent(a)}/pdf` : null;
|
|
2506
2506
|
return /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-2", children: [
|
|
2507
|
-
p && /* @__PURE__ */ e(
|
|
2508
|
-
s < 1 && /* @__PURE__ */ e(
|
|
2509
|
-
!t && i.canSubmit && s === 0 && /* @__PURE__ */ e(
|
|
2510
|
-
!t && i.canCancel && s === 1 && /* @__PURE__ */ e(
|
|
2507
|
+
p && /* @__PURE__ */ e(ee, { variant: "secondary", onClick: () => window.open(p, "_blank"), children: u("common.pdf") }),
|
|
2508
|
+
s < 1 && /* @__PURE__ */ e(ee, { onClick: c, disabled: l, children: u(l ? "common.saving" : "common.save") }),
|
|
2509
|
+
!t && i.canSubmit && s === 0 && /* @__PURE__ */ e(ee, { variant: "secondary", onClick: o, children: u("common.submit") }),
|
|
2510
|
+
!t && i.canCancel && s === 1 && /* @__PURE__ */ e(ee, { variant: "danger", onClick: m, children: u("common.cancelDoc") }),
|
|
2511
2511
|
!t && s === 1 && i.conversions.map((v) => /* @__PURE__ */ e(
|
|
2512
|
-
|
|
2512
|
+
ee,
|
|
2513
2513
|
{
|
|
2514
2514
|
variant: "secondary",
|
|
2515
2515
|
onClick: () => d(v.targetDoctype),
|
|
@@ -2543,96 +2543,96 @@ function pn(t, n) {
|
|
|
2543
2543
|
}
|
|
2544
2544
|
function hn() {
|
|
2545
2545
|
var ge;
|
|
2546
|
-
const { doctype: t, name: n } = ut(), a = Oe(), s = We(), { t: l } = Z(), i = Qn(t ?? ""), c = !n, [o, m] =
|
|
2546
|
+
const { doctype: t, name: n } = ut(), a = Oe(), s = We(), { t: l } = Z(), i = Qn(t ?? ""), c = !n, [o, m] = S({}), [d, u] = S(!1), { data: p, isLoading: v } = le({
|
|
2547
2547
|
queryKey: ["document", t, n],
|
|
2548
2548
|
queryFn: () => O.getDocument(t, n),
|
|
2549
2549
|
enabled: !!t && !!n && !c
|
|
2550
|
-
}),
|
|
2551
|
-
() => !!(i != null && i.fields.some((
|
|
2550
|
+
}), D = Ce(
|
|
2551
|
+
() => !!(i != null && i.fields.some((T) => T.name === "currency")),
|
|
2552
2552
|
[i]
|
|
2553
|
-
),
|
|
2554
|
-
queryKey: ["master",
|
|
2555
|
-
queryFn: () => O.getMaster(
|
|
2556
|
-
enabled: c &&
|
|
2553
|
+
), h = i == null ? void 0 : i.partyField, y = h ? o[h] : void 0, R = Fe(o.company), { data: B } = le({
|
|
2554
|
+
queryKey: ["master", h, y],
|
|
2555
|
+
queryFn: () => O.getMaster(h, y),
|
|
2556
|
+
enabled: c && D && !!h && !!y,
|
|
2557
2557
|
staleTime: 300 * 1e3
|
|
2558
2558
|
});
|
|
2559
|
-
|
|
2560
|
-
if (!c || !
|
|
2561
|
-
let
|
|
2559
|
+
se(() => {
|
|
2560
|
+
if (!c || !D || d) return;
|
|
2561
|
+
let T;
|
|
2562
2562
|
if (y) {
|
|
2563
|
-
if (!
|
|
2564
|
-
|
|
2563
|
+
if (!B) return;
|
|
2564
|
+
T = B.default_currency || R;
|
|
2565
2565
|
} else
|
|
2566
|
-
|
|
2567
|
-
|
|
2566
|
+
T = R;
|
|
2567
|
+
T && T !== o.currency && m((Q) => ({ ...Q, currency: T }));
|
|
2568
2568
|
}, [
|
|
2569
2569
|
c,
|
|
2570
|
-
|
|
2570
|
+
D,
|
|
2571
2571
|
d,
|
|
2572
2572
|
y,
|
|
2573
|
-
|
|
2574
|
-
|
|
2573
|
+
B,
|
|
2574
|
+
R,
|
|
2575
2575
|
o.currency
|
|
2576
|
-
]),
|
|
2576
|
+
]), se(() => {
|
|
2577
2577
|
if (c && i) {
|
|
2578
|
-
const
|
|
2578
|
+
const T = {};
|
|
2579
2579
|
i.fields.forEach((Q) => {
|
|
2580
|
-
Q.type === "date" ?
|
|
2580
|
+
Q.type === "date" ? T[Q.name] = (/* @__PURE__ */ new Date()).toISOString().split("T")[0] : T[Q.name] = Q.default ?? "";
|
|
2581
2581
|
}), i.childTables.forEach((Q) => {
|
|
2582
|
-
|
|
2583
|
-
}),
|
|
2582
|
+
T[Q.key] = [];
|
|
2583
|
+
}), T.docstatus = 0, m(T);
|
|
2584
2584
|
} else p && m(p);
|
|
2585
2585
|
}, [c, p, i]);
|
|
2586
|
-
const C =
|
|
2587
|
-
mutationFn: (
|
|
2588
|
-
onSuccess: (
|
|
2589
|
-
s.invalidateQueries({ queryKey: ["documents", t] }), a(`/app/${t}/${
|
|
2586
|
+
const C = pe({
|
|
2587
|
+
mutationFn: (T) => O.createDocument(t, T),
|
|
2588
|
+
onSuccess: (T) => {
|
|
2589
|
+
s.invalidateQueries({ queryKey: ["documents", t] }), a(`/app/${t}/${T.name}`, { replace: !0 });
|
|
2590
2590
|
}
|
|
2591
|
-
}), b =
|
|
2592
|
-
mutationFn: (
|
|
2593
|
-
onSuccess: (
|
|
2594
|
-
s.invalidateQueries({ queryKey: ["document", t, n] }), s.invalidateQueries({ queryKey: ["documents", t] }), m(
|
|
2591
|
+
}), b = pe({
|
|
2592
|
+
mutationFn: (T) => O.updateDocument(t, n, T),
|
|
2593
|
+
onSuccess: (T) => {
|
|
2594
|
+
s.invalidateQueries({ queryKey: ["document", t, n] }), s.invalidateQueries({ queryKey: ["documents", t] }), m(T);
|
|
2595
2595
|
}
|
|
2596
|
-
}),
|
|
2596
|
+
}), g = pe({
|
|
2597
2597
|
mutationFn: () => O.submitDocument(t, n),
|
|
2598
|
-
onSuccess: (
|
|
2599
|
-
m(
|
|
2598
|
+
onSuccess: (T) => {
|
|
2599
|
+
m(T), s.invalidateQueries({ queryKey: ["document", t, n] }), s.invalidateQueries({ queryKey: ["documents", t] });
|
|
2600
2600
|
}
|
|
2601
|
-
}),
|
|
2601
|
+
}), _ = pe({
|
|
2602
2602
|
mutationFn: () => O.cancelDocument(t, n),
|
|
2603
|
-
onSuccess: (
|
|
2604
|
-
m(
|
|
2603
|
+
onSuccess: (T) => {
|
|
2604
|
+
m(T), s.invalidateQueries({ queryKey: ["document", t, n] }), s.invalidateQueries({ queryKey: ["documents", t] });
|
|
2605
2605
|
}
|
|
2606
|
-
}),
|
|
2607
|
-
mutationFn: (
|
|
2608
|
-
onSuccess: (
|
|
2609
|
-
const
|
|
2610
|
-
a(`/app/${
|
|
2606
|
+
}), w = pe({
|
|
2607
|
+
mutationFn: (T) => O.convertDocument(t, n, T),
|
|
2608
|
+
onSuccess: (T, Q) => {
|
|
2609
|
+
const ce = Q.toLowerCase().replace(/\s+/g, "-");
|
|
2610
|
+
a(`/app/${ce}/${T.name}`);
|
|
2611
2611
|
}
|
|
2612
|
-
}),
|
|
2613
|
-
(
|
|
2614
|
-
|
|
2615
|
-
const
|
|
2616
|
-
return
|
|
2612
|
+
}), N = we(
|
|
2613
|
+
(T, Q) => {
|
|
2614
|
+
T === "currency" && u(!0), m((ce) => {
|
|
2615
|
+
const ae = { ...ce, [T]: Q };
|
|
2616
|
+
return T === "currency" && (ae.conversion_rate = 0), pn(ae, i);
|
|
2617
2617
|
});
|
|
2618
2618
|
},
|
|
2619
2619
|
[i]
|
|
2620
2620
|
), q = we(
|
|
2621
|
-
(
|
|
2622
|
-
m((
|
|
2623
|
-
const
|
|
2624
|
-
return pn(
|
|
2621
|
+
(T, Q) => {
|
|
2622
|
+
m((ce) => {
|
|
2623
|
+
const ae = { ...ce, [T]: Q };
|
|
2624
|
+
return pn(ae, i);
|
|
2625
2625
|
});
|
|
2626
2626
|
},
|
|
2627
2627
|
[i]
|
|
2628
2628
|
), x = () => {
|
|
2629
2629
|
c ? C.mutate(o) : b.mutate(o);
|
|
2630
2630
|
}, z = () => {
|
|
2631
|
-
|
|
2631
|
+
g.mutate();
|
|
2632
2632
|
}, j = () => {
|
|
2633
|
-
|
|
2634
|
-
},
|
|
2635
|
-
|
|
2633
|
+
_.mutate();
|
|
2634
|
+
}, V = (T) => {
|
|
2635
|
+
w.mutate(T);
|
|
2636
2636
|
};
|
|
2637
2637
|
if (!i)
|
|
2638
2638
|
return /* @__PURE__ */ r("p", { className: "text-fg-muted", children: [
|
|
@@ -2641,7 +2641,7 @@ function hn() {
|
|
|
2641
2641
|
] });
|
|
2642
2642
|
if (!c && v)
|
|
2643
2643
|
return /* @__PURE__ */ e("p", { className: "text-fg-muted", children: l("common.loading") });
|
|
2644
|
-
const Y = o.docstatus ?? 0,
|
|
2644
|
+
const Y = o.docstatus ?? 0, de = Y >= 1, P = o.currency || "USD", K = Ee(o.conversion_rate ?? 1), ie = i.fields.filter((T) => !T.readOnly), oe = i.fields.filter((T) => T.readOnly);
|
|
2645
2645
|
return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
2646
2646
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
2647
2647
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
@@ -2650,9 +2650,9 @@ function hn() {
|
|
|
2650
2650
|
"span",
|
|
2651
2651
|
{
|
|
2652
2652
|
className: "inline-flex items-center gap-1 rounded-full bg-surface-subtle px-2.5 py-0.5 text-xs font-medium text-fg-muted ring-1 ring-line",
|
|
2653
|
-
title: K !== 1 ? `1 ${
|
|
2653
|
+
title: K !== 1 ? `1 ${P} = ${K} base currency` : void 0,
|
|
2654
2654
|
children: [
|
|
2655
|
-
|
|
2655
|
+
P,
|
|
2656
2656
|
K !== 1 && /* @__PURE__ */ r("span", { className: "text-fg-muted/70", children: [
|
|
2657
2657
|
"@ ",
|
|
2658
2658
|
K
|
|
@@ -2673,49 +2673,49 @@ function hn() {
|
|
|
2673
2673
|
onSave: x,
|
|
2674
2674
|
onSubmit: z,
|
|
2675
2675
|
onCancel: j,
|
|
2676
|
-
onConvert:
|
|
2676
|
+
onConvert: V
|
|
2677
2677
|
}
|
|
2678
2678
|
)
|
|
2679
2679
|
] }),
|
|
2680
|
-
(C.error || b.error ||
|
|
2681
|
-
/* @__PURE__ */ e(
|
|
2682
|
-
|
|
2680
|
+
(C.error || b.error || g.error || _.error) && /* @__PURE__ */ e("div", { className: "rounded-lg bg-rose-50 p-4 text-sm text-rose-700 ring-1 ring-rose-200", children: ((ge = C.error ?? b.error ?? g.error ?? _.error) == null ? void 0 : ge.message) ?? l("common.errorOccurred") }),
|
|
2681
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: ie.map((T) => /* @__PURE__ */ e(
|
|
2682
|
+
Ut,
|
|
2683
2683
|
{
|
|
2684
|
-
field:
|
|
2685
|
-
value: o[
|
|
2686
|
-
onChange: (Q) =>
|
|
2687
|
-
readOnly:
|
|
2684
|
+
field: T,
|
|
2685
|
+
value: o[T.name],
|
|
2686
|
+
onChange: (Q) => N(T.name, Q),
|
|
2687
|
+
readOnly: de,
|
|
2688
2688
|
rowData: o,
|
|
2689
|
-
currency:
|
|
2689
|
+
currency: P
|
|
2690
2690
|
},
|
|
2691
|
-
|
|
2691
|
+
T.name
|
|
2692
2692
|
)) }) }),
|
|
2693
|
-
i.childTables.map((
|
|
2693
|
+
i.childTables.map((T) => /* @__PURE__ */ e(
|
|
2694
2694
|
ur,
|
|
2695
2695
|
{
|
|
2696
|
-
tableDef:
|
|
2697
|
-
rows: o[
|
|
2698
|
-
onChange: (Q) => q(
|
|
2699
|
-
readOnly:
|
|
2700
|
-
currency:
|
|
2696
|
+
tableDef: T,
|
|
2697
|
+
rows: o[T.key] ?? [],
|
|
2698
|
+
onChange: (Q) => q(T.key, Q),
|
|
2699
|
+
readOnly: de,
|
|
2700
|
+
currency: P
|
|
2701
2701
|
},
|
|
2702
|
-
|
|
2702
|
+
T.key
|
|
2703
2703
|
)),
|
|
2704
|
-
|
|
2705
|
-
|
|
2704
|
+
oe.length > 0 && /* @__PURE__ */ e(U, { title: l("common.totals"), children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-3", children: oe.map((T) => /* @__PURE__ */ e(
|
|
2705
|
+
Ut,
|
|
2706
2706
|
{
|
|
2707
|
-
field:
|
|
2708
|
-
value: o[
|
|
2707
|
+
field: T,
|
|
2708
|
+
value: o[T.name],
|
|
2709
2709
|
onChange: () => {
|
|
2710
2710
|
},
|
|
2711
2711
|
readOnly: !0,
|
|
2712
|
-
currency:
|
|
2712
|
+
currency: P
|
|
2713
2713
|
},
|
|
2714
|
-
|
|
2714
|
+
T.name
|
|
2715
2715
|
)) }) })
|
|
2716
2716
|
] });
|
|
2717
2717
|
}
|
|
2718
|
-
function
|
|
2718
|
+
function me(t) {
|
|
2719
2719
|
return t.toISOString().split("T")[0];
|
|
2720
2720
|
}
|
|
2721
2721
|
function Hn(t) {
|
|
@@ -2732,12 +2732,12 @@ function gn(t) {
|
|
|
2732
2732
|
function vt(t) {
|
|
2733
2733
|
return new Date(t.getFullYear(), t.getMonth() + 1, 0);
|
|
2734
2734
|
}
|
|
2735
|
-
function
|
|
2735
|
+
function Vt(t) {
|
|
2736
2736
|
const n = Math.floor(t.getMonth() / 3);
|
|
2737
2737
|
return new Date(t.getFullYear(), n * 3, 1);
|
|
2738
2738
|
}
|
|
2739
2739
|
function Gt(t) {
|
|
2740
|
-
const n =
|
|
2740
|
+
const n = Vt(t);
|
|
2741
2741
|
return new Date(n.getFullYear(), n.getMonth() + 3, 0);
|
|
2742
2742
|
}
|
|
2743
2743
|
function yn(t) {
|
|
@@ -2750,45 +2750,45 @@ const hr = [
|
|
|
2750
2750
|
{
|
|
2751
2751
|
label: "Today",
|
|
2752
2752
|
range: () => {
|
|
2753
|
-
const t =
|
|
2753
|
+
const t = me(/* @__PURE__ */ new Date());
|
|
2754
2754
|
return [t, t];
|
|
2755
2755
|
}
|
|
2756
2756
|
},
|
|
2757
2757
|
{
|
|
2758
2758
|
label: "This Week",
|
|
2759
|
-
range: () => [
|
|
2759
|
+
range: () => [me(Hn(/* @__PURE__ */ new Date())), me(pr(/* @__PURE__ */ new Date()))]
|
|
2760
2760
|
},
|
|
2761
2761
|
{
|
|
2762
2762
|
label: "This Month",
|
|
2763
|
-
range: () => [
|
|
2763
|
+
range: () => [me(gn(/* @__PURE__ */ new Date())), me(vt(/* @__PURE__ */ new Date()))]
|
|
2764
2764
|
},
|
|
2765
2765
|
{
|
|
2766
2766
|
label: "This Quarter",
|
|
2767
|
-
range: () => [
|
|
2767
|
+
range: () => [me(Vt(/* @__PURE__ */ new Date())), me(Gt(/* @__PURE__ */ new Date()))]
|
|
2768
2768
|
},
|
|
2769
2769
|
{
|
|
2770
2770
|
label: "This Year",
|
|
2771
|
-
range: () => [
|
|
2771
|
+
range: () => [me(yn(/* @__PURE__ */ new Date())), me(Nt(/* @__PURE__ */ new Date()))]
|
|
2772
2772
|
},
|
|
2773
2773
|
{
|
|
2774
2774
|
label: "Last Month",
|
|
2775
2775
|
range: () => {
|
|
2776
2776
|
const t = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth() - 1, 1);
|
|
2777
|
-
return [
|
|
2777
|
+
return [me(gn(n)), me(vt(n))];
|
|
2778
2778
|
}
|
|
2779
2779
|
},
|
|
2780
2780
|
{
|
|
2781
2781
|
label: "Last Quarter",
|
|
2782
2782
|
range: () => {
|
|
2783
2783
|
const t = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth() - 3, 1);
|
|
2784
|
-
return [
|
|
2784
|
+
return [me(Vt(n)), me(Gt(n))];
|
|
2785
2785
|
}
|
|
2786
2786
|
},
|
|
2787
2787
|
{
|
|
2788
2788
|
label: "Last Year",
|
|
2789
2789
|
range: () => {
|
|
2790
2790
|
const t = new Date((/* @__PURE__ */ new Date()).getFullYear() - 1, 6, 1);
|
|
2791
|
-
return [
|
|
2791
|
+
return [me(yn(t)), me(Nt(t))];
|
|
2792
2792
|
}
|
|
2793
2793
|
}
|
|
2794
2794
|
];
|
|
@@ -2809,15 +2809,15 @@ function Dt({ onSelect: t }) {
|
|
|
2809
2809
|
}
|
|
2810
2810
|
function en({ onSelect: t }) {
|
|
2811
2811
|
return /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
2812
|
-
{ label: "Today", value: () =>
|
|
2813
|
-
{ label: "End of This Month", value: () =>
|
|
2812
|
+
{ label: "Today", value: () => me(/* @__PURE__ */ new Date()) },
|
|
2813
|
+
{ label: "End of This Month", value: () => me(vt(/* @__PURE__ */ new Date())) },
|
|
2814
2814
|
{ label: "End of Last Month", value: () => {
|
|
2815
2815
|
const a = /* @__PURE__ */ new Date();
|
|
2816
|
-
return
|
|
2816
|
+
return me(vt(new Date(a.getFullYear(), a.getMonth() - 1, 1)));
|
|
2817
2817
|
} },
|
|
2818
|
-
{ label: "End of This Quarter", value: () =>
|
|
2819
|
-
{ label: "End of This Year", value: () =>
|
|
2820
|
-
{ label: "End of Last Year", value: () =>
|
|
2818
|
+
{ label: "End of This Quarter", value: () => me(Gt(/* @__PURE__ */ new Date())) },
|
|
2819
|
+
{ label: "End of This Year", value: () => me(Nt(/* @__PURE__ */ new Date())) },
|
|
2820
|
+
{ label: "End of Last Year", value: () => me(Nt(new Date((/* @__PURE__ */ new Date()).getFullYear() - 1, 0, 1))) }
|
|
2821
2821
|
].map((a) => /* @__PURE__ */ e(
|
|
2822
2822
|
"button",
|
|
2823
2823
|
{
|
|
@@ -2860,52 +2860,52 @@ function br(t) {
|
|
|
2860
2860
|
}
|
|
2861
2861
|
const xr = ["25", "50", "100", "200"];
|
|
2862
2862
|
function vr() {
|
|
2863
|
-
const { t } = Z(), { doctype: n } = ut(), a = Qn(n ?? ""), [s] = J("status", "All"), [l] = J("from", ""), [i] = J("to", ""), [c] = J("per_page", 50), [o] = J("page", 1), m = o - 1, d = Me(), u = (x) => d({ page: x === 0 ? null : x + 1 }), p = (x) => d({ status: x === "All" ? null : x, page: null }), v = (x) => d({ from: x || null, page: null }),
|
|
2863
|
+
const { t } = Z(), { doctype: n } = ut(), a = Qn(n ?? ""), [s] = J("status", "All"), [l] = J("from", ""), [i] = J("to", ""), [c] = J("per_page", 50), [o] = J("page", 1), m = o - 1, d = Me(), u = (x) => d({ page: x === 0 ? null : x + 1 }), p = (x) => d({ status: x === "All" ? null : x, page: null }), v = (x) => d({ from: x || null, page: null }), D = (x) => d({ to: x || null, page: null }), h = (x) => d({ per_page: x, page: null }), y = Ce(() => {
|
|
2864
2864
|
const x = {};
|
|
2865
2865
|
return s !== "All" && (x.status = s), l && (x.from_date = l), i && (x.to_date = i), x.limit = c, x.offset = m * c, x;
|
|
2866
|
-
}, [s, l, i, c, m]), { data:
|
|
2866
|
+
}, [s, l, i, c, m]), { data: R, isLoading: B } = nr(n ?? "", y), C = (R == null ? void 0 : R.rows) ?? [], b = (R == null ? void 0 : R.total) ?? 0, g = Math.max(1, Math.ceil(b / c)), _ = b === 0 ? 0 : m * c + 1, w = Math.min(b, (m + 1) * c), N = Ce(() => {
|
|
2867
2867
|
if (!a) return [];
|
|
2868
2868
|
const x = zn(), z = (j) => {
|
|
2869
|
-
const
|
|
2870
|
-
return t(`fields.${
|
|
2869
|
+
const V = j.split("_").map((Y) => Y.charAt(0).toUpperCase() + Y.slice(1)).join(" ");
|
|
2870
|
+
return t(`fields.${V}`, { defaultValue: V });
|
|
2871
2871
|
};
|
|
2872
2872
|
return a.listColumns.map((j) => {
|
|
2873
2873
|
if (j === "name")
|
|
2874
2874
|
return x.accessor("name", {
|
|
2875
2875
|
header: t("fields.Name", { defaultValue: "Name" }),
|
|
2876
|
-
cell: (
|
|
2876
|
+
cell: (V) => /* @__PURE__ */ e(
|
|
2877
2877
|
ye,
|
|
2878
2878
|
{
|
|
2879
|
-
to: `/app/${a.slug}/${
|
|
2879
|
+
to: `/app/${a.slug}/${V.getValue()}`,
|
|
2880
2880
|
className: "font-medium text-brand transition-colors hover:text-brand/80",
|
|
2881
|
-
children:
|
|
2881
|
+
children: V.getValue()
|
|
2882
2882
|
}
|
|
2883
2883
|
)
|
|
2884
2884
|
});
|
|
2885
2885
|
if (j === "status")
|
|
2886
2886
|
return x.accessor("status", {
|
|
2887
2887
|
header: t("fields.Status", { defaultValue: "Status" }),
|
|
2888
|
-
cell: (
|
|
2888
|
+
cell: (V) => /* @__PURE__ */ e(Zt, { status: V.getValue() })
|
|
2889
2889
|
});
|
|
2890
2890
|
if (yr.has(j))
|
|
2891
2891
|
return x.accessor(j, {
|
|
2892
2892
|
header: z(j),
|
|
2893
|
-
cell: (
|
|
2893
|
+
cell: (V) => {
|
|
2894
2894
|
var Y;
|
|
2895
|
-
return Le(
|
|
2895
|
+
return Le(V.getValue(), ((Y = V.row.original) == null ? void 0 : Y.currency) || "USD");
|
|
2896
2896
|
}
|
|
2897
2897
|
});
|
|
2898
2898
|
if (j === "party")
|
|
2899
2899
|
return x.accessor("party", {
|
|
2900
2900
|
header: t("fields.Party", { defaultValue: "Party" }),
|
|
2901
|
-
cell: (
|
|
2902
|
-
const Y =
|
|
2901
|
+
cell: (V) => {
|
|
2902
|
+
const Y = V.getValue();
|
|
2903
2903
|
if (!Y) return "-";
|
|
2904
|
-
const
|
|
2905
|
-
return
|
|
2904
|
+
const de = br(V.row.original.party_type), P = de ? $t(de, String(Y)) : null;
|
|
2905
|
+
return P ? /* @__PURE__ */ e(
|
|
2906
2906
|
ye,
|
|
2907
2907
|
{
|
|
2908
|
-
to:
|
|
2908
|
+
to: P,
|
|
2909
2909
|
onClick: (K) => K.stopPropagation(),
|
|
2910
2910
|
className: "text-brand transition-colors hover:text-brand/80 hover:underline",
|
|
2911
2911
|
children: Y
|
|
@@ -2914,39 +2914,39 @@ function vr() {
|
|
|
2914
2914
|
}
|
|
2915
2915
|
});
|
|
2916
2916
|
if (fn[j]) {
|
|
2917
|
-
const
|
|
2917
|
+
const V = fn[j];
|
|
2918
2918
|
return x.accessor(j, {
|
|
2919
2919
|
header: z(j),
|
|
2920
2920
|
cell: (Y) => {
|
|
2921
|
-
const
|
|
2922
|
-
if (!
|
|
2923
|
-
const
|
|
2924
|
-
return
|
|
2921
|
+
const de = Y.getValue();
|
|
2922
|
+
if (!de) return "-";
|
|
2923
|
+
const P = $t(V, String(de));
|
|
2924
|
+
return P ? /* @__PURE__ */ e(
|
|
2925
2925
|
ye,
|
|
2926
2926
|
{
|
|
2927
|
-
to:
|
|
2927
|
+
to: P,
|
|
2928
2928
|
onClick: (K) => K.stopPropagation(),
|
|
2929
2929
|
className: "text-brand transition-colors hover:text-brand/80 hover:underline",
|
|
2930
|
-
children:
|
|
2930
|
+
children: de
|
|
2931
2931
|
}
|
|
2932
|
-
) : String(
|
|
2932
|
+
) : String(de);
|
|
2933
2933
|
}
|
|
2934
2934
|
});
|
|
2935
2935
|
}
|
|
2936
2936
|
return fr.has(j) ? x.accessor(j, {
|
|
2937
2937
|
header: z(j),
|
|
2938
|
-
cell: (
|
|
2938
|
+
cell: (V) => Ct(V.getValue())
|
|
2939
2939
|
}) : x.accessor(j, {
|
|
2940
2940
|
header: z(j)
|
|
2941
2941
|
});
|
|
2942
2942
|
});
|
|
2943
2943
|
}, [a, t]), q = Fn({
|
|
2944
2944
|
data: C,
|
|
2945
|
-
columns:
|
|
2945
|
+
columns: N,
|
|
2946
2946
|
getCoreRowModel: Mn()
|
|
2947
2947
|
});
|
|
2948
2948
|
return a ? /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
2949
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e(ye, { to: `/app/${a.slug}/new`, children: /* @__PURE__ */ e(
|
|
2949
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e(ye, { to: `/app/${a.slug}/new`, children: /* @__PURE__ */ e(ee, { children: t("common.new") }) }) }),
|
|
2950
2950
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
2951
2951
|
/* @__PURE__ */ e(
|
|
2952
2952
|
Ke,
|
|
@@ -2961,7 +2961,7 @@ function vr() {
|
|
|
2961
2961
|
}
|
|
2962
2962
|
),
|
|
2963
2963
|
/* @__PURE__ */ e(
|
|
2964
|
-
|
|
2964
|
+
X,
|
|
2965
2965
|
{
|
|
2966
2966
|
label: t("fields.From Date", { defaultValue: "From Date" }),
|
|
2967
2967
|
type: "date",
|
|
@@ -2970,17 +2970,17 @@ function vr() {
|
|
|
2970
2970
|
}
|
|
2971
2971
|
),
|
|
2972
2972
|
/* @__PURE__ */ e(
|
|
2973
|
-
|
|
2973
|
+
X,
|
|
2974
2974
|
{
|
|
2975
2975
|
label: t("fields.To Date", { defaultValue: "To Date" }),
|
|
2976
2976
|
type: "date",
|
|
2977
2977
|
value: i,
|
|
2978
|
-
onChange: (x) =>
|
|
2978
|
+
onChange: (x) => D(x.target.value)
|
|
2979
2979
|
}
|
|
2980
2980
|
)
|
|
2981
2981
|
] }),
|
|
2982
2982
|
/* @__PURE__ */ e(Dt, { onSelect: (x, z) => d({ from: x, to: z, page: null }) }),
|
|
2983
|
-
|
|
2983
|
+
B ? /* @__PURE__ */ e("p", { className: "text-fg-muted", children: t("common.loading") }) : C.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-fg-muted", children: t("reports.noDocuments") }) : /* @__PURE__ */ r(Ne, { children: [
|
|
2984
2984
|
/* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-xl bg-surface ring-1 ring-line shadow-card", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-line text-sm", children: [
|
|
2985
2985
|
/* @__PURE__ */ e("thead", { className: "bg-surface-subtle", children: q.getHeaderGroups().map((x) => /* @__PURE__ */ e("tr", { children: x.headers.map((z) => /* @__PURE__ */ e(
|
|
2986
2986
|
"th",
|
|
@@ -3003,9 +3003,9 @@ function vr() {
|
|
|
3003
3003
|
t("common.showing"),
|
|
3004
3004
|
" ",
|
|
3005
3005
|
/* @__PURE__ */ r("span", { className: "font-medium text-fg", children: [
|
|
3006
|
-
|
|
3006
|
+
_,
|
|
3007
3007
|
"–",
|
|
3008
|
-
|
|
3008
|
+
w
|
|
3009
3009
|
] }),
|
|
3010
3010
|
" ",
|
|
3011
3011
|
t("common.of"),
|
|
@@ -3019,7 +3019,7 @@ function vr() {
|
|
|
3019
3019
|
"select",
|
|
3020
3020
|
{
|
|
3021
3021
|
value: c,
|
|
3022
|
-
onChange: (x) =>
|
|
3022
|
+
onChange: (x) => h(Number(x.target.value)),
|
|
3023
3023
|
className: "h-8 rounded-md bg-surface px-2 text-sm text-fg ring-1 ring-line transition-all focus:outline-none focus:ring-2 focus:ring-brand/30",
|
|
3024
3024
|
children: xr.map((x) => /* @__PURE__ */ e("option", { value: x, children: x }, x))
|
|
3025
3025
|
}
|
|
@@ -3041,13 +3041,13 @@ function vr() {
|
|
|
3041
3041
|
" ",
|
|
3042
3042
|
t("common.of"),
|
|
3043
3043
|
" ",
|
|
3044
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children:
|
|
3044
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children: g })
|
|
3045
3045
|
] }),
|
|
3046
3046
|
/* @__PURE__ */ e(
|
|
3047
3047
|
"button",
|
|
3048
3048
|
{
|
|
3049
|
-
onClick: () => u(Math.min(
|
|
3050
|
-
disabled: m >=
|
|
3049
|
+
onClick: () => u(Math.min(g - 1, m + 1)),
|
|
3050
|
+
disabled: m >= g - 1,
|
|
3051
3051
|
className: "rounded-md bg-surface px-3 py-1 text-sm text-fg ring-1 ring-line transition-colors hover:bg-surface-subtle disabled:cursor-not-allowed disabled:opacity-40",
|
|
3052
3052
|
children: t("common.next")
|
|
3053
3053
|
}
|
|
@@ -3063,7 +3063,7 @@ function vr() {
|
|
|
3063
3063
|
const Nr = ["25", "50", "100", "200"];
|
|
3064
3064
|
function Sr() {
|
|
3065
3065
|
var b;
|
|
3066
|
-
const { type: t } = ut(), n = Oe(), s = (b = dt().state) == null ? void 0 : b.notice, [l] = J("per_page", 50), [i] = J("page", 1), c = i - 1, o = Me(), m = (
|
|
3066
|
+
const { type: t } = ut(), n = Oe(), s = (b = dt().state) == null ? void 0 : b.notice, [l] = J("per_page", 50), [i] = J("page", 1), c = i - 1, o = Me(), m = (g) => o({ page: g === 0 ? null : g + 1 }), d = (g) => o({ per_page: g, page: null }), { data: u, isLoading: p } = le({
|
|
3067
3067
|
queryKey: ["masters", t, c, l],
|
|
3068
3068
|
queryFn: () => O.listMasters(t, {
|
|
3069
3069
|
include_disabled: 1,
|
|
@@ -3071,16 +3071,16 @@ function Sr() {
|
|
|
3071
3071
|
offset: c * l
|
|
3072
3072
|
}),
|
|
3073
3073
|
enabled: !!t
|
|
3074
|
-
}), v = (u == null ? void 0 : u.rows) ?? [],
|
|
3074
|
+
}), v = (u == null ? void 0 : u.rows) ?? [], D = (u == null ? void 0 : u.total) ?? 0, h = Math.max(1, Math.ceil(D / l)), y = D === 0 ? 0 : c * l + 1, R = Math.min(D, (c + 1) * l), B = Ce(() => {
|
|
3075
3075
|
if (!v || v.length === 0) return [];
|
|
3076
|
-
const
|
|
3076
|
+
const g = zn();
|
|
3077
3077
|
return Object.keys(v[0]).map(
|
|
3078
|
-
(
|
|
3079
|
-
header:
|
|
3080
|
-
cell: (
|
|
3081
|
-
const q =
|
|
3082
|
-
if (
|
|
3083
|
-
const x =
|
|
3078
|
+
(w) => g.accessor(w, {
|
|
3079
|
+
header: w.split("_").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "),
|
|
3080
|
+
cell: (N) => {
|
|
3081
|
+
const q = N.getValue();
|
|
3082
|
+
if (w === "name") {
|
|
3083
|
+
const x = N.row.original.disabled === 1;
|
|
3084
3084
|
return /* @__PURE__ */ e(
|
|
3085
3085
|
ye,
|
|
3086
3086
|
{
|
|
@@ -3090,42 +3090,42 @@ function Sr() {
|
|
|
3090
3090
|
}
|
|
3091
3091
|
);
|
|
3092
3092
|
}
|
|
3093
|
-
return
|
|
3093
|
+
return w === "disabled" ? q === 1 ? "Disabled" : "Active" : q ?? "-";
|
|
3094
3094
|
}
|
|
3095
3095
|
})
|
|
3096
3096
|
);
|
|
3097
3097
|
}, [v, t]), C = Fn({
|
|
3098
3098
|
data: v,
|
|
3099
|
-
columns:
|
|
3099
|
+
columns: B,
|
|
3100
3100
|
getCoreRowModel: Mn()
|
|
3101
3101
|
});
|
|
3102
3102
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3103
3103
|
s && /* @__PURE__ */ e("div", { className: "rounded-md bg-amber-50 px-4 py-3 text-sm text-amber-800", children: s }),
|
|
3104
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e(ye, { to: `/masters/${t}/new`, children: /* @__PURE__ */ e(
|
|
3104
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ e(ye, { to: `/masters/${t}/new`, children: /* @__PURE__ */ e(ee, { children: "New" }) }) }),
|
|
3105
3105
|
p ? /* @__PURE__ */ e("p", { className: "text-fg-muted", children: "Loading..." }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-fg-muted", children: "No records found" }) : /* @__PURE__ */ r(Ne, { children: [
|
|
3106
3106
|
/* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-xl bg-surface ring-1 ring-line shadow-card", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-line text-sm", children: [
|
|
3107
|
-
/* @__PURE__ */ e("thead", { className: "bg-surface-subtle", children: C.getHeaderGroups().map((
|
|
3107
|
+
/* @__PURE__ */ e("thead", { className: "bg-surface-subtle", children: C.getHeaderGroups().map((g) => /* @__PURE__ */ e("tr", { children: g.headers.map((_) => /* @__PURE__ */ e(
|
|
3108
3108
|
"th",
|
|
3109
3109
|
{
|
|
3110
3110
|
className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wide text-fg-muted",
|
|
3111
|
-
children:
|
|
3112
|
-
|
|
3113
|
-
|
|
3111
|
+
children: _.isPlaceholder ? null : bt(
|
|
3112
|
+
_.column.columnDef.header,
|
|
3113
|
+
_.getContext()
|
|
3114
3114
|
)
|
|
3115
3115
|
},
|
|
3116
|
-
|
|
3117
|
-
)) },
|
|
3118
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-line", children: C.getRowModel().rows.map((
|
|
3116
|
+
_.id
|
|
3117
|
+
)) }, g.id)) }),
|
|
3118
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-line", children: C.getRowModel().rows.map((g) => /* @__PURE__ */ e(
|
|
3119
3119
|
"tr",
|
|
3120
3120
|
{
|
|
3121
|
-
className:
|
|
3122
|
-
onClick: () => n(`/masters/${t}/${
|
|
3123
|
-
children:
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
) },
|
|
3121
|
+
className: g.original.disabled === 1 ? "cursor-pointer bg-surface-subtle text-fg-muted transition-colors hover:bg-surface-subtle/80" : "cursor-pointer text-fg transition-colors hover:bg-surface-subtle",
|
|
3122
|
+
onClick: () => n(`/masters/${t}/${g.original.name}`),
|
|
3123
|
+
children: g.getVisibleCells().map((_) => /* @__PURE__ */ e("td", { className: "px-4 py-2.5", children: bt(
|
|
3124
|
+
_.column.columnDef.cell,
|
|
3125
|
+
_.getContext()
|
|
3126
|
+
) }, _.id))
|
|
3127
3127
|
},
|
|
3128
|
-
|
|
3128
|
+
g.id
|
|
3129
3129
|
)) })
|
|
3130
3130
|
] }) }),
|
|
3131
3131
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-between gap-3 text-sm text-fg-muted", children: [
|
|
@@ -3134,11 +3134,11 @@ function Sr() {
|
|
|
3134
3134
|
/* @__PURE__ */ r("span", { className: "font-medium text-fg", children: [
|
|
3135
3135
|
y,
|
|
3136
3136
|
"–",
|
|
3137
|
-
|
|
3137
|
+
R
|
|
3138
3138
|
] }),
|
|
3139
3139
|
" ",
|
|
3140
3140
|
"of ",
|
|
3141
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children:
|
|
3141
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children: D })
|
|
3142
3142
|
] }),
|
|
3143
3143
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
3144
3144
|
/* @__PURE__ */ r("label", { className: "flex items-center gap-1.5", children: [
|
|
@@ -3147,9 +3147,9 @@ function Sr() {
|
|
|
3147
3147
|
"select",
|
|
3148
3148
|
{
|
|
3149
3149
|
value: l,
|
|
3150
|
-
onChange: (
|
|
3150
|
+
onChange: (g) => d(Number(g.target.value)),
|
|
3151
3151
|
className: "h-8 rounded-md bg-surface px-2 text-sm text-fg ring-1 ring-line transition-all focus:outline-none focus:ring-2 focus:ring-brand/30",
|
|
3152
|
-
children: Nr.map((
|
|
3152
|
+
children: Nr.map((g) => /* @__PURE__ */ e("option", { value: g, children: g }, g))
|
|
3153
3153
|
}
|
|
3154
3154
|
)
|
|
3155
3155
|
] }),
|
|
@@ -3167,13 +3167,13 @@ function Sr() {
|
|
|
3167
3167
|
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children: c + 1 }),
|
|
3168
3168
|
" of",
|
|
3169
3169
|
" ",
|
|
3170
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children:
|
|
3170
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-fg", children: h })
|
|
3171
3171
|
] }),
|
|
3172
3172
|
/* @__PURE__ */ e(
|
|
3173
3173
|
"button",
|
|
3174
3174
|
{
|
|
3175
|
-
onClick: () => m(Math.min(
|
|
3176
|
-
disabled: c >=
|
|
3175
|
+
onClick: () => m(Math.min(h - 1, c + 1)),
|
|
3176
|
+
disabled: c >= h - 1,
|
|
3177
3177
|
className: "rounded-md bg-surface px-3 py-1 text-sm text-fg ring-1 ring-line transition-colors hover:bg-surface-subtle disabled:cursor-not-allowed disabled:opacity-40",
|
|
3178
3178
|
children: "Next"
|
|
3179
3179
|
}
|
|
@@ -3189,6 +3189,7 @@ const kr = {
|
|
|
3189
3189
|
{ name: "customer_name", label: "Customer Name", type: "text", required: !0 },
|
|
3190
3190
|
{ name: "customer_group", label: "Customer Group", type: "select", options: ["Individual", "Commercial", "Government", "Non-Profit", "Premium"] },
|
|
3191
3191
|
{ name: "territory", label: "Territory", type: "text" },
|
|
3192
|
+
{ name: "default_currency", label: "Currency", type: "select", options: ["", "USD", "EUR", "GBP", "CHF", "JPY", "CAD", "AUD", "CNY", "INR"] },
|
|
3192
3193
|
{ name: "credit_limit", label: "Credit Limit", type: "currency" },
|
|
3193
3194
|
{ name: "email", label: "Email", type: "text" },
|
|
3194
3195
|
{ name: "phone", label: "Phone", type: "text" },
|
|
@@ -3202,6 +3203,7 @@ const kr = {
|
|
|
3202
3203
|
{ name: "name", label: "ID", type: "text", required: !0 },
|
|
3203
3204
|
{ name: "supplier_name", label: "Supplier Name", type: "text", required: !0 },
|
|
3204
3205
|
{ name: "supplier_group", label: "Supplier Group", type: "select", options: ["Local", "Distributor", "Services", "Raw Materials"] },
|
|
3206
|
+
{ name: "default_currency", label: "Currency", type: "select", options: ["", "USD", "EUR", "GBP", "CHF", "JPY", "CAD", "AUD", "CNY", "INR"] },
|
|
3205
3207
|
{ name: "email", label: "Email", type: "text" },
|
|
3206
3208
|
{ name: "phone", label: "Phone", type: "text" },
|
|
3207
3209
|
{ name: "address", label: "Address", type: "textarea" },
|
|
@@ -3246,41 +3248,41 @@ const kr = {
|
|
|
3246
3248
|
company: "Company"
|
|
3247
3249
|
}, bn = /* @__PURE__ */ new Set(["customer", "supplier", "item", "warehouse"]);
|
|
3248
3250
|
function xn() {
|
|
3249
|
-
var
|
|
3250
|
-
const { type: t, name: n } = ut(), a = Oe(), s = We(), { t: l } = Z(), i = !n || n === "new", c = wr[t ?? ""] ?? t ?? "", o = l(`masters.${t}.one`, { defaultValue: c }), m = kr[t ?? ""] ?? [], d = (
|
|
3251
|
+
var w;
|
|
3252
|
+
const { type: t, name: n } = ut(), a = Oe(), s = We(), { t: l } = Z(), i = !n || n === "new", c = wr[t ?? ""] ?? t ?? "", o = l(`masters.${t}.one`, { defaultValue: c }), m = kr[t ?? ""] ?? [], d = (N) => l(`fields.${N.label}`, { defaultValue: N.label }), [u, p] = S({}), { data: v, isLoading: D } = le({
|
|
3251
3253
|
queryKey: ["master", t, n],
|
|
3252
3254
|
queryFn: () => O.getMaster(t, n),
|
|
3253
3255
|
enabled: !!t && !!n && !i
|
|
3254
3256
|
});
|
|
3255
|
-
|
|
3257
|
+
se(() => {
|
|
3256
3258
|
if (i) {
|
|
3257
|
-
const
|
|
3259
|
+
const N = {};
|
|
3258
3260
|
m.forEach((q) => {
|
|
3259
|
-
|
|
3260
|
-
}), p(
|
|
3261
|
+
N[q.name] = q.default ?? "";
|
|
3262
|
+
}), p(N);
|
|
3261
3263
|
} else v && p(v);
|
|
3262
3264
|
}, [i, v, m]);
|
|
3263
|
-
const
|
|
3264
|
-
mutationFn: (
|
|
3265
|
-
onSuccess: (
|
|
3266
|
-
s.invalidateQueries({ queryKey: ["masters", t] }), a(`/masters/${t}/${
|
|
3265
|
+
const h = pe({
|
|
3266
|
+
mutationFn: (N) => O.createMaster(t, N),
|
|
3267
|
+
onSuccess: (N) => {
|
|
3268
|
+
s.invalidateQueries({ queryKey: ["masters", t] }), a(`/masters/${t}/${N.name}`, { replace: !0 });
|
|
3267
3269
|
}
|
|
3268
|
-
}), y =
|
|
3269
|
-
mutationFn: (
|
|
3270
|
+
}), y = pe({
|
|
3271
|
+
mutationFn: (N) => O.updateMaster(t, n, N),
|
|
3270
3272
|
onSuccess: () => {
|
|
3271
3273
|
s.invalidateQueries({ queryKey: ["master", t, n] }), s.invalidateQueries({ queryKey: ["masters", t] });
|
|
3272
3274
|
}
|
|
3273
|
-
}),
|
|
3275
|
+
}), R = pe({
|
|
3274
3276
|
mutationFn: () => O.deleteMaster(t, n),
|
|
3275
|
-
onSuccess: (
|
|
3276
|
-
if (s.invalidateQueries({ queryKey: ["masters", t] }), (
|
|
3277
|
+
onSuccess: (N) => {
|
|
3278
|
+
if (s.invalidateQueries({ queryKey: ["masters", t] }), (N == null ? void 0 : N.status) === "disabled") {
|
|
3277
3279
|
a(`/masters/${t}`, {
|
|
3278
3280
|
replace: !0,
|
|
3279
3281
|
state: {
|
|
3280
3282
|
notice: l("masterForm.disabledOnDelete", {
|
|
3281
3283
|
label: o,
|
|
3282
3284
|
name: n,
|
|
3283
|
-
reason:
|
|
3285
|
+
reason: N.reason ?? "other records"
|
|
3284
3286
|
})
|
|
3285
3287
|
}
|
|
3286
3288
|
});
|
|
@@ -3288,133 +3290,133 @@ function xn() {
|
|
|
3288
3290
|
}
|
|
3289
3291
|
a(`/masters/${t}`, { replace: !0 });
|
|
3290
3292
|
}
|
|
3291
|
-
}),
|
|
3292
|
-
if (
|
|
3293
|
-
const
|
|
3294
|
-
i ?
|
|
3293
|
+
}), B = () => {
|
|
3294
|
+
if (_.length > 0) return;
|
|
3295
|
+
const N = t === "company" && !u.name ? { ...u, name: u.company_name } : u;
|
|
3296
|
+
i ? h.mutate(N) : y.mutate(N);
|
|
3295
3297
|
}, C = () => {
|
|
3296
|
-
window.confirm(l("masterForm.deleteConfirm", { label: o })) &&
|
|
3297
|
-
}, b = (
|
|
3298
|
-
p((x) => ({ ...x, [
|
|
3298
|
+
window.confirm(l("masterForm.deleteConfirm", { label: o })) && R.mutate();
|
|
3299
|
+
}, b = (N, q) => {
|
|
3300
|
+
p((x) => ({ ...x, [N]: q }));
|
|
3299
3301
|
};
|
|
3300
|
-
if (!i &&
|
|
3302
|
+
if (!i && D)
|
|
3301
3303
|
return /* @__PURE__ */ e("p", { className: "text-fg-muted", children: l("common.loading") });
|
|
3302
|
-
const
|
|
3303
|
-
if (!
|
|
3304
|
-
const q = u[
|
|
3304
|
+
const g = h.isPending || y.isPending, _ = m.filter((N) => {
|
|
3305
|
+
if (!N.required || N.readOnly || i && N.name === "name" && bn.has(t ?? "")) return !1;
|
|
3306
|
+
const q = u[N.name];
|
|
3305
3307
|
return q == null || String(q).trim() === "";
|
|
3306
3308
|
});
|
|
3307
3309
|
return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
3308
3310
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ r("div", { className: "flex gap-2", children: [
|
|
3309
|
-
/* @__PURE__ */ e(
|
|
3311
|
+
/* @__PURE__ */ e(ee, { onClick: B, disabled: g || _.length > 0, children: l(g ? "common.saving" : "common.save") }),
|
|
3310
3312
|
!i && /* @__PURE__ */ e(
|
|
3311
|
-
|
|
3313
|
+
ee,
|
|
3312
3314
|
{
|
|
3313
3315
|
variant: "danger",
|
|
3314
3316
|
onClick: C,
|
|
3315
|
-
disabled:
|
|
3317
|
+
disabled: R.isPending,
|
|
3316
3318
|
children: l("common.delete")
|
|
3317
3319
|
}
|
|
3318
3320
|
)
|
|
3319
3321
|
] }) }),
|
|
3320
|
-
(
|
|
3321
|
-
|
|
3322
|
+
(h.error || y.error || R.error) && /* @__PURE__ */ e("div", { className: "rounded-lg bg-rose-50 p-4 text-sm text-rose-700 ring-1 ring-rose-200", children: ((w = h.error ?? y.error ?? R.error) == null ? void 0 : w.message) ?? l("common.errorOccurred") }),
|
|
3323
|
+
_.length > 0 && /* @__PURE__ */ e("div", { className: "rounded-lg bg-amber-50 p-4 text-sm text-amber-800 ring-1 ring-amber-200", children: l("masterForm.required", { fields: _.map(d).join(", ") }) }),
|
|
3322
3324
|
u.disabled === 1 && /* @__PURE__ */ e("div", { className: "rounded-lg bg-amber-50 p-4 text-sm text-amber-800 ring-1 ring-amber-200", children: l("masterForm.disabledNotice", { label: o }) }),
|
|
3323
|
-
/* @__PURE__ */ e(
|
|
3324
|
-
const x =
|
|
3325
|
-
if (
|
|
3325
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: m.map((N) => {
|
|
3326
|
+
const x = N.name === "name" && !i || N.readOnly, z = N.required && !(i && N.name === "name" && bn.has(t ?? ""));
|
|
3327
|
+
if (N.type === "select" && N.options)
|
|
3326
3328
|
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
3327
3329
|
Ke,
|
|
3328
3330
|
{
|
|
3329
|
-
label: d(
|
|
3330
|
-
options:
|
|
3331
|
-
value: u[
|
|
3331
|
+
label: d(N),
|
|
3332
|
+
options: N.options,
|
|
3333
|
+
value: u[N.name] ?? "",
|
|
3332
3334
|
required: z,
|
|
3333
3335
|
disabled: x,
|
|
3334
|
-
onChange: (
|
|
3336
|
+
onChange: (V) => b(N.name, V.target.value)
|
|
3335
3337
|
}
|
|
3336
|
-
) },
|
|
3337
|
-
if (
|
|
3338
|
+
) }, N.name);
|
|
3339
|
+
if (N.type === "textarea")
|
|
3338
3340
|
return /* @__PURE__ */ r("div", { className: "sm:col-span-2", children: [
|
|
3339
|
-
/* @__PURE__ */ e("label", { className: "mb-1.5 block text-sm font-medium text-fg", children: d(
|
|
3341
|
+
/* @__PURE__ */ e("label", { className: "mb-1.5 block text-sm font-medium text-fg", children: d(N) }),
|
|
3340
3342
|
/* @__PURE__ */ e(
|
|
3341
3343
|
"textarea",
|
|
3342
3344
|
{
|
|
3343
3345
|
className: "block w-full rounded-lg bg-surface px-3 py-2 text-sm text-fg ring-1 ring-line transition-all placeholder:text-fg-muted/70 focus:outline-none focus:ring-2 focus:ring-brand/30 disabled:bg-surface-subtle disabled:text-fg-muted",
|
|
3344
3346
|
rows: 3,
|
|
3345
|
-
value: u[
|
|
3347
|
+
value: u[N.name] ?? "",
|
|
3346
3348
|
required: z,
|
|
3347
3349
|
readOnly: x,
|
|
3348
3350
|
disabled: x,
|
|
3349
|
-
onChange: (
|
|
3351
|
+
onChange: (V) => b(N.name, V.target.value)
|
|
3350
3352
|
}
|
|
3351
3353
|
)
|
|
3352
|
-
] },
|
|
3353
|
-
const j =
|
|
3354
|
+
] }, N.name);
|
|
3355
|
+
const j = N.type === "number" || N.type === "currency" ? "number" : N.type === "date" ? "date" : "text";
|
|
3354
3356
|
return /* @__PURE__ */ e(
|
|
3355
|
-
|
|
3357
|
+
X,
|
|
3356
3358
|
{
|
|
3357
|
-
label: d(
|
|
3359
|
+
label: d(N),
|
|
3358
3360
|
type: j,
|
|
3359
|
-
step:
|
|
3361
|
+
step: N.type === "currency" ? "0.01" : void 0,
|
|
3360
3362
|
required: z,
|
|
3361
3363
|
readOnly: x,
|
|
3362
3364
|
disabled: x,
|
|
3363
|
-
value: u[
|
|
3364
|
-
onChange: (
|
|
3365
|
-
|
|
3366
|
-
j === "number" ? parseFloat(
|
|
3365
|
+
value: u[N.name] ?? "",
|
|
3366
|
+
onChange: (V) => b(
|
|
3367
|
+
N.name,
|
|
3368
|
+
j === "number" ? parseFloat(V.target.value) || 0 : V.target.value
|
|
3367
3369
|
)
|
|
3368
3370
|
},
|
|
3369
|
-
|
|
3371
|
+
N.name
|
|
3370
3372
|
);
|
|
3371
3373
|
}) }) })
|
|
3372
3374
|
] });
|
|
3373
3375
|
}
|
|
3374
3376
|
function Cr(t) {
|
|
3375
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3377
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3376
3378
|
queryKey: ["report", "trial-balance", t],
|
|
3377
3379
|
queryFn: () => O.trialBalance(t)
|
|
3378
3380
|
});
|
|
3379
3381
|
return { data: n, isLoading: a, error: s, refetch: l };
|
|
3380
3382
|
}
|
|
3381
3383
|
function Dr(t) {
|
|
3382
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3384
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3383
3385
|
queryKey: ["report", "general-ledger", t],
|
|
3384
3386
|
queryFn: () => O.generalLedger(t)
|
|
3385
3387
|
});
|
|
3386
3388
|
return { data: n, isLoading: a, error: s, refetch: l };
|
|
3387
3389
|
}
|
|
3388
3390
|
function _r(t) {
|
|
3389
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3391
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3390
3392
|
queryKey: ["report", "stock-balance", t],
|
|
3391
3393
|
queryFn: () => O.stockBalance(t)
|
|
3392
3394
|
});
|
|
3393
3395
|
return { data: n, isLoading: a, error: s, refetch: l };
|
|
3394
3396
|
}
|
|
3395
3397
|
function Ar(t) {
|
|
3396
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3398
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3397
3399
|
queryKey: ["report", "profit-and-loss", t],
|
|
3398
3400
|
queryFn: () => O.profitAndLoss(t)
|
|
3399
3401
|
});
|
|
3400
3402
|
return { data: n, isLoading: a, error: s, refetch: l };
|
|
3401
3403
|
}
|
|
3402
3404
|
function Tr(t) {
|
|
3403
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3405
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3404
3406
|
queryKey: ["report", "balance-sheet", t],
|
|
3405
3407
|
queryFn: () => O.balanceSheet(t)
|
|
3406
3408
|
});
|
|
3407
3409
|
return { data: n, isLoading: a, error: s, refetch: l };
|
|
3408
3410
|
}
|
|
3409
3411
|
function Pr(t) {
|
|
3410
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3412
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3411
3413
|
queryKey: ["report", "ar-aging", t],
|
|
3412
3414
|
queryFn: () => O.arAging(t)
|
|
3413
3415
|
});
|
|
3414
3416
|
return { data: n, isLoading: a, error: s, refetch: l };
|
|
3415
3417
|
}
|
|
3416
3418
|
function Rr(t) {
|
|
3417
|
-
const { data: n, isLoading: a, error: s, refetch: l } =
|
|
3419
|
+
const { data: n, isLoading: a, error: s, refetch: l } = le({
|
|
3418
3420
|
queryKey: ["report", "ap-aging", t],
|
|
3419
3421
|
queryFn: () => O.apAging(t)
|
|
3420
3422
|
});
|
|
@@ -3427,14 +3429,14 @@ function ke({
|
|
|
3427
3429
|
linkDoctype: s,
|
|
3428
3430
|
readOnly: l
|
|
3429
3431
|
}) {
|
|
3430
|
-
const [i, c] =
|
|
3431
|
-
|
|
3432
|
+
const [i, c] = S(n ?? ""), [o, m] = S([]), [d, u] = S(!1), [p, v] = S(!1), [D, h] = S({}), y = H(null), R = H(null), B = H(null), C = H(null), b = H(!1);
|
|
3433
|
+
se(() => {
|
|
3432
3434
|
c(n ?? "");
|
|
3433
3435
|
}, [n]);
|
|
3434
|
-
const
|
|
3436
|
+
const g = we(() => {
|
|
3435
3437
|
if (C.current) {
|
|
3436
3438
|
const x = C.current.getBoundingClientRect();
|
|
3437
|
-
|
|
3439
|
+
h({
|
|
3438
3440
|
position: "fixed",
|
|
3439
3441
|
top: x.bottom + 4,
|
|
3440
3442
|
left: x.left,
|
|
@@ -3442,7 +3444,7 @@ function ke({
|
|
|
3442
3444
|
zIndex: 9999
|
|
3443
3445
|
});
|
|
3444
3446
|
}
|
|
3445
|
-
}, []),
|
|
3447
|
+
}, []), _ = we(
|
|
3446
3448
|
(x) => {
|
|
3447
3449
|
y.current && clearTimeout(y.current), y.current = setTimeout(async () => {
|
|
3448
3450
|
v(!0);
|
|
@@ -3457,10 +3459,10 @@ function ke({
|
|
|
3457
3459
|
}, 300);
|
|
3458
3460
|
},
|
|
3459
3461
|
[s]
|
|
3460
|
-
),
|
|
3462
|
+
), w = (x) => {
|
|
3461
3463
|
const z = x.target.value;
|
|
3462
|
-
c(z),
|
|
3463
|
-
},
|
|
3464
|
+
c(z), _(z);
|
|
3465
|
+
}, N = (x) => {
|
|
3464
3466
|
const z = x.name ?? x.id ?? String(x);
|
|
3465
3467
|
c(z), a(z), u(!1), m([]);
|
|
3466
3468
|
}, q = () => {
|
|
@@ -3472,17 +3474,17 @@ function ke({
|
|
|
3472
3474
|
u(!1), i !== n && a(i);
|
|
3473
3475
|
}, 150);
|
|
3474
3476
|
};
|
|
3475
|
-
return
|
|
3477
|
+
return se(() => {
|
|
3476
3478
|
const x = (z) => {
|
|
3477
|
-
var
|
|
3479
|
+
var V, Y;
|
|
3478
3480
|
const j = z.target;
|
|
3479
|
-
(
|
|
3481
|
+
(V = R.current) != null && V.contains(j) || (Y = B.current) != null && Y.contains(j) || u(!1);
|
|
3480
3482
|
};
|
|
3481
3483
|
return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
|
|
3482
3484
|
}, []), l ? /* @__PURE__ */ r("div", { children: [
|
|
3483
3485
|
t && /* @__PURE__ */ e("span", { className: "mb-1.5 block text-sm font-medium text-fg", children: t }),
|
|
3484
3486
|
/* @__PURE__ */ e("span", { className: "text-sm text-fg", children: n || "—" })
|
|
3485
|
-
] }) : /* @__PURE__ */ r("div", { ref:
|
|
3487
|
+
] }) : /* @__PURE__ */ r("div", { ref: R, className: "relative", children: [
|
|
3486
3488
|
t && /* @__PURE__ */ e("label", { className: "mb-1.5 block text-sm font-medium text-fg", children: t }),
|
|
3487
3489
|
/* @__PURE__ */ e(
|
|
3488
3490
|
"input",
|
|
@@ -3490,9 +3492,9 @@ function ke({
|
|
|
3490
3492
|
ref: C,
|
|
3491
3493
|
type: "text",
|
|
3492
3494
|
value: i,
|
|
3493
|
-
onChange:
|
|
3495
|
+
onChange: w,
|
|
3494
3496
|
onFocus: () => {
|
|
3495
|
-
|
|
3497
|
+
g(), _(i);
|
|
3496
3498
|
},
|
|
3497
3499
|
onBlur: q,
|
|
3498
3500
|
placeholder: `Search ${s}...`,
|
|
@@ -3503,7 +3505,7 @@ function ke({
|
|
|
3503
3505
|
}
|
|
3504
3506
|
),
|
|
3505
3507
|
d && o.length > 0 && Ca(
|
|
3506
|
-
/* @__PURE__ */ e("div", { ref:
|
|
3508
|
+
/* @__PURE__ */ e("div", { ref: B, style: D, className: "max-h-48 overflow-y-auto rounded-lg bg-surface ring-1 ring-line shadow-card-hover", children: o.map((x, z) => {
|
|
3507
3509
|
const j = x.name ?? x.id ?? String(x);
|
|
3508
3510
|
return /* @__PURE__ */ e(
|
|
3509
3511
|
"button",
|
|
@@ -3512,7 +3514,7 @@ function ke({
|
|
|
3512
3514
|
onMouseDown: () => {
|
|
3513
3515
|
b.current = !0;
|
|
3514
3516
|
},
|
|
3515
|
-
onClick: () =>
|
|
3517
|
+
onClick: () => N(x),
|
|
3516
3518
|
className: "block w-full px-3 py-1.5 text-left text-sm text-fg transition-colors hover:bg-surface-subtle",
|
|
3517
3519
|
children: j
|
|
3518
3520
|
},
|
|
@@ -3524,16 +3526,16 @@ function ke({
|
|
|
3524
3526
|
] });
|
|
3525
3527
|
}
|
|
3526
3528
|
function Ir() {
|
|
3527
|
-
const { t } = Z(), [n] = J("company", ""), [a] = J("from", ""), [s] = J("to", ""), l = Me(), [i, c] =
|
|
3529
|
+
const { t } = Z(), [n] = J("company", ""), [a] = J("from", ""), [s] = J("to", ""), l = Me(), [i, c] = S(n), [o, m] = S(a), [d, u] = S(s), p = Fe(i), v = (b) => Le(b, p), D = Ce(() => {
|
|
3528
3530
|
const b = {};
|
|
3529
3531
|
return n && (b.company = n), a && (b.from_date = a), s && (b.to_date = s), b;
|
|
3530
|
-
}, [n, a, s]), { data:
|
|
3532
|
+
}, [n, a, s]), { data: h, isLoading: y, refetch: R } = Cr(D), B = () => {
|
|
3531
3533
|
l({
|
|
3532
3534
|
company: i || null,
|
|
3533
3535
|
from: o || null,
|
|
3534
3536
|
to: d || null
|
|
3535
|
-
}),
|
|
3536
|
-
}, C =
|
|
3537
|
+
}), R();
|
|
3538
|
+
}, C = h ? h.difference === 0 : !1;
|
|
3537
3539
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3538
3540
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
3539
3541
|
/* @__PURE__ */ e(
|
|
@@ -3547,7 +3549,7 @@ function Ir() {
|
|
|
3547
3549
|
}
|
|
3548
3550
|
),
|
|
3549
3551
|
/* @__PURE__ */ e(
|
|
3550
|
-
|
|
3552
|
+
X,
|
|
3551
3553
|
{
|
|
3552
3554
|
label: t("fields.From Date", { defaultValue: "From Date" }),
|
|
3553
3555
|
type: "date",
|
|
@@ -3556,7 +3558,7 @@ function Ir() {
|
|
|
3556
3558
|
}
|
|
3557
3559
|
),
|
|
3558
3560
|
/* @__PURE__ */ e(
|
|
3559
|
-
|
|
3561
|
+
X,
|
|
3560
3562
|
{
|
|
3561
3563
|
label: t("fields.To Date", { defaultValue: "To Date" }),
|
|
3562
3564
|
type: "date",
|
|
@@ -3564,12 +3566,12 @@ function Ir() {
|
|
|
3564
3566
|
onChange: (b) => u(b.target.value)
|
|
3565
3567
|
}
|
|
3566
3568
|
),
|
|
3567
|
-
/* @__PURE__ */ e(
|
|
3569
|
+
/* @__PURE__ */ e(ee, { onClick: B, children: t("common.apply") })
|
|
3568
3570
|
] }),
|
|
3569
|
-
/* @__PURE__ */ e(Dt, { onSelect: (b,
|
|
3570
|
-
m(b), u(
|
|
3571
|
+
/* @__PURE__ */ e(Dt, { onSelect: (b, g) => {
|
|
3572
|
+
m(b), u(g), l({ from: b, to: g });
|
|
3571
3573
|
} }),
|
|
3572
|
-
y ? /* @__PURE__ */ e("p", { className: "text-fg-muted", children: t("common.loading") }) : !
|
|
3574
|
+
y ? /* @__PURE__ */ e("p", { className: "text-fg-muted", children: t("common.loading") }) : !h || !h.rows || h.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-fg-muted", children: t("reports.noData") }) : /* @__PURE__ */ r(U, { children: [
|
|
3573
3575
|
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-line text-sm", children: [
|
|
3574
3576
|
/* @__PURE__ */ e("thead", { className: "bg-surface-subtle", children: /* @__PURE__ */ r("tr", { children: [
|
|
3575
3577
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wide text-fg-muted", children: t("fields.Account", { defaultValue: "Account" }) }),
|
|
@@ -3577,17 +3579,17 @@ function Ir() {
|
|
|
3577
3579
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right text-xs font-medium uppercase tracking-wide text-fg-muted", children: t("fields.Credit", { defaultValue: "Credit" }) }),
|
|
3578
3580
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right text-xs font-medium uppercase tracking-wide text-fg-muted", children: t("fields.Balance", { defaultValue: "Balance" }) })
|
|
3579
3581
|
] }) }),
|
|
3580
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-line", children:
|
|
3582
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-line", children: h.rows.map((b, g) => /* @__PURE__ */ r("tr", { className: "transition-colors hover:bg-surface-subtle", children: [
|
|
3581
3583
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-fg", children: b.account }),
|
|
3582
3584
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right tabular-nums text-fg", children: v(b.debit) }),
|
|
3583
3585
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right tabular-nums text-fg", children: v(b.credit) }),
|
|
3584
3586
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right font-medium tabular-nums text-fg", children: v(b.balance) })
|
|
3585
|
-
] },
|
|
3587
|
+
] }, g)) }),
|
|
3586
3588
|
/* @__PURE__ */ e("tfoot", { className: "border-t border-line bg-surface-subtle font-semibold", children: /* @__PURE__ */ r("tr", { children: [
|
|
3587
3589
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-fg", children: t("common.total") }),
|
|
3588
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right tabular-nums text-fg", children: v(
|
|
3589
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right tabular-nums text-fg", children: v(
|
|
3590
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right tabular-nums text-fg", children: v(
|
|
3590
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right tabular-nums text-fg", children: v(h.total_debit) }),
|
|
3591
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right tabular-nums text-fg", children: v(h.total_credit) }),
|
|
3592
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right tabular-nums text-fg", children: v(h.difference) })
|
|
3591
3593
|
] }) })
|
|
3592
3594
|
] }) }),
|
|
3593
3595
|
/* @__PURE__ */ e("div", { className: "mt-4 text-center", children: C ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-emerald-50 px-4 py-1.5 text-sm font-semibold text-emerald-700 ring-1 ring-emerald-200", children: [
|
|
@@ -3605,15 +3607,15 @@ function Lr(t) {
|
|
|
3605
3607
|
}
|
|
3606
3608
|
const Br = ["25", "50", "100", "200"];
|
|
3607
3609
|
function Er() {
|
|
3608
|
-
const { t } = Z(), [n] = J("account", ""), [a] = J("party", ""), [s] = J("from", ""), [l] = J("to", ""), [i] = J("per_page", 50), [c] = J("page", 1), o = c - 1, m = Me(), d = (
|
|
3609
|
-
const
|
|
3610
|
-
return n && (
|
|
3611
|
-
}, [n, a, s, l, i, o]), { data:
|
|
3610
|
+
const { t } = Z(), [n] = J("account", ""), [a] = J("party", ""), [s] = J("from", ""), [l] = J("to", ""), [i] = J("per_page", 50), [c] = J("page", 1), o = c - 1, m = Me(), d = (P) => m({ page: P === 0 ? null : P + 1 }), u = (P) => m({ per_page: P, page: null }), [p, v] = S(n), [D, h] = S(a), [y, R] = S(s), [B, C] = S(l), b = Fe(), g = (P) => Le(P, b), _ = Ce(() => {
|
|
3611
|
+
const P = {};
|
|
3612
|
+
return n && (P.account = n), a && (P.party = a), s && (P.from_date = s), l && (P.to_date = l), P.limit = String(i), P.offset = String(o * i), P;
|
|
3613
|
+
}, [n, a, s, l, i, o]), { data: w, isLoading: N, refetch: q } = Dr(_), x = (w == null ? void 0 : w.rows) ?? [], z = (w == null ? void 0 : w.total) ?? 0, j = Math.max(1, Math.ceil(z / i)), V = z === 0 ? 0 : o * i + 1, Y = Math.min(z, (o + 1) * i), de = () => {
|
|
3612
3614
|
m({
|
|
3613
3615
|
account: p || null,
|
|
3614
|
-
party:
|
|
3616
|
+
party: D || null,
|
|
3615
3617
|
from: y || null,
|
|
3616
|
-
to:
|
|
3618
|
+
to: B || null,
|
|
3617
3619
|
page: null
|
|
3618
3620
|
}), q();
|
|
3619
3621
|
};
|
|
@@ -3633,37 +3635,37 @@ function Er() {
|
|
|
3633
3635
|
ke,
|
|
3634
3636
|
{
|
|
3635
3637
|
label: t("fields.Party", { defaultValue: "Party" }),
|
|
3636
|
-
value:
|
|
3637
|
-
onChange:
|
|
3638
|
+
value: D,
|
|
3639
|
+
onChange: h,
|
|
3638
3640
|
linkDoctype: "customer",
|
|
3639
3641
|
readOnly: !1
|
|
3640
3642
|
}
|
|
3641
3643
|
),
|
|
3642
3644
|
/* @__PURE__ */ e(
|
|
3643
|
-
|
|
3645
|
+
X,
|
|
3644
3646
|
{
|
|
3645
3647
|
label: t("fields.From Date", { defaultValue: "From Date" }),
|
|
3646
3648
|
type: "date",
|
|
3647
3649
|
value: y,
|
|
3648
|
-
onChange: (
|
|
3650
|
+
onChange: (P) => R(P.target.value)
|
|
3649
3651
|
}
|
|
3650
3652
|
),
|
|
3651
3653
|
/* @__PURE__ */ e(
|
|
3652
|
-
|
|
3654
|
+
X,
|
|
3653
3655
|
{
|
|
3654
3656
|
label: t("fields.To Date", { defaultValue: "To Date" }),
|
|
3655
3657
|
type: "date",
|
|
3656
|
-
value:
|
|
3657
|
-
onChange: (
|
|
3658
|
+
value: B,
|
|
3659
|
+
onChange: (P) => C(P.target.value)
|
|
3658
3660
|
}
|
|
3659
3661
|
),
|
|
3660
|
-
/* @__PURE__ */ e(
|
|
3662
|
+
/* @__PURE__ */ e(ee, { onClick: de, children: t("common.apply") })
|
|
3661
3663
|
] }),
|
|
3662
|
-
/* @__PURE__ */ e(Dt, { onSelect: (
|
|
3663
|
-
|
|
3664
|
+
/* @__PURE__ */ e(Dt, { onSelect: (P, K) => {
|
|
3665
|
+
R(P), C(K), m({ from: P, to: K, page: null });
|
|
3664
3666
|
} }),
|
|
3665
|
-
|
|
3666
|
-
/* @__PURE__ */ e(
|
|
3667
|
+
N ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : x.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noEntries") }) : /* @__PURE__ */ r(Ne, { children: [
|
|
3668
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
3667
3669
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
3668
3670
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Date", { defaultValue: "Date" }) }),
|
|
3669
3671
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Account", { defaultValue: "Account" }) }),
|
|
@@ -3674,22 +3676,22 @@ function Er() {
|
|
|
3674
3676
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Voucher Type", { defaultValue: "Voucher Type" }) }),
|
|
3675
3677
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Voucher No", { defaultValue: "Voucher No" }) })
|
|
3676
3678
|
] }) }),
|
|
3677
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: x.map((
|
|
3678
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-500", children: Ct(
|
|
3679
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-900", children:
|
|
3680
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-700", children:
|
|
3681
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children:
|
|
3682
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children:
|
|
3683
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right font-medium", children:
|
|
3684
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-700", children:
|
|
3685
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2", children:
|
|
3679
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: x.map((P, K) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
3680
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-500", children: Ct(P.posting_date ?? P.date) }),
|
|
3681
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-900", children: P.account }),
|
|
3682
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-700", children: P.party ?? "-" }),
|
|
3683
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: g(P.debit) }),
|
|
3684
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: g(P.credit) }),
|
|
3685
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right font-medium", children: g(P.balance) }),
|
|
3686
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-700", children: P.voucher_type ?? "-" }),
|
|
3687
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: P.voucher_type && P.voucher_no ? /* @__PURE__ */ e(
|
|
3686
3688
|
ye,
|
|
3687
3689
|
{
|
|
3688
|
-
to: `/app/${Lr(
|
|
3690
|
+
to: `/app/${Lr(P.voucher_type)}/${P.voucher_no}`,
|
|
3689
3691
|
className: "font-medium text-blue-600 hover:text-blue-800",
|
|
3690
|
-
children:
|
|
3692
|
+
children: P.voucher_no
|
|
3691
3693
|
}
|
|
3692
|
-
) :
|
|
3694
|
+
) : P.voucher_no ?? "-" })
|
|
3693
3695
|
] }, K)) })
|
|
3694
3696
|
] }) }) }),
|
|
3695
3697
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-between gap-3 text-sm text-gray-600", children: [
|
|
@@ -3697,7 +3699,7 @@ function Er() {
|
|
|
3697
3699
|
t("common.showing"),
|
|
3698
3700
|
" ",
|
|
3699
3701
|
/* @__PURE__ */ r("span", { className: "font-medium text-gray-900", children: [
|
|
3700
|
-
|
|
3702
|
+
V,
|
|
3701
3703
|
"–",
|
|
3702
3704
|
Y
|
|
3703
3705
|
] }),
|
|
@@ -3713,9 +3715,9 @@ function Er() {
|
|
|
3713
3715
|
"select",
|
|
3714
3716
|
{
|
|
3715
3717
|
value: i,
|
|
3716
|
-
onChange: (
|
|
3718
|
+
onChange: (P) => u(Number(P.target.value)),
|
|
3717
3719
|
className: "rounded border border-gray-300 bg-white px-2 py-1 text-sm",
|
|
3718
|
-
children: Br.map((
|
|
3720
|
+
children: Br.map((P) => /* @__PURE__ */ e("option", { value: P, children: P }, P))
|
|
3719
3721
|
}
|
|
3720
3722
|
)
|
|
3721
3723
|
] }),
|
|
@@ -3752,14 +3754,14 @@ function Er() {
|
|
|
3752
3754
|
] });
|
|
3753
3755
|
}
|
|
3754
3756
|
function Or() {
|
|
3755
|
-
const { t } = Z(), [n] = J("item_code", ""), [a] = J("warehouse", ""), s = Me(), [l, i] =
|
|
3757
|
+
const { t } = Z(), [n] = J("item_code", ""), [a] = J("warehouse", ""), s = Me(), [l, i] = S(n), [c, o] = S(a), m = Fe(), d = (y) => Le(y, m), u = Ce(() => {
|
|
3756
3758
|
const y = {};
|
|
3757
3759
|
return n && (y.item_code = n), a && (y.warehouse = a), y;
|
|
3758
|
-
}, [n, a]), { data: p, isLoading: v, refetch:
|
|
3760
|
+
}, [n, a]), { data: p, isLoading: v, refetch: D } = _r(u), h = () => {
|
|
3759
3761
|
s({
|
|
3760
3762
|
item_code: l || null,
|
|
3761
3763
|
warehouse: c || null
|
|
3762
|
-
}),
|
|
3764
|
+
}), D();
|
|
3763
3765
|
};
|
|
3764
3766
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3765
3767
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
@@ -3783,9 +3785,9 @@ function Or() {
|
|
|
3783
3785
|
readOnly: !1
|
|
3784
3786
|
}
|
|
3785
3787
|
),
|
|
3786
|
-
/* @__PURE__ */ e(
|
|
3788
|
+
/* @__PURE__ */ e(ee, { onClick: h, children: t("common.apply") })
|
|
3787
3789
|
] }),
|
|
3788
|
-
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : !p || !p.rows || p.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noStockData") }) : /* @__PURE__ */ e(
|
|
3790
|
+
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : !p || !p.rows || p.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noStockData") }) : /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
3789
3791
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
3790
3792
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Item Code", { defaultValue: "Item Code" }) }),
|
|
3791
3793
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Item Name", { defaultValue: "Item Name" }) }),
|
|
@@ -3794,84 +3796,84 @@ function Or() {
|
|
|
3794
3796
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-medium text-gray-500", children: t("fields.Valuation Rate", { defaultValue: "Valuation Rate" }) }),
|
|
3795
3797
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-medium text-gray-500", children: t("fields.Stock Value", { defaultValue: "Stock Value" }) })
|
|
3796
3798
|
] }) }),
|
|
3797
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: p.rows.map((y,
|
|
3799
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: p.rows.map((y, R) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
3798
3800
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 font-medium text-gray-900", children: y.item_code }),
|
|
3799
3801
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-700", children: y.item_name }),
|
|
3800
3802
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-700", children: y.warehouse }),
|
|
3801
3803
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: Mt(y.actual_qty) }),
|
|
3802
3804
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: d(y.valuation_rate) }),
|
|
3803
3805
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right font-medium", children: d(y.stock_value) })
|
|
3804
|
-
] },
|
|
3806
|
+
] }, R)) })
|
|
3805
3807
|
] }) }) })
|
|
3806
3808
|
] });
|
|
3807
3809
|
}
|
|
3808
3810
|
function qr() {
|
|
3809
|
-
const { t } = Z(), [n] = J("company", ""), [a] = J("from", ""), [s] = J("to", ""), l = Me(), [i, c] =
|
|
3811
|
+
const { t } = Z(), [n] = J("company", ""), [a] = J("from", ""), [s] = J("to", ""), l = Me(), [i, c] = S(n), o = Fe(i), m = (b) => Le(b, o), [d, u] = S(a), [p, v] = S(s), D = Ce(() => {
|
|
3810
3812
|
const b = {};
|
|
3811
3813
|
return n && (b.company = n), a && (b.from_date = a), s && (b.to_date = s), b;
|
|
3812
|
-
}, [n, a, s]), { data:
|
|
3814
|
+
}, [n, a, s]), { data: h, isLoading: y, refetch: R } = Ar(D), B = () => {
|
|
3813
3815
|
l({
|
|
3814
3816
|
company: i || null,
|
|
3815
3817
|
from: d || null,
|
|
3816
3818
|
to: p || null
|
|
3817
|
-
}),
|
|
3818
|
-
}, C =
|
|
3819
|
+
}), R();
|
|
3820
|
+
}, C = h && (h.income && h.income.length > 0 || h.expense && h.expense.length > 0);
|
|
3819
3821
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3820
3822
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
3821
3823
|
/* @__PURE__ */ e(ke, { label: t("fields.Company", { defaultValue: "Company" }), value: i, onChange: c, linkDoctype: "company", readOnly: !1 }),
|
|
3822
|
-
/* @__PURE__ */ e(
|
|
3823
|
-
/* @__PURE__ */ e(
|
|
3824
|
-
/* @__PURE__ */ e(
|
|
3824
|
+
/* @__PURE__ */ e(X, { label: t("fields.From Date", { defaultValue: "From Date" }), type: "date", value: d, onChange: (b) => u(b.target.value) }),
|
|
3825
|
+
/* @__PURE__ */ e(X, { label: t("fields.To Date", { defaultValue: "To Date" }), type: "date", value: p, onChange: (b) => v(b.target.value) }),
|
|
3826
|
+
/* @__PURE__ */ e(ee, { onClick: B, children: t("common.apply") })
|
|
3825
3827
|
] }),
|
|
3826
|
-
/* @__PURE__ */ e(Dt, { onSelect: (b,
|
|
3827
|
-
u(b), v(
|
|
3828
|
+
/* @__PURE__ */ e(Dt, { onSelect: (b, g) => {
|
|
3829
|
+
u(b), v(g), l({ from: b, to: g });
|
|
3828
3830
|
} }),
|
|
3829
3831
|
y ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : C ? /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3830
|
-
/* @__PURE__ */ r(
|
|
3832
|
+
/* @__PURE__ */ r(U, { children: [
|
|
3831
3833
|
/* @__PURE__ */ e("h3", { className: "mb-3 text-base font-semibold text-gray-800", children: t("reports.income") }),
|
|
3832
3834
|
/* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
3833
3835
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
3834
3836
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Account", { defaultValue: "Account" }) }),
|
|
3835
3837
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-medium text-gray-500", children: t("fields.Amount", { defaultValue: "Amount" }) })
|
|
3836
3838
|
] }) }),
|
|
3837
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: (
|
|
3839
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: (h.income || []).map((b, g) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
3838
3840
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-900", children: b.account }),
|
|
3839
3841
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: m(b.amount) })
|
|
3840
|
-
] },
|
|
3842
|
+
] }, g)) }),
|
|
3841
3843
|
/* @__PURE__ */ e("tfoot", { className: "border-t-2 border-gray-300 bg-gray-50 font-semibold", children: /* @__PURE__ */ r("tr", { children: [
|
|
3842
3844
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-gray-900", children: t("reports.totalIncome") }),
|
|
3843
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right", children: m(
|
|
3845
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right", children: m(h.total_income) })
|
|
3844
3846
|
] }) })
|
|
3845
3847
|
] })
|
|
3846
3848
|
] }),
|
|
3847
|
-
/* @__PURE__ */ r(
|
|
3849
|
+
/* @__PURE__ */ r(U, { children: [
|
|
3848
3850
|
/* @__PURE__ */ e("h3", { className: "mb-3 text-base font-semibold text-gray-800", children: t("reports.expenses") }),
|
|
3849
3851
|
/* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
3850
3852
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
3851
3853
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-left font-medium text-gray-500", children: t("fields.Account", { defaultValue: "Account" }) }),
|
|
3852
3854
|
/* @__PURE__ */ e("th", { className: "px-4 py-3 text-right font-medium text-gray-500", children: t("fields.Amount", { defaultValue: "Amount" }) })
|
|
3853
3855
|
] }) }),
|
|
3854
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: (
|
|
3856
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: (h.expense || []).map((b, g) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
3855
3857
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-900", children: b.account }),
|
|
3856
3858
|
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: m(b.amount) })
|
|
3857
|
-
] },
|
|
3859
|
+
] }, g)) }),
|
|
3858
3860
|
/* @__PURE__ */ e("tfoot", { className: "border-t-2 border-gray-300 bg-gray-50 font-semibold", children: /* @__PURE__ */ r("tr", { children: [
|
|
3859
3861
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-gray-900", children: t("reports.totalExpenses") }),
|
|
3860
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right", children: m(
|
|
3862
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-right", children: m(h.total_expense) })
|
|
3861
3863
|
] }) })
|
|
3862
3864
|
] })
|
|
3863
3865
|
] }),
|
|
3864
|
-
/* @__PURE__ */ e("div", { className: "text-center", children: /* @__PURE__ */ r("span", { className: `inline-flex items-center rounded-full px-5 py-2 text-sm font-semibold ${
|
|
3865
|
-
|
|
3866
|
+
/* @__PURE__ */ e("div", { className: "text-center", children: /* @__PURE__ */ r("span", { className: `inline-flex items-center rounded-full px-5 py-2 text-sm font-semibold ${h.net_profit >= 0 ? "bg-green-100 text-green-800" : "bg-red-100 text-red-800"}`, children: [
|
|
3867
|
+
h.net_profit >= 0 ? t("reports.netProfit") : t("reports.netLoss"),
|
|
3866
3868
|
": ",
|
|
3867
|
-
m(Math.abs(
|
|
3869
|
+
m(Math.abs(h.net_profit))
|
|
3868
3870
|
] }) })
|
|
3869
3871
|
] }) : /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noData") })
|
|
3870
3872
|
] });
|
|
3871
3873
|
}
|
|
3872
3874
|
function Et({ title: t, rows: n, total: a, totalLabel: s, currency: l }) {
|
|
3873
3875
|
const { t: i } = Z(), c = (o) => Le(o, l);
|
|
3874
|
-
return /* @__PURE__ */ r(
|
|
3876
|
+
return /* @__PURE__ */ r(U, { children: [
|
|
3875
3877
|
/* @__PURE__ */ e("h3", { className: "mb-3 text-base font-semibold text-gray-800", children: t }),
|
|
3876
3878
|
/* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
3877
3879
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
@@ -3890,27 +3892,27 @@ function Et({ title: t, rows: n, total: a, totalLabel: s, currency: l }) {
|
|
|
3890
3892
|
] });
|
|
3891
3893
|
}
|
|
3892
3894
|
function zr() {
|
|
3893
|
-
var
|
|
3894
|
-
const { t } = Z(), [n] = J("company", ""), [a] = J("as_of_date", ""), s = Me(), [l, i] =
|
|
3895
|
-
const
|
|
3896
|
-
return n && (
|
|
3897
|
-
}, [n, a]), { data: p, isLoading: v, refetch:
|
|
3898
|
-
s({ company: l || null, as_of_date: c || null }),
|
|
3899
|
-
}, y = p && (((
|
|
3895
|
+
var B, C, b;
|
|
3896
|
+
const { t } = Z(), [n] = J("company", ""), [a] = J("as_of_date", ""), s = Me(), [l, i] = S(n), [c, o] = S(a), m = Fe(l), d = (g) => Le(g, m), u = Ce(() => {
|
|
3897
|
+
const g = {};
|
|
3898
|
+
return n && (g.company = n), a && (g.as_of_date = a), g;
|
|
3899
|
+
}, [n, a]), { data: p, isLoading: v, refetch: D } = Tr(u), h = () => {
|
|
3900
|
+
s({ company: l || null, as_of_date: c || null }), D();
|
|
3901
|
+
}, y = p && (((B = p.assets) == null ? void 0 : B.length) > 0 || ((C = p.liabilities) == null ? void 0 : C.length) > 0 || ((b = p.equity) == null ? void 0 : b.length) > 0), R = p ? Math.abs(p.total_assets - p.total_liabilities_and_equity) < 0.01 : !1;
|
|
3900
3902
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3901
3903
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
3902
3904
|
/* @__PURE__ */ e(ke, { label: t("fields.Company", { defaultValue: "Company" }), value: l, onChange: i, linkDoctype: "company", readOnly: !1 }),
|
|
3903
|
-
/* @__PURE__ */ e(
|
|
3904
|
-
/* @__PURE__ */ e(
|
|
3905
|
+
/* @__PURE__ */ e(X, { label: t("fields.As of Date", { defaultValue: "As of Date" }), type: "date", value: c, onChange: (g) => o(g.target.value) }),
|
|
3906
|
+
/* @__PURE__ */ e(ee, { onClick: h, children: t("common.apply") })
|
|
3905
3907
|
] }),
|
|
3906
|
-
/* @__PURE__ */ e(en, { onSelect: (
|
|
3907
|
-
o(
|
|
3908
|
+
/* @__PURE__ */ e(en, { onSelect: (g) => {
|
|
3909
|
+
o(g), s({ as_of_date: g });
|
|
3908
3910
|
} }),
|
|
3909
3911
|
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : y ? /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3910
3912
|
/* @__PURE__ */ e(Et, { title: t("reports.assets"), rows: p.assets || [], total: p.total_assets, totalLabel: t("reports.totalAssets"), currency: m }),
|
|
3911
3913
|
/* @__PURE__ */ e(Et, { title: t("reports.liabilities"), rows: p.liabilities || [], total: p.total_liabilities, totalLabel: t("reports.totalLiabilities"), currency: m }),
|
|
3912
3914
|
/* @__PURE__ */ e(Et, { title: t("reports.equity"), rows: p.equity || [], total: p.total_equity, totalLabel: t("reports.totalEquity"), currency: m }),
|
|
3913
|
-
/* @__PURE__ */ e(
|
|
3915
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
3914
3916
|
/* @__PURE__ */ r("div", { className: "text-sm", children: [
|
|
3915
3917
|
/* @__PURE__ */ r("div", { className: "text-gray-500", children: [
|
|
3916
3918
|
t("reports.totalAssets"),
|
|
@@ -3923,28 +3925,28 @@ function zr() {
|
|
|
3923
3925
|
/* @__PURE__ */ e("span", { className: "font-semibold text-gray-900", children: d(p.total_liabilities_and_equity) })
|
|
3924
3926
|
] })
|
|
3925
3927
|
] }),
|
|
3926
|
-
|
|
3928
|
+
R ? /* @__PURE__ */ e("span", { className: "inline-flex items-center rounded-full bg-green-100 px-4 py-1.5 text-sm font-semibold text-green-800", children: t("reports.balanced") }) : /* @__PURE__ */ e("span", { className: "inline-flex items-center rounded-full bg-red-100 px-4 py-1.5 text-sm font-semibold text-red-800", children: t("reports.imbalanced") })
|
|
3927
3929
|
] }) })
|
|
3928
3930
|
] }) : /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noData") })
|
|
3929
3931
|
] });
|
|
3930
3932
|
}
|
|
3931
3933
|
function Fr() {
|
|
3932
|
-
const { t } = Z(), [n] = J("company", ""), [a] = J("as_of_date", ""), s = Me(), [l, i] =
|
|
3934
|
+
const { t } = Z(), [n] = J("company", ""), [a] = J("as_of_date", ""), s = Me(), [l, i] = S(n), [c, o] = S(a), m = Fe(l), d = (y) => Le(y, m), u = Ce(() => {
|
|
3933
3935
|
const y = {};
|
|
3934
3936
|
return n && (y.company = n), a && (y.as_of_date = a), y;
|
|
3935
|
-
}, [n, a]), { data: p, isLoading: v, refetch:
|
|
3936
|
-
s({ company: l || null, as_of_date: c || null }),
|
|
3937
|
+
}, [n, a]), { data: p, isLoading: v, refetch: D } = Pr(u), h = () => {
|
|
3938
|
+
s({ company: l || null, as_of_date: c || null }), D();
|
|
3937
3939
|
};
|
|
3938
3940
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3939
3941
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
3940
3942
|
/* @__PURE__ */ e(ke, { label: t("fields.Company", { defaultValue: "Company" }), value: l, onChange: i, linkDoctype: "company", readOnly: !1 }),
|
|
3941
|
-
/* @__PURE__ */ e(
|
|
3942
|
-
/* @__PURE__ */ e(
|
|
3943
|
+
/* @__PURE__ */ e(X, { label: t("fields.As of Date", { defaultValue: "As of Date" }), type: "date", value: c, onChange: (y) => o(y.target.value) }),
|
|
3944
|
+
/* @__PURE__ */ e(ee, { onClick: h, children: t("common.apply") })
|
|
3943
3945
|
] }),
|
|
3944
3946
|
/* @__PURE__ */ e(en, { onSelect: (y) => {
|
|
3945
3947
|
o(y), s({ as_of_date: y });
|
|
3946
3948
|
} }),
|
|
3947
|
-
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : !p || !p.rows || p.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noReceivables") }) : /* @__PURE__ */ e(
|
|
3949
|
+
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : !p || !p.rows || p.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noReceivables") }) : /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
3948
3950
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
3949
3951
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-left font-medium text-gray-500", children: t("fields.Invoice", { defaultValue: "Invoice" }) }),
|
|
3950
3952
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-left font-medium text-gray-500", children: t("fields.Customer", { defaultValue: "Customer" }) }),
|
|
@@ -3956,7 +3958,7 @@ function Fr() {
|
|
|
3956
3958
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-right font-medium text-gray-500", children: "61-90" }),
|
|
3957
3959
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-right font-medium text-gray-500", children: "90+" })
|
|
3958
3960
|
] }) }),
|
|
3959
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: p.rows.map((y,
|
|
3961
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: p.rows.map((y, R) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
3960
3962
|
/* @__PURE__ */ e("td", { className: "px-3 py-2", children: /* @__PURE__ */ e(
|
|
3961
3963
|
ye,
|
|
3962
3964
|
{
|
|
@@ -3973,7 +3975,7 @@ function Fr() {
|
|
|
3973
3975
|
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-right", children: y.b31_60 ? d(y.b31_60) : "" }),
|
|
3974
3976
|
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-right", children: y.b61_90 ? d(y.b61_90) : "" }),
|
|
3975
3977
|
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-right text-red-600", children: y.b90_plus ? d(y.b90_plus) : "" })
|
|
3976
|
-
] },
|
|
3978
|
+
] }, R)) }),
|
|
3977
3979
|
/* @__PURE__ */ e("tfoot", { className: "border-t-2 border-gray-300 bg-gray-50 font-semibold", children: /* @__PURE__ */ r("tr", { children: [
|
|
3978
3980
|
/* @__PURE__ */ e("td", { className: "px-3 py-3", colSpan: 3, children: t("common.total") }),
|
|
3979
3981
|
/* @__PURE__ */ e("td", { className: "px-3 py-3 text-right", children: d(p.totals.outstanding) }),
|
|
@@ -3987,22 +3989,22 @@ function Fr() {
|
|
|
3987
3989
|
] });
|
|
3988
3990
|
}
|
|
3989
3991
|
function Mr() {
|
|
3990
|
-
const { t } = Z(), [n] = J("company", ""), [a] = J("as_of_date", ""), s = Me(), [l, i] =
|
|
3992
|
+
const { t } = Z(), [n] = J("company", ""), [a] = J("as_of_date", ""), s = Me(), [l, i] = S(n), [c, o] = S(a), m = Fe(l), d = (y) => Le(y, m), u = Ce(() => {
|
|
3991
3993
|
const y = {};
|
|
3992
3994
|
return n && (y.company = n), a && (y.as_of_date = a), y;
|
|
3993
|
-
}, [n, a]), { data: p, isLoading: v, refetch:
|
|
3994
|
-
s({ company: l || null, as_of_date: c || null }),
|
|
3995
|
+
}, [n, a]), { data: p, isLoading: v, refetch: D } = Rr(u), h = () => {
|
|
3996
|
+
s({ company: l || null, as_of_date: c || null }), D();
|
|
3995
3997
|
};
|
|
3996
3998
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
3997
3999
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
3998
4000
|
/* @__PURE__ */ e(ke, { label: t("fields.Company", { defaultValue: "Company" }), value: l, onChange: i, linkDoctype: "company", readOnly: !1 }),
|
|
3999
|
-
/* @__PURE__ */ e(
|
|
4000
|
-
/* @__PURE__ */ e(
|
|
4001
|
+
/* @__PURE__ */ e(X, { label: t("fields.As of Date", { defaultValue: "As of Date" }), type: "date", value: c, onChange: (y) => o(y.target.value) }),
|
|
4002
|
+
/* @__PURE__ */ e(ee, { onClick: h, children: t("common.apply") })
|
|
4001
4003
|
] }),
|
|
4002
4004
|
/* @__PURE__ */ e(en, { onSelect: (y) => {
|
|
4003
4005
|
o(y), s({ as_of_date: y });
|
|
4004
4006
|
} }),
|
|
4005
|
-
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : !p || !p.rows || p.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noPayables") }) : /* @__PURE__ */ e(
|
|
4007
|
+
v ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: t("common.loading") }) : !p || !p.rows || p.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: t("reports.noPayables") }) : /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
4006
4008
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
4007
4009
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-left font-medium text-gray-500", children: t("fields.Invoice", { defaultValue: "Invoice" }) }),
|
|
4008
4010
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-left font-medium text-gray-500", children: t("fields.Supplier", { defaultValue: "Supplier" }) }),
|
|
@@ -4014,7 +4016,7 @@ function Mr() {
|
|
|
4014
4016
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-right font-medium text-gray-500", children: "61-90" }),
|
|
4015
4017
|
/* @__PURE__ */ e("th", { className: "px-3 py-3 text-right font-medium text-gray-500", children: "90+" })
|
|
4016
4018
|
] }) }),
|
|
4017
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: p.rows.map((y,
|
|
4019
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: p.rows.map((y, R) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
4018
4020
|
/* @__PURE__ */ e("td", { className: "px-3 py-2", children: /* @__PURE__ */ e(
|
|
4019
4021
|
ye,
|
|
4020
4022
|
{
|
|
@@ -4031,7 +4033,7 @@ function Mr() {
|
|
|
4031
4033
|
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-right", children: y.b31_60 ? d(y.b31_60) : "" }),
|
|
4032
4034
|
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-right", children: y.b61_90 ? d(y.b61_90) : "" }),
|
|
4033
4035
|
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-right text-red-600", children: y.b90_plus ? d(y.b90_plus) : "" })
|
|
4034
|
-
] },
|
|
4036
|
+
] }, R)) }),
|
|
4035
4037
|
/* @__PURE__ */ e("tfoot", { className: "border-t-2 border-gray-300 bg-gray-50 font-semibold", children: /* @__PURE__ */ r("tr", { children: [
|
|
4036
4038
|
/* @__PURE__ */ e("td", { className: "px-3 py-3", colSpan: 3, children: t("common.total") }),
|
|
4037
4039
|
/* @__PURE__ */ e("td", { className: "px-3 py-3 text-right", children: d(p.totals.outstanding) }),
|
|
@@ -4066,7 +4068,7 @@ function $r(t) {
|
|
|
4066
4068
|
n && (self.URL || self.webkitURL).revokeObjectURL(n);
|
|
4067
4069
|
}
|
|
4068
4070
|
}
|
|
4069
|
-
function
|
|
4071
|
+
function Ur() {
|
|
4070
4072
|
const t = /* @__PURE__ */ new Date(), n = t.toISOString().slice(0, 10), a = new Date(t);
|
|
4071
4073
|
a.setMonth(a.getMonth() - 12);
|
|
4072
4074
|
const s = a.toISOString().slice(0, 10);
|
|
@@ -4137,76 +4139,76 @@ return {
|
|
|
4137
4139
|
2
|
|
4138
4140
|
);
|
|
4139
4141
|
}
|
|
4140
|
-
const Yn =
|
|
4141
|
-
function
|
|
4142
|
-
const t = Oe(), { sessions: n, createSession: a } = tt(), [s] = J("report_id", ""), [l] = J("metric", ""), [i] = J("group_by", ""), [c] = J("from", ""), [o] = J("to", ""), [m] = J("company", ""), [d, u] =
|
|
4142
|
+
const Yn = Ur();
|
|
4143
|
+
function Vr() {
|
|
4144
|
+
const t = Oe(), { sessions: n, createSession: a } = tt(), [s] = J("report_id", ""), [l] = J("metric", ""), [i] = J("group_by", ""), [c] = J("from", ""), [o] = J("to", ""), [m] = J("company", ""), [d, u] = S(Yn), [p, v] = S([]), [D, h] = S(null), [y, R] = S(""), [B, C] = S(!1), [b, g] = S(!1), [_, w] = S(""), N = H(null), q = H(""), x = H(""), z = H(0), j = Ce(() => !l || !i ? "" : JSON.stringify(Kr({
|
|
4143
4145
|
metric: l,
|
|
4144
4146
|
groupBy: i,
|
|
4145
4147
|
fromDate: c || void 0,
|
|
4146
4148
|
toDate: o || void 0,
|
|
4147
4149
|
company: m || void 0
|
|
4148
|
-
}), null, 2), [l, i, c, o, m]),
|
|
4150
|
+
}), null, 2), [l, i, c, o, m]), V = async (K) => {
|
|
4149
4151
|
var ge;
|
|
4150
|
-
const
|
|
4151
|
-
|
|
4152
|
+
const ie = ++z.current, oe = () => z.current === ie;
|
|
4153
|
+
R(""), C(!0);
|
|
4152
4154
|
try {
|
|
4153
|
-
const Q = JSON.parse(K ?? d),
|
|
4154
|
-
if (!
|
|
4155
|
-
v(
|
|
4156
|
-
const
|
|
4157
|
-
|
|
4155
|
+
const Q = JSON.parse(K ?? d), ce = await O.runtimeData({ requests: Q.data_requests || [] });
|
|
4156
|
+
if (!oe()) return;
|
|
4157
|
+
v(ce.datasets), (ge = N.current) == null || ge.terminate();
|
|
4158
|
+
const ae = new $r();
|
|
4159
|
+
N.current = ae;
|
|
4158
4160
|
const Be = await new Promise((Pe, _e) => {
|
|
4159
4161
|
const $e = window.setTimeout(() => {
|
|
4160
|
-
|
|
4162
|
+
ae.terminate(), _e(new Error("Report runtime exceeded 4 seconds"));
|
|
4161
4163
|
}, 4e3);
|
|
4162
|
-
|
|
4164
|
+
ae.onmessage = (Re) => {
|
|
4163
4165
|
var he, xe;
|
|
4164
|
-
window.clearTimeout($e),
|
|
4165
|
-
},
|
|
4166
|
-
datasets:
|
|
4166
|
+
window.clearTimeout($e), ae.terminate(), N.current === ae && (N.current = null), (he = Re.data) != null && he.ok ? Pe(Re.data.output) : _e(new Error(((xe = Re.data) == null ? void 0 : xe.error) || "Runtime failed"));
|
|
4167
|
+
}, ae.postMessage({
|
|
4168
|
+
datasets: ce.datasets,
|
|
4167
4169
|
params: {},
|
|
4168
4170
|
transformJs: Q.transform_js || "return {};"
|
|
4169
4171
|
});
|
|
4170
4172
|
});
|
|
4171
|
-
if (!
|
|
4172
|
-
|
|
4173
|
-
} catch (
|
|
4174
|
-
if (!
|
|
4175
|
-
|
|
4173
|
+
if (!oe()) return;
|
|
4174
|
+
h(Be);
|
|
4175
|
+
} catch (T) {
|
|
4176
|
+
if (!oe()) return;
|
|
4177
|
+
h(null), R(T instanceof Error ? T.message : String(T));
|
|
4176
4178
|
} finally {
|
|
4177
|
-
|
|
4179
|
+
oe() && C(!1);
|
|
4178
4180
|
}
|
|
4179
4181
|
};
|
|
4180
|
-
|
|
4182
|
+
se(() => {
|
|
4181
4183
|
let K = !1;
|
|
4182
|
-
return s ? q.current === s ? void 0 : (
|
|
4184
|
+
return s ? q.current === s ? void 0 : (g(!0), R(""), O.getRuntimeDraft(s).then((ie) => {
|
|
4183
4185
|
if (K) return;
|
|
4184
|
-
const
|
|
4185
|
-
return q.current = s, x.current =
|
|
4186
|
-
}).catch((
|
|
4187
|
-
K || (
|
|
4186
|
+
const oe = JSON.stringify(ie.definition, null, 2);
|
|
4187
|
+
return q.current = s, x.current = oe, w(ie.source_chat_session_id || ""), u(oe), V(oe);
|
|
4188
|
+
}).catch((ie) => {
|
|
4189
|
+
K || (h(null), R(ie instanceof Error ? ie.message : String(ie)));
|
|
4188
4190
|
}).finally(() => {
|
|
4189
|
-
K ||
|
|
4191
|
+
K || g(!1);
|
|
4190
4192
|
}), () => {
|
|
4191
4193
|
K = !0;
|
|
4192
|
-
}) : (q.current = "", x.current = "",
|
|
4194
|
+
}) : (q.current = "", x.current = "", w(""), j && (x.current = j, u(j), V(j)), () => {
|
|
4193
4195
|
K = !0;
|
|
4194
4196
|
});
|
|
4195
4197
|
}, [s, j]);
|
|
4196
|
-
const Y = !!(!s && j),
|
|
4197
|
-
var
|
|
4198
|
-
const K = d.trim() !== x.current.trim(),
|
|
4199
|
-
name:
|
|
4200
|
-
dataset:
|
|
4201
|
-
row_count:
|
|
4202
|
-
sample_rows:
|
|
4198
|
+
const Y = !!(!s && j), de = Ce(() => Wr(D), [D]), P = async () => {
|
|
4199
|
+
var ce;
|
|
4200
|
+
const K = d.trim() !== x.current.trim(), ie = s || "unsaved-runtime-report", oe = p.map((ae) => ({
|
|
4201
|
+
name: ae.name,
|
|
4202
|
+
dataset: ae.dataset,
|
|
4203
|
+
row_count: ae.row_count,
|
|
4204
|
+
sample_rows: ae.rows.slice(0, 3)
|
|
4203
4205
|
})), ge = [
|
|
4204
4206
|
"This custom analytics report does not work yet. Please repair the existing report draft instead of creating a new one.",
|
|
4205
4207
|
"",
|
|
4206
|
-
`Report ID: ${
|
|
4208
|
+
`Report ID: ${ie}`,
|
|
4207
4209
|
"",
|
|
4208
4210
|
"Current issue summary:",
|
|
4209
|
-
y ||
|
|
4211
|
+
y || de.join(`
|
|
4210
4212
|
`) || "No runtime error captured; please review and improve the report definition."
|
|
4211
4213
|
];
|
|
4212
4214
|
K ? ge.push(
|
|
@@ -4218,20 +4220,20 @@ function Ur() {
|
|
|
4218
4220
|
) : ge.push(
|
|
4219
4221
|
"",
|
|
4220
4222
|
"Load the current saved draft with `get_custom_analytics_report` before making changes."
|
|
4221
|
-
),
|
|
4223
|
+
), oe.length > 0 && ge.push(
|
|
4222
4224
|
"",
|
|
4223
4225
|
"Fetched dataset preview:",
|
|
4224
4226
|
"```json",
|
|
4225
|
-
JSON.stringify(
|
|
4227
|
+
JSON.stringify(oe, null, 2),
|
|
4226
4228
|
"```"
|
|
4227
4229
|
);
|
|
4228
|
-
const
|
|
4230
|
+
const T = ge.join(`
|
|
4229
4231
|
`);
|
|
4230
|
-
let Q =
|
|
4231
|
-
Q || (Q = ((
|
|
4232
|
+
let Q = _;
|
|
4233
|
+
Q || (Q = ((ce = n[0]) == null ? void 0 : ce.id) || ""), Q || (Q = (await a()).id), t(`/chat/${Q}`, { state: { prefillMessage: T } });
|
|
4232
4234
|
};
|
|
4233
4235
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
4234
|
-
/* @__PURE__ */ e(
|
|
4236
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
4235
4237
|
/* @__PURE__ */ r("div", { children: [
|
|
4236
4238
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900", children: "Analytics" }),
|
|
4237
4239
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "All analytics now run through the custom runtime and semantic datasets." })
|
|
@@ -4241,12 +4243,12 @@ function Ur() {
|
|
|
4241
4243
|
"Loaded draft: ",
|
|
4242
4244
|
s
|
|
4243
4245
|
] }) : Y ? /* @__PURE__ */ e("div", { className: "text-xs text-gray-500", children: "Loaded runtime report from legacy URL filters." }) : null,
|
|
4244
|
-
s ? /* @__PURE__ */ e(
|
|
4245
|
-
/* @__PURE__ */ e(
|
|
4246
|
+
s ? /* @__PURE__ */ e(ee, { variant: "secondary", onClick: () => void P(), children: "Fix In Chat" }) : null,
|
|
4247
|
+
/* @__PURE__ */ e(ee, { onClick: () => void V(), disabled: B, children: B ? "Running..." : "Run Report" })
|
|
4246
4248
|
] })
|
|
4247
4249
|
] }) }),
|
|
4248
|
-
b ? /* @__PURE__ */ e(
|
|
4249
|
-
p.length > 0 && /* @__PURE__ */ e(
|
|
4250
|
+
b ? /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Loading draft..." }) }) : y ? /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("p", { className: "text-sm text-red-600", children: y }) }) : D ? /* @__PURE__ */ e(Gr, { output: D }) : /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("p", { className: "text-sm text-gray-600", children: "Edit the runtime JSON below or open a draft from chat, then run the report." }) }),
|
|
4251
|
+
p.length > 0 && /* @__PURE__ */ e(U, { title: "Fetched Datasets", children: /* @__PURE__ */ e("div", { className: "space-y-4", children: p.map((K) => /* @__PURE__ */ r("div", { className: "rounded-md border border-gray-200 p-4", children: [
|
|
4250
4252
|
/* @__PURE__ */ r("div", { className: "flex items-baseline justify-between gap-4", children: [
|
|
4251
4253
|
/* @__PURE__ */ r("div", { children: [
|
|
4252
4254
|
/* @__PURE__ */ e("div", { className: "font-medium text-gray-900", children: K.name }),
|
|
@@ -4260,7 +4262,7 @@ function Ur() {
|
|
|
4260
4262
|
] }),
|
|
4261
4263
|
/* @__PURE__ */ e("pre", { className: "mt-3 overflow-x-auto rounded bg-gray-50 p-3 text-xs text-gray-700", children: JSON.stringify(K.rows.slice(0, 5), null, 2) })
|
|
4262
4264
|
] }, K.name)) }) }),
|
|
4263
|
-
/* @__PURE__ */ r(
|
|
4265
|
+
/* @__PURE__ */ r(U, { children: [
|
|
4264
4266
|
/* @__PURE__ */ e("label", { className: "mb-2 block text-sm font-medium text-gray-700", children: "Report Definition JSON" }),
|
|
4265
4267
|
/* @__PURE__ */ e(
|
|
4266
4268
|
"textarea",
|
|
@@ -4281,7 +4283,7 @@ function Gr({ output: t }) {
|
|
|
4281
4283
|
id: i.id || `table_${c + 1}`
|
|
4282
4284
|
})), a = Zn(n);
|
|
4283
4285
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
4284
|
-
/* @__PURE__ */ r(
|
|
4286
|
+
/* @__PURE__ */ r(U, { children: [
|
|
4285
4287
|
/* @__PURE__ */ e("div", { className: "flex items-baseline justify-between gap-4", children: /* @__PURE__ */ r("div", { children: [
|
|
4286
4288
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900", children: t.title || "Custom Report" }),
|
|
4287
4289
|
t.summary && /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-600", children: t.summary })
|
|
@@ -4294,9 +4296,9 @@ function Gr({ output: t }) {
|
|
|
4294
4296
|
(l = t.charts) == null ? void 0 : l.map((i, c) => {
|
|
4295
4297
|
const o = i.dataTable ? a.get(i.dataTable) : void 0, m = i.data ?? (o == null ? void 0 : o.rows) ?? [];
|
|
4296
4298
|
if (!m.length)
|
|
4297
|
-
return /* @__PURE__ */ e(
|
|
4299
|
+
return /* @__PURE__ */ e(U, { title: i.title, children: /* @__PURE__ */ e("p", { className: "text-sm text-red-600", children: "Chart has no usable data." }) }, i.id || `chart_${c + 1}`);
|
|
4298
4300
|
const d = i.type === "pie" ? [] : m.map((v) => String(v[i.x] ?? "")), u = Yr(d), p = Math.max(320, 200 + u.axisHeight);
|
|
4299
|
-
return /* @__PURE__ */ r(
|
|
4301
|
+
return /* @__PURE__ */ r(U, { children: [
|
|
4300
4302
|
/* @__PURE__ */ e("div", { className: "pb-3 text-sm font-semibold text-gray-700", children: i.title }),
|
|
4301
4303
|
/* @__PURE__ */ e("div", { style: { height: p }, className: "w-full", children: /* @__PURE__ */ e(Da, { width: "100%", height: "100%", children: i.type === "line" ? /* @__PURE__ */ r(_a, { data: m, margin: { top: 10, right: 20, left: 0, bottom: 0 }, children: [
|
|
4302
4304
|
/* @__PURE__ */ e(an, { strokeDasharray: "3 3", stroke: "#f3f4f6" }),
|
|
@@ -4316,7 +4318,7 @@ function Gr({ output: t }) {
|
|
|
4316
4318
|
/* @__PURE__ */ e(Aa, { type: "monotone", dataKey: i.y, stroke: "#3b82f6", strokeWidth: 2, dot: { r: 3 } })
|
|
4317
4319
|
] }) : i.type === "pie" ? /* @__PURE__ */ r(Ta, { children: [
|
|
4318
4320
|
/* @__PURE__ */ e(It, { formatter: (v) => ct(v, Ot(o, i.y)) }),
|
|
4319
|
-
/* @__PURE__ */ e(Pa, { data: m, dataKey: i.y, nameKey: i.x, outerRadius: 110, children: m.map((v,
|
|
4321
|
+
/* @__PURE__ */ e(Pa, { data: m, dataKey: i.y, nameKey: i.x, outerRadius: 110, children: m.map((v, D) => /* @__PURE__ */ e(Ra, { fill: Sn[D % Sn.length] }, D)) })
|
|
4320
4322
|
] }) : /* @__PURE__ */ r(Ia, { data: m, margin: { top: 10, right: 20, left: 0, bottom: 0 }, children: [
|
|
4321
4323
|
/* @__PURE__ */ e(an, { strokeDasharray: "3 3", stroke: "#f3f4f6" }),
|
|
4322
4324
|
/* @__PURE__ */ e(
|
|
@@ -4336,7 +4338,7 @@ function Gr({ output: t }) {
|
|
|
4336
4338
|
] }) }) })
|
|
4337
4339
|
] }, i.id || `chart_${c + 1}`);
|
|
4338
4340
|
}),
|
|
4339
|
-
n.map((i) => /* @__PURE__ */ e(
|
|
4341
|
+
n.map((i) => /* @__PURE__ */ e(U, { title: i.title, children: /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
4340
4342
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ e("tr", { children: i.columns.map((c) => /* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: c.label }, c.key)) }) }),
|
|
4341
4343
|
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: i.rows.map((c, o) => /* @__PURE__ */ e("tr", { className: "hover:bg-gray-50", children: i.columns.map((m) => /* @__PURE__ */ e("td", { className: "px-4 py-1.5 text-gray-900", children: ct(c[m.key], m.type) }, m.key)) }, o)) })
|
|
4342
4344
|
] }) }) }, i.id))
|
|
@@ -4568,57 +4570,65 @@ function Yr(t) {
|
|
|
4568
4570
|
}
|
|
4569
4571
|
const Zr = ["USD", "EUR", "GBP", "CHF", "JPY", "CAD", "AUD", "CNY", "INR"];
|
|
4570
4572
|
function Xr() {
|
|
4571
|
-
const t = We(), { data: n, isLoading: a } =
|
|
4573
|
+
const t = We(), { data: n, isLoading: a } = le({
|
|
4572
4574
|
queryKey: ["setup-status"],
|
|
4573
4575
|
queryFn: () => O.setupStatus()
|
|
4574
|
-
}), [s, l] =
|
|
4575
|
-
|
|
4576
|
-
|
|
4576
|
+
}), [s, l] = S(""), [i, c] = S("USD"), [o, m] = S({
|
|
4577
|
+
address: "",
|
|
4578
|
+
city: "",
|
|
4579
|
+
zip_code: "",
|
|
4580
|
+
country: "",
|
|
4581
|
+
email: "",
|
|
4582
|
+
phone: "",
|
|
4583
|
+
tax_id: ""
|
|
4584
|
+
}), d = (w) => (N) => m((q) => ({ ...q, [w]: N.target.value })), [u, p] = S("quick"), [v, D] = S(!1), [h, y] = S(null), R = pe({
|
|
4585
|
+
mutationFn: () => O.createCompany({ name: s, currency: i, ...o })
|
|
4586
|
+
}), B = pe({
|
|
4577
4587
|
mutationFn: () => O.seedDemo()
|
|
4578
|
-
}),
|
|
4588
|
+
}), C = pe({
|
|
4579
4589
|
mutationFn: () => O.seedHistory()
|
|
4580
|
-
}),
|
|
4590
|
+
}), b = async () => {
|
|
4581
4591
|
if (s.trim())
|
|
4582
4592
|
try {
|
|
4583
|
-
if (await
|
|
4584
|
-
const
|
|
4585
|
-
|
|
4586
|
-
} else
|
|
4587
|
-
t.invalidateQueries({ queryKey: ["setup-status"] }),
|
|
4593
|
+
if (await R.mutateAsync(), u === "history") {
|
|
4594
|
+
const w = await C.mutateAsync();
|
|
4595
|
+
y(w.stats);
|
|
4596
|
+
} else u === "quick" && await B.mutateAsync();
|
|
4597
|
+
t.invalidateQueries({ queryKey: ["setup-status"] }), D(!0);
|
|
4588
4598
|
} catch {
|
|
4589
4599
|
}
|
|
4590
4600
|
};
|
|
4591
4601
|
if (a)
|
|
4592
4602
|
return /* @__PURE__ */ e("p", { className: "text-gray-500", children: "Loading..." });
|
|
4593
|
-
if (n != null && n.setup_complete && !
|
|
4603
|
+
if (n != null && n.setup_complete && !v)
|
|
4594
4604
|
return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
4595
|
-
/* @__PURE__ */ e(
|
|
4605
|
+
/* @__PURE__ */ e(U, { title: "Companies", children: n.companies && n.companies.length > 0 ? /* @__PURE__ */ e("ul", { className: "divide-y divide-gray-100", children: n.companies.map((w, N) => /* @__PURE__ */ e("li", { className: "py-3", children: /* @__PURE__ */ e(es, { company: w }) }, N)) }) : /* @__PURE__ */ e("p", { className: "text-gray-400", children: "No companies found" }) }),
|
|
4596
4606
|
/* @__PURE__ */ e(ye, { to: "/", className: "text-blue-600 hover:text-blue-800 text-sm font-medium", children: "Go to Dashboard" })
|
|
4597
4607
|
] });
|
|
4598
|
-
if (
|
|
4599
|
-
return /* @__PURE__ */ e("div", { className: "space-y-6", children: /* @__PURE__ */ e(
|
|
4608
|
+
if (v)
|
|
4609
|
+
return /* @__PURE__ */ e("div", { className: "space-y-6", children: /* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "py-8 text-center", children: [
|
|
4600
4610
|
/* @__PURE__ */ e("p", { className: "text-lg font-semibold text-green-700", children: "Setup complete!" }),
|
|
4601
|
-
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-gray-500", children:
|
|
4602
|
-
|
|
4611
|
+
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-gray-500", children: u === "history" ? "Your company has been created and three years of history has been simulated." : u === "quick" ? "Your company has been created and demo data has been seeded." : "Your company has been created. No demo data was added." }),
|
|
4612
|
+
h && /* @__PURE__ */ r("div", { className: "mx-auto mt-6 max-w-sm text-left", children: [
|
|
4603
4613
|
/* @__PURE__ */ e("p", { className: "mb-2 text-sm font-medium text-gray-700", children: "Generated documents:" }),
|
|
4604
|
-
/* @__PURE__ */ e("ul", { className: "divide-y divide-gray-100 text-sm", children: Object.entries(
|
|
4605
|
-
/* @__PURE__ */ e("span", { className: "text-gray-600", children:
|
|
4606
|
-
/* @__PURE__ */ e("span", { className: "font-mono text-gray-900", children:
|
|
4607
|
-
] },
|
|
4614
|
+
/* @__PURE__ */ e("ul", { className: "divide-y divide-gray-100 text-sm", children: Object.entries(h).sort(([w], [N]) => w.localeCompare(N)).map(([w, N]) => /* @__PURE__ */ r("li", { className: "flex justify-between py-1", children: [
|
|
4615
|
+
/* @__PURE__ */ e("span", { className: "text-gray-600", children: w.replace(/_/g, " ") }),
|
|
4616
|
+
/* @__PURE__ */ e("span", { className: "font-mono text-gray-900", children: N.toLocaleString() })
|
|
4617
|
+
] }, w)) })
|
|
4608
4618
|
] }),
|
|
4609
|
-
/* @__PURE__ */ e("div", { className: "mt-6", children: /* @__PURE__ */ e(ye, { to: "/", children: /* @__PURE__ */ e(
|
|
4619
|
+
/* @__PURE__ */ e("div", { className: "mt-6", children: /* @__PURE__ */ e(ye, { to: "/", children: /* @__PURE__ */ e(ee, { children: "Go to Dashboard" }) }) })
|
|
4610
4620
|
] }) }) });
|
|
4611
|
-
const
|
|
4621
|
+
const g = R.isPending || B.isPending || C.isPending, _ = R.error ?? B.error ?? C.error;
|
|
4612
4622
|
return /* @__PURE__ */ r("div", { className: "mx-auto max-w-lg space-y-6", children: [
|
|
4613
4623
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "Set up your first company to get started." }),
|
|
4614
|
-
|
|
4615
|
-
/* @__PURE__ */ e(
|
|
4624
|
+
_ && /* @__PURE__ */ e("div", { className: "rounded-md bg-red-50 p-4 text-sm text-red-700", children: _.message ?? "An error occurred during setup" }),
|
|
4625
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
4616
4626
|
/* @__PURE__ */ e(
|
|
4617
|
-
|
|
4627
|
+
X,
|
|
4618
4628
|
{
|
|
4619
4629
|
label: "Company Name",
|
|
4620
4630
|
value: s,
|
|
4621
|
-
onChange: (
|
|
4631
|
+
onChange: (w) => l(w.target.value),
|
|
4622
4632
|
placeholder: "e.g. My Company Ltd",
|
|
4623
4633
|
required: !0
|
|
4624
4634
|
}
|
|
@@ -4629,9 +4639,34 @@ function Xr() {
|
|
|
4629
4639
|
label: "Currency",
|
|
4630
4640
|
options: Zr,
|
|
4631
4641
|
value: i,
|
|
4632
|
-
onChange: (
|
|
4642
|
+
onChange: (w) => c(w.target.value)
|
|
4633
4643
|
}
|
|
4634
4644
|
),
|
|
4645
|
+
/* @__PURE__ */ r("fieldset", { className: "space-y-3", children: [
|
|
4646
|
+
/* @__PURE__ */ e("legend", { className: "mb-1 text-sm font-medium text-gray-700", children: "Company details" }),
|
|
4647
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500", children: "These appear on your invoices and other PDFs. Optional now — you can fill or change them later under Masters → Company." }),
|
|
4648
|
+
/* @__PURE__ */ e(
|
|
4649
|
+
X,
|
|
4650
|
+
{
|
|
4651
|
+
label: "Address",
|
|
4652
|
+
value: o.address,
|
|
4653
|
+
onChange: d("address"),
|
|
4654
|
+
placeholder: "e.g. 42 Market Street"
|
|
4655
|
+
}
|
|
4656
|
+
),
|
|
4657
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
4658
|
+
/* @__PURE__ */ e(X, { label: "City", value: o.city, onChange: d("city") }),
|
|
4659
|
+
/* @__PURE__ */ e(X, { label: "ZIP / Postal code", value: o.zip_code, onChange: d("zip_code") })
|
|
4660
|
+
] }),
|
|
4661
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
4662
|
+
/* @__PURE__ */ e(X, { label: "Country", value: o.country, onChange: d("country") }),
|
|
4663
|
+
/* @__PURE__ */ e(X, { label: "Tax ID / VAT", value: o.tax_id, onChange: d("tax_id") })
|
|
4664
|
+
] }),
|
|
4665
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
4666
|
+
/* @__PURE__ */ e(X, { label: "Email", value: o.email, onChange: d("email") }),
|
|
4667
|
+
/* @__PURE__ */ e(X, { label: "Phone", value: o.phone, onChange: d("phone") })
|
|
4668
|
+
] })
|
|
4669
|
+
] }),
|
|
4635
4670
|
/* @__PURE__ */ r("fieldset", { className: "space-y-2", children: [
|
|
4636
4671
|
/* @__PURE__ */ e("legend", { className: "mb-1 text-sm font-medium text-gray-700", children: "Seed data" }),
|
|
4637
4672
|
/* @__PURE__ */ r("label", { className: "flex cursor-pointer items-start gap-3 rounded-md border border-gray-200 p-3 hover:bg-gray-50", children: [
|
|
@@ -4641,8 +4676,8 @@ function Xr() {
|
|
|
4641
4676
|
type: "radio",
|
|
4642
4677
|
name: "seed-mode",
|
|
4643
4678
|
value: "quick",
|
|
4644
|
-
checked:
|
|
4645
|
-
onChange: () =>
|
|
4679
|
+
checked: u === "quick",
|
|
4680
|
+
onChange: () => p("quick"),
|
|
4646
4681
|
className: "mt-1"
|
|
4647
4682
|
}
|
|
4648
4683
|
),
|
|
@@ -4658,8 +4693,8 @@ function Xr() {
|
|
|
4658
4693
|
type: "radio",
|
|
4659
4694
|
name: "seed-mode",
|
|
4660
4695
|
value: "history",
|
|
4661
|
-
checked:
|
|
4662
|
-
onChange: () =>
|
|
4696
|
+
checked: u === "history",
|
|
4697
|
+
onChange: () => p("history"),
|
|
4663
4698
|
className: "mt-1"
|
|
4664
4699
|
}
|
|
4665
4700
|
),
|
|
@@ -4675,8 +4710,8 @@ function Xr() {
|
|
|
4675
4710
|
type: "radio",
|
|
4676
4711
|
name: "seed-mode",
|
|
4677
4712
|
value: "none",
|
|
4678
|
-
checked:
|
|
4679
|
-
onChange: () =>
|
|
4713
|
+
checked: u === "none",
|
|
4714
|
+
onChange: () => p("none"),
|
|
4680
4715
|
className: "mt-1"
|
|
4681
4716
|
}
|
|
4682
4717
|
),
|
|
@@ -4687,11 +4722,11 @@ function Xr() {
|
|
|
4687
4722
|
] })
|
|
4688
4723
|
] }),
|
|
4689
4724
|
/* @__PURE__ */ e("div", { className: "pt-2", children: /* @__PURE__ */ e(
|
|
4690
|
-
|
|
4725
|
+
ee,
|
|
4691
4726
|
{
|
|
4692
|
-
onClick:
|
|
4693
|
-
disabled:
|
|
4694
|
-
children:
|
|
4727
|
+
onClick: b,
|
|
4728
|
+
disabled: g || !s.trim(),
|
|
4729
|
+
children: g ? u === "history" ? "Simulating three years..." : "Setting up..." : u === "history" ? "Create Company & Simulate History" : u === "quick" ? "Create Company & Seed Demo Data" : "Create Company"
|
|
4695
4730
|
}
|
|
4696
4731
|
) })
|
|
4697
4732
|
] }) })
|
|
@@ -4893,7 +4928,7 @@ function ns() {
|
|
|
4893
4928
|
n("tutorial.caPrompt3"),
|
|
4894
4929
|
n("tutorial.caPrompt4")
|
|
4895
4930
|
];
|
|
4896
|
-
return /* @__PURE__ */ e(
|
|
4931
|
+
return /* @__PURE__ */ e(U, { className: "border-indigo-200 bg-gradient-to-br from-indigo-50 to-white", children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 md:flex-row md:items-start", children: [
|
|
4897
4932
|
/* @__PURE__ */ e("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-indigo-100 text-lg font-bold text-indigo-700", children: "★" }),
|
|
4898
4933
|
/* @__PURE__ */ r("div", { className: "flex-1 space-y-3", children: [
|
|
4899
4934
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -4947,7 +4982,7 @@ function ns() {
|
|
|
4947
4982
|
}
|
|
4948
4983
|
function as() {
|
|
4949
4984
|
const { t } = Z(), n = (a) => t(`tutorial.chips.${a}`, { defaultValue: a });
|
|
4950
|
-
return /* @__PURE__ */ r(
|
|
4985
|
+
return /* @__PURE__ */ r(U, { children: [
|
|
4951
4986
|
/* @__PURE__ */ e("h3", { className: "text-base font-semibold text-gray-900 mb-3", children: t("tutorial.flowTitle") }),
|
|
4952
4987
|
/* @__PURE__ */ r("div", { className: "space-y-4 text-sm text-gray-600", children: [
|
|
4953
4988
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -5018,7 +5053,7 @@ function as() {
|
|
|
5018
5053
|
}
|
|
5019
5054
|
function rs() {
|
|
5020
5055
|
const { t } = Z(), n = (a) => t(`tutorial.chips.${a}`, { defaultValue: a });
|
|
5021
|
-
return /* @__PURE__ */ r(
|
|
5056
|
+
return /* @__PURE__ */ r(U, { children: [
|
|
5022
5057
|
/* @__PURE__ */ e("h3", { className: "text-base font-semibold text-gray-900 mb-3", children: t("tutorial.lifecycleTitle") }),
|
|
5023
5058
|
/* @__PURE__ */ r("div", { className: "space-y-2 text-sm text-gray-600", children: [
|
|
5024
5059
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2 font-mono text-xs", children: [
|
|
@@ -5081,7 +5116,7 @@ function ss() {
|
|
|
5081
5116
|
/* @__PURE__ */ e(rs, {}),
|
|
5082
5117
|
ts.map((n) => {
|
|
5083
5118
|
var a;
|
|
5084
|
-
return /* @__PURE__ */ e(
|
|
5119
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "flex gap-4", children: [
|
|
5085
5120
|
/* @__PURE__ */ e("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-sm font-bold text-blue-700", children: n.number }),
|
|
5086
5121
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
5087
5122
|
/* @__PURE__ */ e("h3", { className: "text-base font-semibold text-gray-900", children: t(`tutorial.steps.${n.number}.title`, { defaultValue: n.title }) }),
|
|
@@ -5119,7 +5154,7 @@ function ss() {
|
|
|
5119
5154
|
] })
|
|
5120
5155
|
] }) }, n.number);
|
|
5121
5156
|
}),
|
|
5122
|
-
/* @__PURE__ */ e(
|
|
5157
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "flex gap-4", children: [
|
|
5123
5158
|
/* @__PURE__ */ e("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-green-100 text-sm font-bold text-green-700", children: "✓" }),
|
|
5124
5159
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
5125
5160
|
/* @__PURE__ */ e("h3", { className: "text-base font-semibold text-gray-900", children: t("tutorial.readyTitle") }),
|
|
@@ -5171,152 +5206,152 @@ function wn(t) {
|
|
|
5171
5206
|
});
|
|
5172
5207
|
}
|
|
5173
5208
|
function Cn() {
|
|
5174
|
-
const { t } = Z(), { sessionId: n } = ut(), a = Oe(), s = dt(), [l] = wt(), i = l.get("demo") === "1", [c, o] =
|
|
5175
|
-
connectionStatus:
|
|
5209
|
+
const { t } = Z(), { sessionId: n } = ut(), a = Oe(), s = dt(), [l] = wt(), i = l.get("demo") === "1", [c, o] = S(""), [m, d] = S(""), [u, p] = S([]), [v, D] = S(""), [h, y] = S(!1), R = H(null), {
|
|
5210
|
+
connectionStatus: B,
|
|
5176
5211
|
connectionVersion: C,
|
|
5177
5212
|
createSession: b,
|
|
5178
|
-
startDemo:
|
|
5179
|
-
completeDemoTyping:
|
|
5180
|
-
loadHistory:
|
|
5181
|
-
loadMoreHistory:
|
|
5213
|
+
startDemo: g,
|
|
5214
|
+
completeDemoTyping: _,
|
|
5215
|
+
loadHistory: w,
|
|
5216
|
+
loadMoreHistory: N,
|
|
5182
5217
|
sendMessage: q,
|
|
5183
5218
|
getMessages: x,
|
|
5184
5219
|
hasMoreHistory: z,
|
|
5185
5220
|
isLoadingOlder: j,
|
|
5186
|
-
isThinking:
|
|
5221
|
+
isThinking: V,
|
|
5187
5222
|
getDemoStatus: Y,
|
|
5188
|
-
getDemoTypingCue:
|
|
5189
|
-
} = tt(),
|
|
5223
|
+
getDemoTypingCue: de
|
|
5224
|
+
} = tt(), P = H(null), K = H(null), ie = H(null), oe = H(null), [ge, T] = S(0), Q = H(!1), ce = H(null), ae = H(0), Be = H(!0), Pe = H(null), _e = H(!1), $e = H(null), Re = x(n), he = B === "connected", xe = V(n), qe = Y(n), ze = de(n), Ae = i || qe === "running", nt = z(n), Qe = j(n), at = Re[Re.length - 1], _t = at ? `${at.type}:${at.timestamp || ""}:${at.content}` : "empty", He = we(() => {
|
|
5190
5225
|
_e.current = !0, $e.current !== null && window.clearTimeout($e.current), $e.current = window.setTimeout(() => {
|
|
5191
5226
|
_e.current = !1, $e.current = null;
|
|
5192
5227
|
}, 600);
|
|
5193
5228
|
}, []), pt = we((f = "smooth") => {
|
|
5194
|
-
const
|
|
5195
|
-
if (!
|
|
5196
|
-
He(),
|
|
5197
|
-
const
|
|
5198
|
-
const
|
|
5199
|
-
|
|
5229
|
+
const A = P.current;
|
|
5230
|
+
if (!A) return;
|
|
5231
|
+
He(), A.scrollTo({ top: A.scrollHeight, behavior: f });
|
|
5232
|
+
const te = () => {
|
|
5233
|
+
const re = P.current;
|
|
5234
|
+
re && (!Be.current && !Ae && !xe || re.scrollTop + re.clientHeight >= re.scrollHeight - 2 || (He(), re.scrollTo({ top: re.scrollHeight, behavior: "auto" })));
|
|
5200
5235
|
};
|
|
5201
|
-
requestAnimationFrame(
|
|
5236
|
+
requestAnimationFrame(te), window.setTimeout(te, 120);
|
|
5202
5237
|
}, [Ae, xe, He]);
|
|
5203
5238
|
tn(() => {
|
|
5204
|
-
const f =
|
|
5205
|
-
if (!f ||
|
|
5206
|
-
const
|
|
5207
|
-
|
|
5208
|
-
}, [Re.length]),
|
|
5239
|
+
const f = P.current, A = Pe.current;
|
|
5240
|
+
if (!f || A === null) return;
|
|
5241
|
+
const te = f.scrollHeight - A;
|
|
5242
|
+
te > 0 && (f.scrollTop = f.scrollTop + te), Pe.current = null;
|
|
5243
|
+
}, [Re.length]), se(() => {
|
|
5209
5244
|
Pe.current === null && (!Be.current && !Ae && !xe || pt(Ae ? "auto" : "smooth"));
|
|
5210
|
-
}, [_t, Ae, xe, pt]),
|
|
5211
|
-
const f =
|
|
5245
|
+
}, [_t, Ae, xe, pt]), se(() => {
|
|
5246
|
+
const f = P.current;
|
|
5212
5247
|
if (!f || typeof ResizeObserver > "u") return;
|
|
5213
|
-
let
|
|
5214
|
-
const
|
|
5215
|
-
Pe.current === null && (!Be.current && !Ae && !xe || (cancelAnimationFrame(
|
|
5216
|
-
const
|
|
5217
|
-
if (!
|
|
5218
|
-
|
|
5248
|
+
let A = 0;
|
|
5249
|
+
const te = new ResizeObserver(() => {
|
|
5250
|
+
Pe.current === null && (!Be.current && !Ae && !xe || (cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
5251
|
+
const ne = P.current;
|
|
5252
|
+
if (!ne) return;
|
|
5253
|
+
ne.scrollHeight - ne.scrollTop - ne.clientHeight <= 120 && (He(), ne.scrollTo({ top: ne.scrollHeight, behavior: "auto" }));
|
|
5219
5254
|
})));
|
|
5220
|
-
}),
|
|
5221
|
-
return
|
|
5222
|
-
|
|
5255
|
+
}), re = f.firstElementChild;
|
|
5256
|
+
return re && te.observe(re), te.observe(f), () => {
|
|
5257
|
+
te.disconnect(), cancelAnimationFrame(A);
|
|
5223
5258
|
};
|
|
5224
5259
|
}, [Ae, xe, He]), tn(() => {
|
|
5225
|
-
const f =
|
|
5226
|
-
if (!f || (
|
|
5227
|
-
const
|
|
5228
|
-
return
|
|
5260
|
+
const f = oe.current;
|
|
5261
|
+
if (!f || (T(f.offsetHeight), typeof ResizeObserver > "u")) return;
|
|
5262
|
+
const A = new ResizeObserver(() => T(f.offsetHeight));
|
|
5263
|
+
return A.observe(f), () => A.disconnect();
|
|
5229
5264
|
}, []);
|
|
5230
5265
|
const At = we(() => {
|
|
5231
5266
|
if (!n || Qe || !nt) return;
|
|
5232
|
-
const f =
|
|
5233
|
-
Pe.current = f ? f.scrollHeight : null, Be.current = !1,
|
|
5267
|
+
const f = P.current;
|
|
5268
|
+
Pe.current = f ? f.scrollHeight : null, Be.current = !1, N(n).catch(() => {
|
|
5234
5269
|
Pe.current = null;
|
|
5235
5270
|
});
|
|
5236
|
-
}, [n, Qe, nt,
|
|
5237
|
-
|
|
5238
|
-
d(""),
|
|
5271
|
+
}, [n, Qe, nt, N]), k = H(null);
|
|
5272
|
+
se(() => {
|
|
5273
|
+
d(""), ce.current = null, ae.current += 1, n && Wn(n);
|
|
5239
5274
|
const f = s.state;
|
|
5240
|
-
f != null && f.prefillMessage &&
|
|
5241
|
-
var
|
|
5242
|
-
return (
|
|
5243
|
-
}, 50)) : f != null && f.prefillMessage || (
|
|
5244
|
-
}, [n, i, s.state]),
|
|
5275
|
+
f != null && f.prefillMessage && k.current !== f ? (k.current = f, o(f.prefillMessage), window.setTimeout(() => {
|
|
5276
|
+
var A;
|
|
5277
|
+
return (A = ie.current) == null ? void 0 : A.focus();
|
|
5278
|
+
}, 50)) : f != null && f.prefillMessage || (k.current = null, o(""));
|
|
5279
|
+
}, [n, i, s.state]), se(() => {
|
|
5245
5280
|
if (n || !he) return;
|
|
5246
5281
|
let f = !1;
|
|
5247
|
-
return b().then((
|
|
5248
|
-
f || a(`/chat/${
|
|
5282
|
+
return b().then((A) => {
|
|
5283
|
+
f || a(`/chat/${A.id}`, { replace: !0 });
|
|
5249
5284
|
}).catch(() => {
|
|
5250
5285
|
}), () => {
|
|
5251
5286
|
f = !0;
|
|
5252
5287
|
};
|
|
5253
5288
|
}, [n, he, a]);
|
|
5254
|
-
const G = H(
|
|
5255
|
-
|
|
5256
|
-
G.current =
|
|
5257
|
-
}, [
|
|
5289
|
+
const G = H(w);
|
|
5290
|
+
se(() => {
|
|
5291
|
+
G.current = w;
|
|
5292
|
+
}, [w]), se(() => {
|
|
5258
5293
|
!n || !he || i || qe === "running" || G.current(n).catch(() => {
|
|
5259
5294
|
});
|
|
5260
|
-
}, [n, he, C, i, qe]),
|
|
5295
|
+
}, [n, he, C, i, qe]), se(() => {
|
|
5261
5296
|
Q.current && !xe && he && setTimeout(() => {
|
|
5262
5297
|
var f;
|
|
5263
|
-
return (f =
|
|
5298
|
+
return (f = ie.current) == null ? void 0 : f.focus();
|
|
5264
5299
|
}, 50), Q.current = xe;
|
|
5265
5300
|
}, [xe, he]);
|
|
5266
5301
|
function W(f) {
|
|
5267
5302
|
if (_e.current) return;
|
|
5268
|
-
const
|
|
5269
|
-
Be.current =
|
|
5303
|
+
const A = f.currentTarget, te = A.scrollHeight - A.scrollTop - A.clientHeight;
|
|
5304
|
+
Be.current = te < 80;
|
|
5270
5305
|
}
|
|
5271
|
-
|
|
5272
|
-
!n || !he || !i ||
|
|
5273
|
-
|
|
5306
|
+
se(() => {
|
|
5307
|
+
!n || !he || !i || ce.current !== n && (ce.current = n, d(""), g(n).catch((f) => {
|
|
5308
|
+
ce.current = null, d(f instanceof Error ? f.message : t("chat.demoError"));
|
|
5274
5309
|
}));
|
|
5275
|
-
}, [n, he, i,
|
|
5310
|
+
}, [n, he, i, g]), se(() => {
|
|
5276
5311
|
!n || !i || qe !== "complete" || (o(""), a(`/chat/${n}`, { replace: !0 }));
|
|
5277
5312
|
}, [n, i, qe, a]);
|
|
5278
|
-
const Se = H(
|
|
5279
|
-
|
|
5280
|
-
Se.current =
|
|
5281
|
-
}, [
|
|
5313
|
+
const Se = H(_);
|
|
5314
|
+
se(() => {
|
|
5315
|
+
Se.current = _;
|
|
5316
|
+
}, [_]);
|
|
5282
5317
|
const fe = H(null);
|
|
5283
|
-
|
|
5318
|
+
se(() => {
|
|
5284
5319
|
if (!ze || !n || fe.current === ze.seq) return;
|
|
5285
5320
|
fe.current = ze.seq;
|
|
5286
|
-
const f = n,
|
|
5321
|
+
const f = n, A = ze.content, te = A.length > 0 ? Math.max(8, ze.typingMs / A.length) : 0, re = ze.seq, ne = ++ae.current;
|
|
5287
5322
|
async function rt() {
|
|
5288
5323
|
o("");
|
|
5289
|
-
for (const Tt of
|
|
5290
|
-
if (
|
|
5291
|
-
o((Pt) => Pt + Tt), await os(
|
|
5324
|
+
for (const Tt of A) {
|
|
5325
|
+
if (ne !== ae.current) return;
|
|
5326
|
+
o((Pt) => Pt + Tt), await os(te);
|
|
5292
5327
|
}
|
|
5293
|
-
|
|
5328
|
+
ne === ae.current && Se.current(f, re);
|
|
5294
5329
|
}
|
|
5295
5330
|
rt();
|
|
5296
|
-
}, [ze, n]),
|
|
5297
|
-
qe === "complete" && (
|
|
5331
|
+
}, [ze, n]), se(() => {
|
|
5332
|
+
qe === "complete" && (ae.current += 1, o(""));
|
|
5298
5333
|
}, [qe]);
|
|
5299
5334
|
const ve = we((f) => {
|
|
5300
5335
|
if (!n) return;
|
|
5301
|
-
|
|
5302
|
-
const
|
|
5303
|
-
p((
|
|
5304
|
-
const
|
|
5305
|
-
for (const
|
|
5306
|
-
if (
|
|
5307
|
-
|
|
5336
|
+
D("");
|
|
5337
|
+
const A = Array.from(f);
|
|
5338
|
+
p((te) => {
|
|
5339
|
+
const re = [...te];
|
|
5340
|
+
for (const ne of A) {
|
|
5341
|
+
if (re.length >= zt) {
|
|
5342
|
+
D(`Maximum ${zt} attachments per message.`);
|
|
5308
5343
|
break;
|
|
5309
5344
|
}
|
|
5310
|
-
if (!ls.has(
|
|
5311
|
-
|
|
5345
|
+
if (!ls.has(ne.type)) {
|
|
5346
|
+
D(`Unsupported file type: ${ne.type || ne.name}`);
|
|
5312
5347
|
continue;
|
|
5313
5348
|
}
|
|
5314
|
-
if (
|
|
5315
|
-
|
|
5349
|
+
if (ne.size > is) {
|
|
5350
|
+
D(`"${ne.name}" is too large (max 10 MB).`);
|
|
5316
5351
|
continue;
|
|
5317
5352
|
}
|
|
5318
|
-
const rt = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, Tt =
|
|
5319
|
-
|
|
5353
|
+
const rt = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, Tt = ne.type.startsWith("image/") ? URL.createObjectURL(ne) : void 0, Pt = { localId: rt, file: ne, previewUrl: Tt, uploading: !0 };
|
|
5354
|
+
re.push(Pt), O.uploadChatAttachment(n, ne).then((it) => {
|
|
5320
5355
|
p(
|
|
5321
5356
|
(ht) => ht.map(
|
|
5322
5357
|
(lt) => lt.localId === rt ? { ...lt, uploading: !1, uploadedId: it.id } : lt
|
|
@@ -5324,42 +5359,42 @@ function Cn() {
|
|
|
5324
5359
|
);
|
|
5325
5360
|
}).catch((it) => {
|
|
5326
5361
|
const ht = (it == null ? void 0 : it.message) || "Upload failed";
|
|
5327
|
-
|
|
5362
|
+
D(`"${ne.name}": ${ht}`), p(
|
|
5328
5363
|
(lt) => lt.map(
|
|
5329
5364
|
(Rt) => Rt.localId === rt ? { ...Rt, uploading: !1, error: ht } : Rt
|
|
5330
5365
|
)
|
|
5331
5366
|
);
|
|
5332
5367
|
});
|
|
5333
5368
|
}
|
|
5334
|
-
return
|
|
5369
|
+
return re;
|
|
5335
5370
|
});
|
|
5336
5371
|
}, [n]), Je = (f) => {
|
|
5337
|
-
p((
|
|
5338
|
-
const
|
|
5339
|
-
return
|
|
5372
|
+
p((A) => {
|
|
5373
|
+
const te = A.find((re) => re.localId === f);
|
|
5374
|
+
return te != null && te.previewUrl && URL.revokeObjectURL(te.previewUrl), A.filter((re) => re.localId !== f);
|
|
5340
5375
|
});
|
|
5341
5376
|
}, F = (f) => {
|
|
5342
5377
|
f.dataTransfer.types.includes("Files") && (f.preventDefault(), y(!0));
|
|
5343
5378
|
}, Ye = (f) => {
|
|
5344
|
-
const
|
|
5345
|
-
(!
|
|
5346
|
-
},
|
|
5379
|
+
const A = f.relatedTarget;
|
|
5380
|
+
(!A || !f.currentTarget.contains(A)) && y(!1);
|
|
5381
|
+
}, ue = (f) => {
|
|
5347
5382
|
f.preventDefault(), y(!1), f.dataTransfer.files && f.dataTransfer.files.length > 0 && ve(f.dataTransfer.files);
|
|
5348
|
-
},
|
|
5349
|
-
const
|
|
5350
|
-
for (const
|
|
5351
|
-
if (
|
|
5352
|
-
const
|
|
5353
|
-
|
|
5383
|
+
}, I = (f) => {
|
|
5384
|
+
const A = [];
|
|
5385
|
+
for (const te of f.clipboardData.items)
|
|
5386
|
+
if (te.kind === "file") {
|
|
5387
|
+
const re = te.getAsFile();
|
|
5388
|
+
re && A.push(re);
|
|
5354
5389
|
}
|
|
5355
|
-
|
|
5356
|
-
},
|
|
5390
|
+
A.length > 0 && (f.preventDefault(), ve(A));
|
|
5391
|
+
}, L = u.some((f) => f.uploading), M = u.some((f) => f.error), $ = u.filter((f) => f.uploadedId && !f.error).map((f) => f.uploadedId);
|
|
5357
5392
|
function Te() {
|
|
5358
5393
|
const f = c.trim();
|
|
5359
|
-
if (n && !(!f && $.length === 0) && !
|
|
5360
|
-
for (const
|
|
5361
|
-
|
|
5362
|
-
p([]),
|
|
5394
|
+
if (n && !(!f && $.length === 0) && !L && q(n, f, $.length > 0 ? $ : void 0)) {
|
|
5395
|
+
for (const A of u)
|
|
5396
|
+
A.previewUrl && URL.revokeObjectURL(A.previewUrl);
|
|
5397
|
+
p([]), D(""), o("");
|
|
5363
5398
|
}
|
|
5364
5399
|
}
|
|
5365
5400
|
function be(f) {
|
|
@@ -5371,13 +5406,13 @@ function Cn() {
|
|
|
5371
5406
|
className: "relative -m-4 h-[calc(100%+2rem)] overflow-hidden md:-m-6 md:h-[calc(100%+3rem)]",
|
|
5372
5407
|
onDragOver: F,
|
|
5373
5408
|
onDragLeave: Ye,
|
|
5374
|
-
onDrop:
|
|
5409
|
+
onDrop: ue,
|
|
5375
5410
|
children: [
|
|
5376
|
-
|
|
5411
|
+
h && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-3 z-50 flex items-center justify-center rounded-lg border-2 border-dashed border-brand bg-brand/5 text-sm font-medium text-brand", children: t("chat.dropToAttach") }),
|
|
5377
5412
|
/* @__PURE__ */ e(
|
|
5378
5413
|
"div",
|
|
5379
5414
|
{
|
|
5380
|
-
ref:
|
|
5415
|
+
ref: P,
|
|
5381
5416
|
className: "absolute inset-0 overflow-y-auto px-4 py-6",
|
|
5382
5417
|
onScroll: W,
|
|
5383
5418
|
children: /* @__PURE__ */ r(
|
|
@@ -5408,8 +5443,8 @@ function Cn() {
|
|
|
5408
5443
|
"button",
|
|
5409
5444
|
{
|
|
5410
5445
|
onClick: () => {
|
|
5411
|
-
var
|
|
5412
|
-
o(f), (
|
|
5446
|
+
var A;
|
|
5447
|
+
o(f), (A = ie.current) == null || A.focus();
|
|
5413
5448
|
},
|
|
5414
5449
|
className: "rounded-full bg-surface px-3 py-1.5 text-xs text-fg-muted ring-1 ring-line transition-all hover:bg-surface-subtle hover:text-fg hover:ring-brand/30",
|
|
5415
5450
|
children: f
|
|
@@ -5417,7 +5452,7 @@ function Cn() {
|
|
|
5417
5452
|
f
|
|
5418
5453
|
)) })
|
|
5419
5454
|
] }),
|
|
5420
|
-
Re.map((f,
|
|
5455
|
+
Re.map((f, A) => /* @__PURE__ */ e(ds, { message: f }, A)),
|
|
5421
5456
|
/* @__PURE__ */ e("div", { ref: K })
|
|
5422
5457
|
]
|
|
5423
5458
|
}
|
|
@@ -5427,7 +5462,7 @@ function Cn() {
|
|
|
5427
5462
|
/* @__PURE__ */ e(
|
|
5428
5463
|
"div",
|
|
5429
5464
|
{
|
|
5430
|
-
ref:
|
|
5465
|
+
ref: oe,
|
|
5431
5466
|
className: "absolute bottom-0 left-0 right-0 bg-surface-muted px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] md:right-6 md:pl-6 md:pr-0",
|
|
5432
5467
|
children: /* @__PURE__ */ r("div", { className: "mx-auto max-w-3xl", children: [
|
|
5433
5468
|
u.length > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-2", children: u.map((f) => /* @__PURE__ */ r(
|
|
@@ -5457,7 +5492,7 @@ function Cn() {
|
|
|
5457
5492
|
/* @__PURE__ */ e(
|
|
5458
5493
|
"input",
|
|
5459
5494
|
{
|
|
5460
|
-
ref:
|
|
5495
|
+
ref: R,
|
|
5461
5496
|
type: "file",
|
|
5462
5497
|
accept: "image/png,image/jpeg,image/gif,image/webp,application/pdf",
|
|
5463
5498
|
multiple: !0,
|
|
@@ -5471,19 +5506,19 @@ function Cn() {
|
|
|
5471
5506
|
/* @__PURE__ */ e(
|
|
5472
5507
|
"textarea",
|
|
5473
5508
|
{
|
|
5474
|
-
ref:
|
|
5509
|
+
ref: ie,
|
|
5475
5510
|
value: c,
|
|
5476
5511
|
onChange: (f) => o(f.target.value),
|
|
5477
5512
|
onKeyDown: be,
|
|
5478
|
-
onPaste:
|
|
5513
|
+
onPaste: I,
|
|
5479
5514
|
placeholder: t(Ae ? "chat.placeholderDemo" : he ? "chat.placeholderType" : "chat.placeholderConnecting"),
|
|
5480
5515
|
disabled: !he || !n || xe || Ae,
|
|
5481
5516
|
rows: 2,
|
|
5482
5517
|
className: "block flex-1 resize-none bg-transparent px-2.5 py-1.5 text-sm text-fg outline-none placeholder:text-fg-muted/70 disabled:text-fg-muted",
|
|
5483
5518
|
style: { minHeight: "3rem", maxHeight: "120px" },
|
|
5484
5519
|
onInput: (f) => {
|
|
5485
|
-
const
|
|
5486
|
-
|
|
5520
|
+
const A = f.target;
|
|
5521
|
+
A.style.height = "auto", A.style.height = Math.min(Math.max(A.scrollHeight, 48), 120) + "px";
|
|
5487
5522
|
}
|
|
5488
5523
|
}
|
|
5489
5524
|
),
|
|
@@ -5492,7 +5527,7 @@ function Cn() {
|
|
|
5492
5527
|
{
|
|
5493
5528
|
onClick: () => {
|
|
5494
5529
|
var f;
|
|
5495
|
-
return (f =
|
|
5530
|
+
return (f = R.current) == null ? void 0 : f.click();
|
|
5496
5531
|
},
|
|
5497
5532
|
disabled: !he || !n || xe || Ae || u.length >= zt,
|
|
5498
5533
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-fg-muted transition-all hover:bg-surface-subtle hover:text-fg disabled:cursor-not-allowed disabled:opacity-40 md:h-10 md:w-10",
|
|
@@ -5504,7 +5539,7 @@ function Cn() {
|
|
|
5504
5539
|
"button",
|
|
5505
5540
|
{
|
|
5506
5541
|
onClick: Te,
|
|
5507
|
-
disabled: !c.trim() && $.length === 0 || !he || !n || xe || Ae ||
|
|
5542
|
+
disabled: !c.trim() && $.length === 0 || !he || !n || xe || Ae || L || M,
|
|
5508
5543
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-brand transition-all hover:bg-brand/10 active:translate-y-px disabled:cursor-not-allowed disabled:text-fg-muted disabled:active:translate-y-0 md:h-10 md:w-10",
|
|
5509
5544
|
children: /* @__PURE__ */ e(
|
|
5510
5545
|
"svg",
|
|
@@ -5526,7 +5561,7 @@ function Cn() {
|
|
|
5526
5561
|
className: `inline-block h-1.5 w-1.5 rounded-full ${he ? "bg-emerald-500" : "bg-rose-500"} ${he ? "" : "animate-pulse"}`
|
|
5527
5562
|
}
|
|
5528
5563
|
),
|
|
5529
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-fg-muted", children: he ? "Connected" :
|
|
5564
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-fg-muted", children: he ? "Connected" : B === "connecting" ? "Connecting..." : "Disconnected" })
|
|
5530
5565
|
] })
|
|
5531
5566
|
] })
|
|
5532
5567
|
}
|
|
@@ -5692,35 +5727,35 @@ function ps(t, n) {
|
|
|
5692
5727
|
return s < t.length && a.push(t.slice(s)), a.length > 0 ? a : [t];
|
|
5693
5728
|
}
|
|
5694
5729
|
function hs() {
|
|
5695
|
-
const t = Oe(), [n] = wt(), { user: a, login: s, register: l } = mt(), { t: i } = Z(), c = n.get("invite") || "", [o, m] =
|
|
5696
|
-
|
|
5730
|
+
const t = Oe(), [n] = wt(), { user: a, login: s, register: l } = mt(), { t: i } = Z(), c = n.get("invite") || "", [o, m] = S(c ? "register" : "login"), [d, u] = S(!1), [p, v] = S(!0), [D, h] = S(""), [y, R] = S(""), [B, C] = S(""), [b, g] = S(""), [_, w] = S("");
|
|
5731
|
+
se(() => {
|
|
5697
5732
|
a && a.role !== "public_manager" && t("/", { replace: !0 });
|
|
5698
|
-
}, [a, t]),
|
|
5733
|
+
}, [a, t]), se(() => {
|
|
5699
5734
|
O.authSetupStatus().then((q) => {
|
|
5700
5735
|
u(q.registration_open), q.registration_open && m("register");
|
|
5701
5736
|
}).catch(() => {
|
|
5702
5737
|
}).finally(() => v(!1));
|
|
5703
5738
|
}, []);
|
|
5704
|
-
const
|
|
5705
|
-
if (q.preventDefault(),
|
|
5706
|
-
if (b !==
|
|
5707
|
-
|
|
5739
|
+
const N = async (q) => {
|
|
5740
|
+
if (q.preventDefault(), h(""), o === "register") {
|
|
5741
|
+
if (b !== _) {
|
|
5742
|
+
h(i("login.passwordsNoMatch"));
|
|
5708
5743
|
return;
|
|
5709
5744
|
}
|
|
5710
5745
|
if (b.length < 6) {
|
|
5711
|
-
|
|
5746
|
+
h(i("login.passwordTooShort"));
|
|
5712
5747
|
return;
|
|
5713
5748
|
}
|
|
5714
5749
|
try {
|
|
5715
|
-
await l(y,
|
|
5750
|
+
await l(y, B, b, c || void 0), t("/", { replace: !0 });
|
|
5716
5751
|
} catch (x) {
|
|
5717
|
-
|
|
5752
|
+
h(x instanceof et ? x.message : i("login.registrationFailed"));
|
|
5718
5753
|
}
|
|
5719
5754
|
} else
|
|
5720
5755
|
try {
|
|
5721
5756
|
await s(y, b), t("/", { replace: !0 });
|
|
5722
5757
|
} catch (x) {
|
|
5723
|
-
|
|
5758
|
+
h(x instanceof et ? x.message : i("login.loginFailed"));
|
|
5724
5759
|
}
|
|
5725
5760
|
};
|
|
5726
5761
|
return p ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center bg-surface-muted", children: /* @__PURE__ */ e("div", { className: "text-fg-muted", children: i("common.loading") }) }) : /* @__PURE__ */ e("div", { className: "flex min-h-dvh items-center justify-center bg-surface-muted px-4", children: /* @__PURE__ */ r("div", { className: "w-full max-w-sm space-y-6", children: [
|
|
@@ -5729,56 +5764,56 @@ function hs() {
|
|
|
5729
5764
|
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-fg-muted", children: i(d ? "login.taglineFirstRun" : o === "register" ? "login.taglineRegister" : "login.taglineSignIn") }),
|
|
5730
5765
|
(a == null ? void 0 : a.role) === "public_manager" && /* @__PURE__ */ e("p", { className: "mt-2 text-xs text-amber-700", children: i("login.demoBanner") })
|
|
5731
5766
|
] }),
|
|
5732
|
-
|
|
5733
|
-
/* @__PURE__ */ e(
|
|
5767
|
+
D && /* @__PURE__ */ e("div", { className: "rounded-lg bg-rose-50 px-4 py-3 text-sm text-rose-700 ring-1 ring-rose-200", children: D }),
|
|
5768
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("form", { onSubmit: N, className: "space-y-4", children: [
|
|
5734
5769
|
o === "register" && /* @__PURE__ */ e(
|
|
5735
|
-
|
|
5770
|
+
X,
|
|
5736
5771
|
{
|
|
5737
5772
|
label: i("login.fullName"),
|
|
5738
|
-
value:
|
|
5773
|
+
value: B,
|
|
5739
5774
|
onChange: (q) => C(q.target.value),
|
|
5740
5775
|
required: !0
|
|
5741
5776
|
}
|
|
5742
5777
|
),
|
|
5743
5778
|
/* @__PURE__ */ e(
|
|
5744
|
-
|
|
5779
|
+
X,
|
|
5745
5780
|
{
|
|
5746
5781
|
label: i("login.email"),
|
|
5747
5782
|
type: "email",
|
|
5748
5783
|
value: y,
|
|
5749
|
-
onChange: (q) =>
|
|
5784
|
+
onChange: (q) => R(q.target.value),
|
|
5750
5785
|
required: !0
|
|
5751
5786
|
}
|
|
5752
5787
|
),
|
|
5753
5788
|
/* @__PURE__ */ e(
|
|
5754
|
-
|
|
5789
|
+
X,
|
|
5755
5790
|
{
|
|
5756
5791
|
label: i("login.password"),
|
|
5757
5792
|
type: "password",
|
|
5758
5793
|
value: b,
|
|
5759
|
-
onChange: (q) =>
|
|
5794
|
+
onChange: (q) => g(q.target.value),
|
|
5760
5795
|
required: !0
|
|
5761
5796
|
}
|
|
5762
5797
|
),
|
|
5763
5798
|
o === "register" && /* @__PURE__ */ e(
|
|
5764
|
-
|
|
5799
|
+
X,
|
|
5765
5800
|
{
|
|
5766
5801
|
label: i("login.confirmPassword"),
|
|
5767
5802
|
type: "password",
|
|
5768
|
-
value:
|
|
5769
|
-
onChange: (q) =>
|
|
5803
|
+
value: _,
|
|
5804
|
+
onChange: (q) => w(q.target.value),
|
|
5770
5805
|
required: !0
|
|
5771
5806
|
}
|
|
5772
5807
|
),
|
|
5773
|
-
/* @__PURE__ */ e(
|
|
5808
|
+
/* @__PURE__ */ e(ee, { type: "submit", className: "w-full", children: i(o === "register" ? d ? "login.createAdmin" : "login.register" : "login.signIn") })
|
|
5774
5809
|
] }) }),
|
|
5775
|
-
(a == null ? void 0 : a.role) === "public_manager" && /* @__PURE__ */ e(
|
|
5810
|
+
(a == null ? void 0 : a.role) === "public_manager" && /* @__PURE__ */ e(U, { children: /* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
5776
5811
|
/* @__PURE__ */ r("div", { children: [
|
|
5777
5812
|
/* @__PURE__ */ e("h2", { className: "text-sm font-semibold text-fg", children: i("login.browsingTitle") }),
|
|
5778
5813
|
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-fg-muted", children: i("login.browsingBody") })
|
|
5779
5814
|
] }),
|
|
5780
5815
|
/* @__PURE__ */ e(
|
|
5781
|
-
|
|
5816
|
+
ee,
|
|
5782
5817
|
{
|
|
5783
5818
|
type: "button",
|
|
5784
5819
|
className: "w-full",
|
|
@@ -5799,8 +5834,8 @@ function hs() {
|
|
|
5799
5834
|
] }) });
|
|
5800
5835
|
}
|
|
5801
5836
|
function gs() {
|
|
5802
|
-
const t = Oe(), n = H(!1), [a, s] =
|
|
5803
|
-
return
|
|
5837
|
+
const t = Oe(), n = H(!1), [a, s] = S("");
|
|
5838
|
+
return se(() => {
|
|
5804
5839
|
n.current || (n.current = !0, O.createChatSession().then((l) => {
|
|
5805
5840
|
t(`/chat/${l.id}?demo=1`, { replace: !0 });
|
|
5806
5841
|
}).catch((l) => {
|
|
@@ -5831,56 +5866,56 @@ function An() {
|
|
|
5831
5866
|
return { type: "sales", party: "", amount: "", due_date: "", remarks: "" };
|
|
5832
5867
|
}
|
|
5833
5868
|
function ys() {
|
|
5834
|
-
const t = Oe(), n = We(), [a, s] =
|
|
5869
|
+
const t = Oe(), n = We(), [a, s] = S(""), [l, i] = S((/* @__PURE__ */ new Date()).toISOString().split("T")[0]), [c, o] = S(""), [m, d] = S([Dn()]), [u, p] = S([_n()]), [v, D] = S([An()]), [h, y] = S({}), R = pe({
|
|
5835
5870
|
mutationFn: () => O.importAccountBalances({
|
|
5836
5871
|
company: a,
|
|
5837
5872
|
posting_date: l,
|
|
5838
|
-
entries: m.filter((
|
|
5839
|
-
account:
|
|
5840
|
-
debit: parseFloat(
|
|
5841
|
-
credit: parseFloat(
|
|
5842
|
-
party_type:
|
|
5843
|
-
party:
|
|
5873
|
+
entries: m.filter((g) => g.account && (g.debit || g.credit)).map((g) => ({
|
|
5874
|
+
account: g.account,
|
|
5875
|
+
debit: parseFloat(g.debit) || 0,
|
|
5876
|
+
credit: parseFloat(g.credit) || 0,
|
|
5877
|
+
party_type: g.party_type || void 0,
|
|
5878
|
+
party: g.party || void 0
|
|
5844
5879
|
}))
|
|
5845
5880
|
}),
|
|
5846
|
-
onSuccess: (
|
|
5847
|
-
}),
|
|
5881
|
+
onSuccess: (g) => y((_) => ({ ..._, accounts: g }))
|
|
5882
|
+
}), B = pe({
|
|
5848
5883
|
mutationFn: () => O.importStockBalances({
|
|
5849
5884
|
company: a,
|
|
5850
5885
|
posting_date: l,
|
|
5851
5886
|
warehouse: c,
|
|
5852
|
-
items: u.filter((
|
|
5853
|
-
item_code:
|
|
5854
|
-
qty: parseFloat(
|
|
5855
|
-
rate: parseFloat(
|
|
5887
|
+
items: u.filter((g) => g.item_code && g.qty).map((g) => ({
|
|
5888
|
+
item_code: g.item_code,
|
|
5889
|
+
qty: parseFloat(g.qty) || 0,
|
|
5890
|
+
rate: parseFloat(g.rate) || 0
|
|
5856
5891
|
}))
|
|
5857
5892
|
}),
|
|
5858
|
-
onSuccess: (
|
|
5859
|
-
}), C =
|
|
5893
|
+
onSuccess: (g) => y((_) => ({ ..._, stock: g }))
|
|
5894
|
+
}), C = pe({
|
|
5860
5895
|
mutationFn: () => O.importOutstandingInvoices({
|
|
5861
5896
|
company: a,
|
|
5862
|
-
invoices: v.filter((
|
|
5863
|
-
type:
|
|
5864
|
-
party:
|
|
5865
|
-
amount: parseFloat(
|
|
5866
|
-
due_date:
|
|
5867
|
-
remarks:
|
|
5897
|
+
invoices: v.filter((g) => g.party && g.amount).map((g) => ({
|
|
5898
|
+
type: g.type,
|
|
5899
|
+
party: g.party,
|
|
5900
|
+
amount: parseFloat(g.amount) || 0,
|
|
5901
|
+
due_date: g.due_date || void 0,
|
|
5902
|
+
remarks: g.remarks || void 0,
|
|
5868
5903
|
posting_date: l
|
|
5869
5904
|
}))
|
|
5870
5905
|
}),
|
|
5871
|
-
onSuccess: (
|
|
5906
|
+
onSuccess: (g) => y((_) => ({ ..._, invoices: g }))
|
|
5872
5907
|
});
|
|
5873
|
-
function b(
|
|
5874
|
-
const x = [...
|
|
5875
|
-
x[
|
|
5908
|
+
function b(g, _, w, N, q) {
|
|
5909
|
+
const x = [...g];
|
|
5910
|
+
x[w][N] = q, _(x);
|
|
5876
5911
|
}
|
|
5877
5912
|
return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
5878
5913
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500", children: "Import balances from your previous system. Each section creates the appropriate documents (Journal Entry, Stock Entry, or Invoices) and submits them automatically." }),
|
|
5879
|
-
/* @__PURE__ */ e(
|
|
5914
|
+
/* @__PURE__ */ e(U, { title: "Common Settings", children: /* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
5880
5915
|
/* @__PURE__ */ e(ke, { label: "Company", value: a, onChange: s, linkDoctype: "company", readOnly: !1 }),
|
|
5881
|
-
/* @__PURE__ */ e(
|
|
5916
|
+
/* @__PURE__ */ e(X, { label: "As-of Date", type: "date", value: l, onChange: (g) => i(g.target.value) })
|
|
5882
5917
|
] }) }),
|
|
5883
|
-
/* @__PURE__ */ r(
|
|
5918
|
+
/* @__PURE__ */ r(U, { title: "1. Account Balances", children: [
|
|
5884
5919
|
/* @__PURE__ */ e("p", { className: "mb-3 text-xs text-gray-500", children: "Enter your trial balance from the old system. The difference will be automatically balanced against Opening Balance Equity. For receivable/payable accounts, also set the party type and party." }),
|
|
5885
5920
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ r("table", { className: "min-w-full text-sm", children: [
|
|
5886
5921
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
@@ -5890,29 +5925,29 @@ function ys() {
|
|
|
5890
5925
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-right font-medium text-gray-500", children: "Debit" }),
|
|
5891
5926
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-right font-medium text-gray-500", children: "Credit" })
|
|
5892
5927
|
] }) }),
|
|
5893
|
-
/* @__PURE__ */ e("tbody", { children: m.map((
|
|
5894
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(ke, { value:
|
|
5895
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ r("select", { value:
|
|
5928
|
+
/* @__PURE__ */ e("tbody", { children: m.map((g, _) => /* @__PURE__ */ r("tr", { children: [
|
|
5929
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(ke, { value: g.account, onChange: (w) => b(m, d, _, "account", w), linkDoctype: "account", readOnly: !1, label: "" }) }),
|
|
5930
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ r("select", { value: g.party_type, onChange: (w) => b(m, d, _, "party_type", w.target.value), className: "w-full rounded border border-gray-300 px-2 py-1.5 text-sm", children: [
|
|
5896
5931
|
/* @__PURE__ */ e("option", { value: "", children: "—" }),
|
|
5897
5932
|
/* @__PURE__ */ e("option", { value: "Customer", children: "Customer" }),
|
|
5898
5933
|
/* @__PURE__ */ e("option", { value: "Supplier", children: "Supplier" })
|
|
5899
5934
|
] }) }),
|
|
5900
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children:
|
|
5901
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value:
|
|
5902
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value:
|
|
5903
|
-
] },
|
|
5935
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: g.party_type ? /* @__PURE__ */ e(ke, { label: "", value: g.party, onChange: (w) => b(m, d, _, "party", w), linkDoctype: g.party_type.toLowerCase(), readOnly: !1 }) : /* @__PURE__ */ e("span", { className: "text-gray-300 text-xs", children: "set party type first" }) }),
|
|
5936
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value: g.debit, onChange: (w) => b(m, d, _, "debit", w.target.value), className: "w-24 rounded border border-gray-300 px-2 py-1.5 text-right text-sm", placeholder: "0.00" }) }),
|
|
5937
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value: g.credit, onChange: (w) => b(m, d, _, "credit", w.target.value), className: "w-24 rounded border border-gray-300 px-2 py-1.5 text-right text-sm", placeholder: "0.00" }) })
|
|
5938
|
+
] }, _)) })
|
|
5904
5939
|
] }) }),
|
|
5905
5940
|
/* @__PURE__ */ e("div", { className: "mt-2 flex gap-2", children: /* @__PURE__ */ e("button", { onClick: () => d([...m, Dn()]), className: "text-xs text-blue-600 hover:text-blue-800", children: "+ Add Row" }) }),
|
|
5906
5941
|
/* @__PURE__ */ r("div", { className: "mt-3 flex items-center gap-3", children: [
|
|
5907
|
-
/* @__PURE__ */ e(
|
|
5908
|
-
|
|
5909
|
-
|
|
5942
|
+
/* @__PURE__ */ e(ee, { onClick: () => R.mutate(), disabled: !a || R.isPending, children: R.isPending ? "Importing..." : "Import Account Balances" }),
|
|
5943
|
+
R.error && /* @__PURE__ */ e("span", { className: "text-xs text-red-600", children: R.error.message }),
|
|
5944
|
+
h.accounts && /* @__PURE__ */ r("span", { className: "text-xs text-green-600", children: [
|
|
5910
5945
|
"Created ",
|
|
5911
|
-
|
|
5946
|
+
h.accounts.journal_entry
|
|
5912
5947
|
] })
|
|
5913
5948
|
] })
|
|
5914
5949
|
] }),
|
|
5915
|
-
/* @__PURE__ */ r(
|
|
5950
|
+
/* @__PURE__ */ r(U, { title: "2. Stock Balances", children: [
|
|
5916
5951
|
/* @__PURE__ */ e("p", { className: "mb-3 text-xs text-gray-500", children: "Enter your current inventory. Creates a Stock Entry (Opening Stock) — posts Dr Stock In Hand / Cr Opening Balance Equity so the P&L isn't distorted by day-one inventory." }),
|
|
5917
5952
|
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(ke, { label: "Warehouse", value: c, onChange: o, linkDoctype: "warehouse", readOnly: !1 }) }),
|
|
5918
5953
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ r("table", { className: "min-w-full text-sm", children: [
|
|
@@ -5921,26 +5956,26 @@ function ys() {
|
|
|
5921
5956
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-right font-medium text-gray-500", children: "Qty" }),
|
|
5922
5957
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-right font-medium text-gray-500", children: "Rate" })
|
|
5923
5958
|
] }) }),
|
|
5924
|
-
/* @__PURE__ */ e("tbody", { children: u.map((
|
|
5925
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(ke, { label: "", value:
|
|
5926
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value:
|
|
5927
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value:
|
|
5928
|
-
] },
|
|
5959
|
+
/* @__PURE__ */ e("tbody", { children: u.map((g, _) => /* @__PURE__ */ r("tr", { children: [
|
|
5960
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(ke, { label: "", value: g.item_code, onChange: (w) => b(u, p, _, "item_code", w), linkDoctype: "item", readOnly: !1 }) }),
|
|
5961
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value: g.qty, onChange: (w) => b(u, p, _, "qty", w.target.value), className: "w-24 rounded border border-gray-300 px-2 py-1.5 text-right text-sm", placeholder: "0" }) }),
|
|
5962
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value: g.rate, onChange: (w) => b(u, p, _, "rate", w.target.value), className: "w-24 rounded border border-gray-300 px-2 py-1.5 text-right text-sm", placeholder: "0.00" }) })
|
|
5963
|
+
] }, _)) })
|
|
5929
5964
|
] }) }),
|
|
5930
5965
|
/* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e("button", { onClick: () => p([...u, _n()]), className: "text-xs text-blue-600 hover:text-blue-800", children: "+ Add Row" }) }),
|
|
5931
5966
|
/* @__PURE__ */ r("div", { className: "mt-3 flex items-center gap-3", children: [
|
|
5932
|
-
/* @__PURE__ */ e(
|
|
5933
|
-
|
|
5934
|
-
|
|
5967
|
+
/* @__PURE__ */ e(ee, { onClick: () => B.mutate(), disabled: !a || !c || B.isPending, children: B.isPending ? "Importing..." : "Import Stock Balances" }),
|
|
5968
|
+
B.error && /* @__PURE__ */ e("span", { className: "text-xs text-red-600", children: B.error.message }),
|
|
5969
|
+
h.stock && /* @__PURE__ */ r("span", { className: "text-xs text-green-600", children: [
|
|
5935
5970
|
"Created ",
|
|
5936
|
-
|
|
5971
|
+
h.stock.stock_entry,
|
|
5937
5972
|
" (",
|
|
5938
|
-
|
|
5973
|
+
h.stock.items_count,
|
|
5939
5974
|
" items)"
|
|
5940
5975
|
] })
|
|
5941
5976
|
] })
|
|
5942
5977
|
] }),
|
|
5943
|
-
/* @__PURE__ */ r(
|
|
5978
|
+
/* @__PURE__ */ r(U, { title: "3. Outstanding Invoices", children: [
|
|
5944
5979
|
/* @__PURE__ */ e("p", { className: "mb-3 text-xs text-gray-500", children: "Enter unpaid invoices from your old system. Creates submitted Sales or Purchase Invoices with the correct outstanding amounts for AR/AP aging." }),
|
|
5945
5980
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ r("table", { className: "min-w-full text-sm", children: [
|
|
5946
5981
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
@@ -5950,8 +5985,8 @@ function ys() {
|
|
|
5950
5985
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-left font-medium text-gray-500", children: "Due Date" }),
|
|
5951
5986
|
/* @__PURE__ */ e("th", { className: "px-2 py-2 text-left font-medium text-gray-500", children: "Ref / Remarks" })
|
|
5952
5987
|
] }) }),
|
|
5953
|
-
/* @__PURE__ */ e("tbody", { children: v.map((
|
|
5954
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ r("select", { value:
|
|
5988
|
+
/* @__PURE__ */ e("tbody", { children: v.map((g, _) => /* @__PURE__ */ r("tr", { children: [
|
|
5989
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ r("select", { value: g.type, onChange: (w) => b(v, D, _, "type", w.target.value), className: "rounded border border-gray-300 px-2 py-1.5 text-sm", children: [
|
|
5955
5990
|
/* @__PURE__ */ e("option", { value: "sales", children: "Sales (AR)" }),
|
|
5956
5991
|
/* @__PURE__ */ e("option", { value: "purchase", children: "Purchase (AP)" })
|
|
5957
5992
|
] }) }),
|
|
@@ -5959,24 +5994,24 @@ function ys() {
|
|
|
5959
5994
|
ke,
|
|
5960
5995
|
{
|
|
5961
5996
|
label: "",
|
|
5962
|
-
value:
|
|
5963
|
-
onChange: (
|
|
5964
|
-
linkDoctype:
|
|
5997
|
+
value: g.party,
|
|
5998
|
+
onChange: (w) => b(v, D, _, "party", w),
|
|
5999
|
+
linkDoctype: g.type === "sales" ? "customer" : "supplier",
|
|
5965
6000
|
readOnly: !1
|
|
5966
6001
|
}
|
|
5967
6002
|
) }),
|
|
5968
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value:
|
|
5969
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "date", value:
|
|
5970
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "text", value:
|
|
5971
|
-
] },
|
|
6003
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "number", value: g.amount, onChange: (w) => b(v, D, _, "amount", w.target.value), className: "w-28 rounded border border-gray-300 px-2 py-1.5 text-right text-sm", placeholder: "0.00" }) }),
|
|
6004
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "date", value: g.due_date, onChange: (w) => b(v, D, _, "due_date", w.target.value), className: "rounded border border-gray-300 px-2 py-1.5 text-sm" }) }),
|
|
6005
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e("input", { type: "text", value: g.remarks, onChange: (w) => b(v, D, _, "remarks", w.target.value), className: "w-full rounded border border-gray-300 px-2 py-1.5 text-sm", placeholder: "Old invoice ref" }) })
|
|
6006
|
+
] }, _)) })
|
|
5972
6007
|
] }) }),
|
|
5973
|
-
/* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e("button", { onClick: () =>
|
|
6008
|
+
/* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e("button", { onClick: () => D([...v, An()]), className: "text-xs text-blue-600 hover:text-blue-800", children: "+ Add Row" }) }),
|
|
5974
6009
|
/* @__PURE__ */ r("div", { className: "mt-3 flex items-center gap-3", children: [
|
|
5975
|
-
/* @__PURE__ */ e(
|
|
6010
|
+
/* @__PURE__ */ e(ee, { onClick: () => C.mutate(), disabled: !a || C.isPending, children: C.isPending ? "Importing..." : "Import Outstanding Invoices" }),
|
|
5976
6011
|
C.error && /* @__PURE__ */ e("span", { className: "text-xs text-red-600", children: C.error.message }),
|
|
5977
|
-
|
|
6012
|
+
h.invoices && /* @__PURE__ */ r("span", { className: "text-xs text-green-600", children: [
|
|
5978
6013
|
"Created ",
|
|
5979
|
-
|
|
6014
|
+
h.invoices.invoices_created,
|
|
5980
6015
|
" invoices"
|
|
5981
6016
|
] })
|
|
5982
6017
|
] })
|
|
@@ -5997,26 +6032,26 @@ function ys() {
|
|
|
5997
6032
|
] });
|
|
5998
6033
|
}
|
|
5999
6034
|
function fs() {
|
|
6000
|
-
const { user: t } = mt(), n = We(), { data: a, isLoading: s } =
|
|
6035
|
+
const { user: t } = mt(), n = We(), { data: a, isLoading: s } = le({
|
|
6001
6036
|
queryKey: ["auth-users"],
|
|
6002
6037
|
queryFn: () => O.authListUsers()
|
|
6003
|
-
}), { data: l } =
|
|
6038
|
+
}), { data: l } = le({
|
|
6004
6039
|
queryKey: ["auth-invites"],
|
|
6005
6040
|
queryFn: () => O.authListInvites()
|
|
6006
|
-
}), [i, c] =
|
|
6041
|
+
}), [i, c] = S(""), [o, m] = S("viewer"), [d, u] = S(null), p = pe({
|
|
6007
6042
|
mutationFn: () => O.authInvite(i, o),
|
|
6008
|
-
onSuccess: (
|
|
6009
|
-
u(
|
|
6043
|
+
onSuccess: (h) => {
|
|
6044
|
+
u(h), c(""), n.invalidateQueries({ queryKey: ["auth-invites"] });
|
|
6010
6045
|
}
|
|
6011
|
-
}), v =
|
|
6012
|
-
mutationFn: ({ name:
|
|
6046
|
+
}), v = pe({
|
|
6047
|
+
mutationFn: ({ name: h, role: y }) => O.authChangeRole(h, y),
|
|
6013
6048
|
onSuccess: () => n.invalidateQueries({ queryKey: ["auth-users"] })
|
|
6014
|
-
}),
|
|
6015
|
-
mutationFn: (
|
|
6049
|
+
}), D = pe({
|
|
6050
|
+
mutationFn: (h) => O.authDisableUser(h),
|
|
6016
6051
|
onSuccess: () => n.invalidateQueries({ queryKey: ["auth-users"] })
|
|
6017
6052
|
});
|
|
6018
6053
|
return (t == null ? void 0 : t.role) !== "admin" ? /* @__PURE__ */ e("p", { className: "py-8 text-center text-gray-400", children: "Admin access required" }) : /* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
6019
|
-
/* @__PURE__ */ e(
|
|
6054
|
+
/* @__PURE__ */ e(U, { title: "Roles", children: /* @__PURE__ */ r("div", { className: "grid gap-3 text-sm sm:grid-cols-3", children: [
|
|
6020
6055
|
/* @__PURE__ */ r("div", { className: "rounded-lg border border-blue-200 bg-blue-50 p-3", children: [
|
|
6021
6056
|
/* @__PURE__ */ e("div", { className: "font-semibold text-blue-900", children: "Admin" }),
|
|
6022
6057
|
/* @__PURE__ */ e("p", { className: "mt-1 text-blue-700", children: "Full access. Can create and manage documents, masters, company setup, and users. Can invite team members and change roles." })
|
|
@@ -6030,15 +6065,15 @@ function fs() {
|
|
|
6030
6065
|
/* @__PURE__ */ e("p", { className: "mt-1 text-gray-600", children: "Read-only access to all documents, masters, and reports. Can use the AI chat. Cannot create or modify any data." })
|
|
6031
6066
|
] })
|
|
6032
6067
|
] }) }),
|
|
6033
|
-
/* @__PURE__ */ r(
|
|
6068
|
+
/* @__PURE__ */ r(U, { title: "Invite User", children: [
|
|
6034
6069
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
6035
6070
|
/* @__PURE__ */ e(
|
|
6036
|
-
|
|
6071
|
+
X,
|
|
6037
6072
|
{
|
|
6038
6073
|
label: "Email",
|
|
6039
6074
|
type: "email",
|
|
6040
6075
|
value: i,
|
|
6041
|
-
onChange: (
|
|
6076
|
+
onChange: (h) => c(h.target.value),
|
|
6042
6077
|
placeholder: "colleague@company.com"
|
|
6043
6078
|
}
|
|
6044
6079
|
),
|
|
@@ -6048,11 +6083,11 @@ function fs() {
|
|
|
6048
6083
|
label: "Role",
|
|
6049
6084
|
options: ["viewer", "manager", "admin"],
|
|
6050
6085
|
value: o,
|
|
6051
|
-
onChange: (
|
|
6086
|
+
onChange: (h) => m(h.target.value)
|
|
6052
6087
|
}
|
|
6053
6088
|
),
|
|
6054
6089
|
/* @__PURE__ */ e(
|
|
6055
|
-
|
|
6090
|
+
ee,
|
|
6056
6091
|
{
|
|
6057
6092
|
onClick: () => p.mutate(),
|
|
6058
6093
|
disabled: !i.trim() || p.isPending,
|
|
@@ -6073,22 +6108,22 @@ function fs() {
|
|
|
6073
6108
|
] })
|
|
6074
6109
|
] })
|
|
6075
6110
|
] }),
|
|
6076
|
-
l && l.filter((
|
|
6111
|
+
l && l.filter((h) => !h.used).length > 0 && /* @__PURE__ */ e(U, { title: "Pending Invites", children: /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
6077
6112
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
6078
6113
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: "Email" }),
|
|
6079
6114
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: "Role" }),
|
|
6080
6115
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: "Created" })
|
|
6081
6116
|
] }) }),
|
|
6082
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: l.filter((
|
|
6117
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: l.filter((h) => !h.used).map((h) => {
|
|
6083
6118
|
var y;
|
|
6084
6119
|
return /* @__PURE__ */ r("tr", { children: [
|
|
6085
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2", children:
|
|
6086
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: /* @__PURE__ */ e("span", { className: "rounded bg-gray-100 px-2 py-0.5 text-xs font-medium", children:
|
|
6087
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-500", children: (y =
|
|
6088
|
-
] },
|
|
6120
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: h.email }),
|
|
6121
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: /* @__PURE__ */ e("span", { className: "rounded bg-gray-100 px-2 py-0.5 text-xs font-medium", children: h.role }) }),
|
|
6122
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-500", children: (y = h.creation) == null ? void 0 : y.split("T")[0] })
|
|
6123
|
+
] }, h.token);
|
|
6089
6124
|
}) })
|
|
6090
6125
|
] }) }),
|
|
6091
|
-
/* @__PURE__ */ e(
|
|
6126
|
+
/* @__PURE__ */ e(U, { title: "Team Members", children: s ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: "Loading..." }) : /* @__PURE__ */ r("table", { className: "min-w-full divide-y divide-gray-200 text-sm", children: [
|
|
6092
6127
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50", children: /* @__PURE__ */ r("tr", { children: [
|
|
6093
6128
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: "Name" }),
|
|
6094
6129
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: "Email" }),
|
|
@@ -6096,16 +6131,16 @@ function fs() {
|
|
|
6096
6131
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-left font-medium text-gray-500", children: "Status" }),
|
|
6097
6132
|
/* @__PURE__ */ e("th", { className: "px-4 py-2 text-right font-medium text-gray-500", children: "Actions" })
|
|
6098
6133
|
] }) }),
|
|
6099
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: (a || []).map((
|
|
6100
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 font-medium text-gray-900", children:
|
|
6101
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-600", children:
|
|
6102
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2", children:
|
|
6134
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-gray-100", children: (a || []).map((h) => /* @__PURE__ */ r("tr", { className: "hover:bg-gray-50", children: [
|
|
6135
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 font-medium text-gray-900", children: h.full_name }),
|
|
6136
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-gray-600", children: h.email }),
|
|
6137
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: h.role === "public_manager" ? /* @__PURE__ */ e("span", { className: "rounded bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800", children: "public_manager (system)" }) : /* @__PURE__ */ r(
|
|
6103
6138
|
"select",
|
|
6104
6139
|
{
|
|
6105
|
-
value:
|
|
6106
|
-
onChange: (y) => v.mutate({ name:
|
|
6107
|
-
disabled:
|
|
6108
|
-
className: `rounded border px-2 py-1 text-xs ${
|
|
6140
|
+
value: h.role,
|
|
6141
|
+
onChange: (y) => v.mutate({ name: h.name, role: y.target.value }),
|
|
6142
|
+
disabled: h.name === (t == null ? void 0 : t.name),
|
|
6143
|
+
className: `rounded border px-2 py-1 text-xs ${h.name === (t == null ? void 0 : t.name) ? "border-gray-200 bg-gray-50 text-gray-400" : "border-gray-300 bg-white text-gray-900"}`,
|
|
6109
6144
|
children: [
|
|
6110
6145
|
/* @__PURE__ */ e("option", { value: "viewer", children: "viewer" }),
|
|
6111
6146
|
/* @__PURE__ */ e("option", { value: "manager", children: "manager" }),
|
|
@@ -6113,16 +6148,16 @@ function fs() {
|
|
|
6113
6148
|
]
|
|
6114
6149
|
}
|
|
6115
6150
|
) }),
|
|
6116
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: /* @__PURE__ */ e("span", { className: `rounded px-2 py-0.5 text-xs font-medium ${
|
|
6117
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children:
|
|
6151
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: /* @__PURE__ */ e("span", { className: `rounded px-2 py-0.5 text-xs font-medium ${h.enabled ? "bg-green-100 text-green-800" : "bg-red-100 text-red-800"}`, children: h.enabled ? "Active" : "Disabled" }) }),
|
|
6152
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2 text-right", children: h.name !== (t == null ? void 0 : t.name) && h.enabled ? /* @__PURE__ */ e(
|
|
6118
6153
|
"button",
|
|
6119
6154
|
{
|
|
6120
|
-
onClick: () =>
|
|
6155
|
+
onClick: () => D.mutate(h.name),
|
|
6121
6156
|
className: "text-xs text-red-500 hover:text-red-700",
|
|
6122
6157
|
children: "Disable"
|
|
6123
6158
|
}
|
|
6124
6159
|
) : null })
|
|
6125
|
-
] },
|
|
6160
|
+
] }, h.name)) })
|
|
6126
6161
|
] }) })
|
|
6127
6162
|
] });
|
|
6128
6163
|
}
|
|
@@ -6145,14 +6180,14 @@ const bs = { save: "Save", saving: "Saving...", submit: "Submit", cancel: "Cance
|
|
|
6145
6180
|
fields: Ls,
|
|
6146
6181
|
tables: Bs,
|
|
6147
6182
|
tutorial: Es
|
|
6148
|
-
}, qs = { save: "Speichern", saving: "Speichern...", submit: "Buchen", cancel: "Abbrechen", cancelDoc: "Stornieren", delete: "Löschen", edit: "Bearbeiten", pdf: "PDF", addRow: "Zeile hinzufügen", loading: "Lädt...", enable: "Aktivieren", disable: "Deaktivieren", refresh: "Aktualisieren", refreshing: "Aktualisiert...", areYouSure: "Sind Sie sicher?", all: "Alle", apply: "Anwenden", new: "Neu", prev: "Zurück", next: "Weiter", perPage: "Pro Seite", page: "Seite", of: "von", showing: "Zeige", total: "Gesamt", totals: "Summen", errorOccurred: "Ein Fehler ist aufgetreten" }, zs = { title: "Sprache", help: "Wählen Sie die Sprache der Oberfläche. Ihre Auswahl wird in diesem Browser gespeichert.", label: "Sprache" }, Fs = { logout: "Abmelden", openMenu: "Menü öffnen", closeMenu: "Menü schließen", new: "Neu: {{label}}" }, Ms = { dashboard: "Dashboard", setup: "Unternehmenseinrichtung", tutorial: "Erste Schritte", chat: "Chat", reports: "Berichte", "trial-balance": "Rohbilanz", "general-ledger": "Hauptbuch", "stock-balance": "Lagerbestand", "profit-and-loss": "Gewinn- und Verlustrechnung", "balance-sheet": "Bilanz", "ar-aging": "Offene Posten Debitoren", "ap-aging": "Offene Posten Kreditoren", analytics: "Analysen" }, $s = { quotation: { one: "Angebot", other: "Angebote" }, "sales-order": { one: "Kundenauftrag", other: "Kundenaufträge" }, "sales-invoice": { one: "Ausgangsrechnung", other: "Ausgangsrechnungen" }, "pos-invoice": { one: "Kassenbeleg", other: "Kassenbelege" }, "purchase-order": { one: "Bestellung", other: "Bestellungen" }, "purchase-invoice": { one: "Eingangsrechnung", other: "Eingangsrechnungen" }, "payment-entry": { one: "Zahlung", other: "Zahlungen" }, "journal-entry": { one: "Buchungssatz", other: "Buchungssätze" }, "bank-transaction": { one: "Banktransaktion", other: "Banktransaktionen" }, budget: { one: "Budget", other: "Budgets" }, subscription: { one: "Abonnement", other: "Abonnements" }, "stock-entry": { one: "Lagerbuchung", other: "Lagerbuchungen" }, "delivery-note": { one: "Lieferschein", other: "Lieferscheine" }, "purchase-receipt": { one: "Wareneingang", other: "Wareneingänge" }, "pricing-rule": { one: "Preisregel", other: "Preisregeln" } }, Vs = { company: { one: "Unternehmen", other: "Unternehmen" }, customer: { one: "Kunde", other: "Kunden" }, supplier: { one: "Lieferant", other: "Lieferanten" }, item: { one: "Artikel", other: "Artikel" }, warehouse: { one: "Lager", other: "Lager" } }, Us = { chats: "Chats", newChat: "Neuer Chat", deleteChat: "Chat löschen", customAnalytics: "Eigene Analysen", newAnalytics: "Neue Analyse", deleteReport: "Bericht löschen", groups: { Introduction: "Einführung", Selling: "Verkauf", Buying: "Einkauf", Accounting: "Buchhaltung", Stock: "Lager", Reports: "Berichte", Masters: "Stammdaten", Settings: "Einstellungen" }, items: { "Getting Started": "Erste Schritte", "Company Setup": "Unternehmenseinrichtung", "Opening Balances": "Eröffnungsbilanzen", Quotation: "Angebot", "Sales Order": "Kundenauftrag", "Sales Invoice": "Ausgangsrechnung", "POS Invoice": "Kassenbeleg", "Purchase Order": "Bestellung", "Purchase Invoice": "Eingangsrechnung", "Payment Entry": "Zahlung", "Journal Entry": "Buchungssatz", "Bank Transaction": "Banktransaktion", Budget: "Budget", Subscription: "Abonnement", "Stock Entry": "Lagerbuchung", "Delivery Note": "Lieferschein", "Purchase Receipt": "Wareneingang", "Trial Balance": "Rohbilanz", "Profit & Loss": "Gewinn- und Verlustrechnung", "Balance Sheet": "Bilanz", "General Ledger": "Hauptbuch", "AR Aging": "Offene Posten Debitoren", "AP Aging": "Offene Posten Kreditoren", Analytics: "Analysen", "Stock Balance": "Lagerbestand", Company: "Unternehmen", Customer: "Kunde", Supplier: "Lieferant", Item: "Artikel", Warehouse: "Lager", General: "Allgemein", "Pricing Rule": "Preisregel", "Users & Team": "Benutzer & Team" } }, Gs = { taglineFirstRun: "Erstellen Sie Ihr Administratorkonto, um zu beginnen", taglineRegister: "Erstellen Sie Ihr Konto", taglineSignIn: "Melden Sie sich bei Ihrem Konto an", demoBanner: "Der Demomodus ist aktiv. Melden Sie sich mit einem Administratorkonto an, um Einstellungen zu verwalten oder den öffentlichen Zugriff zu deaktivieren.", fullName: "Vollständiger Name", email: "E-Mail", password: "Passwort", confirmPassword: "Passwort bestätigen", createAdmin: "Administratorkonto erstellen", register: "Registrieren", signIn: "Anmelden", browsingTitle: "Nur am Stöbern?", browsingBody: "Starten Sie eine neue Chat-Sitzung und sehen Sie sich die Live-Demo an.", enterDemo: "Live-Demo starten", haveInvite: "Haben Sie eine Einladung?", registerLink: "Registrieren", alreadyHaveAccount: "Haben Sie bereits ein Konto?", signInLink: "Anmelden", passwordsNoMatch: "Passwörter stimmen nicht überein", passwordTooShort: "Das Passwort muss mindestens 6 Zeichen lang sein", registrationFailed: "Registrierung fehlgeschlagen", loginFailed: "Anmeldung fehlgeschlagen" }, js = { pdfTitle: "PDF & Druck", pageSize: "Seitengröße", pdfHelp: "A4 ist international Standard (210 x 297 mm). Letter ist Standard in den USA (8,5 x 11 Zoll).", openingTitle: "Eröffnungsbilanzen", openingBody: "Auf der Seite Eröffnungsbilanzen können Kontensalden, Lagerbestände und offene Rechnungen aus einem früheren System importiert werden.", openingEnabled: "Derzeit aktiviert — erreichbar unter Einführung > Eröffnungsbilanzen.", openingDisabled: "Derzeit deaktiviert — die Seite ist in der Seitenleiste ausgeblendet.", publicTitle: "Öffentlicher Zugriff (Demomodus)", publicActive: "Aktiv", publicActiveBody: "Der öffentliche Zugriff ist aktiviert. Jeder kann die Anwendung ohne Anmeldung nutzen. Alle Besucher erhalten Manager-Rechte.", disablePublic: "Öffentlichen Zugriff deaktivieren", disabling: "Wird deaktiviert...", publicInactiveBody: "Aktivieren Sie den öffentlichen Zugriff, damit jeder die Anwendung ohne Konto nutzen kann. Nützlich für Demos und Präsentationen. Alle Besucher erhalten Manager-Rechte und teilen sich dieselbe Identität.", enablePublic: "Öffentlichen Zugriff aktivieren", enableWarning: "Dadurch kann jeder ohne Anmeldung auf die Anwendung zugreifen. Besucher können Dokumente erstellen, bearbeiten und buchen. Ihr Administratorkonto erfordert weiterhin eine Anmeldung.", yesEnable: "Ja, aktivieren", enabling: "Wird aktiviert...", demoSpendTitle: "Demo-Ausgaben" }, Ws = { Draft: "Entwurf", Open: "Offen", Submitted: "Gebucht", "To Deliver and Bill": "Zu liefern und abzurechnen", "To Deliver": "Zu liefern", "To Bill": "Abzurechnen", Completed: "Abgeschlossen", Ordered: "Bestellt", Paid: "Bezahlt", Unpaid: "Unbezahlt", Cancelled: "Storniert", Overdue: "Überfällig", Return: "Retoure", Closed: "Geschlossen" }, Ks = { balanced: "AUSGEGLICHEN", imbalanced: "NICHT AUSGEGLICHEN", income: "Erträge", expenses: "Aufwendungen", totalIncome: "Summe Erträge", totalExpenses: "Summe Aufwendungen", netProfit: "Gewinn", netLoss: "Verlust", assets: "Aktiva", liabilities: "Verbindlichkeiten", equity: "Eigenkapital", totalAssets: "Summe Aktiva", totalLiabilities: "Summe Verbindlichkeiten", totalEquity: "Summe Eigenkapital", totalLiabilitiesEquity: "Summe Verbindlichkeiten + Eigenkapital", current: "Laufend", noData: "Keine Daten gefunden", noEntries: "Keine Buchungen gefunden", noStockData: "Keine Lagerdaten gefunden", noReceivables: "Keine offenen Forderungen", noPayables: "Keine offenen Verbindlichkeiten", noDocuments: "Keine Dokumente gefunden" }, Qs = { required: "Erforderlich: {{fields}}", deleteConfirm: "Diesen Datensatz löschen: {{label}}?", disabledNotice: "Dieser Datensatz ({{label}}) ist deaktiviert. Er verbleibt im System, weil andere Datensätze noch darauf verweisen.", disabledOnDelete: "{{label}} {{name}} wurde deaktiviert statt gelöscht, da er von {{reason}} referenziert wird." }, Hs = { Account: "Konto", Amount: "Betrag", Balance: "Saldo", Credit: "Haben", Debit: "Soll", Date: "Datum", Party: "Partner", "Party Type": "Partnertyp", "Voucher Type": "Belegart", "Voucher No": "Belegnr.", Invoice: "Rechnung", Customer: "Kunde", Supplier: "Lieferant", "Due Date": "Fälligkeitsdatum", Outstanding: "Offen", "Outstanding Amount": "Offener Betrag", "Item Code": "Artikelnr.", "Item Name": "Artikelname", Item: "Artikel", Warehouse: "Lager", Qty: "Menge", "Valuation Rate": "Bewertungspreis", "Stock Value": "Lagerwert", Name: "Name", Status: "Status", Company: "Unternehmen", "From Date": "Von Datum", "To Date": "Bis Datum", "As of Date": "Stichtag", "Valid Till": "Gültig bis", "Net Total": "Nettobetrag", Tax: "Steuer", "Grand Total": "Gesamtbetrag", "Notes / Terms": "Notizen / Bedingungen", "Posting Date": "Buchungsdatum", "Transaction Date": "Belegdatum", "Delivery Date": "Lieferdatum", "% Delivered": "% geliefert", "% Billed": "% abgerechnet", "Update Stock": "Lager aktualisieren", "Payment Type": "Zahlungsart", "Paid From": "Bezahlt von", "Paid To": "Bezahlt an", "Paid Amount": "Zahlbetrag", Type: "Art", Total: "Gesamt", Allocated: "Zugeordnet", Unallocated: "Nicht zugeordnet", Remark: "Bemerkung", "Total Debit": "Summe Soll", "Total Credit": "Summe Haben", "Cost Center": "Kostenstelle", "Source Warehouse": "Quelllager", "Target Warehouse": "Ziellager", Source: "Quelle", Target: "Ziel", "Incoming Value": "Eingangswert", "Outgoing Value": "Ausgangswert", Rate: "Preis", "Income Account": "Ertragskonto", "Expense Account": "Aufwandskonto", Description: "Beschreibung", "Rate (%)": "Satz (%)", Mode: "Art", Change: "Rückgeld", Currency: "Währung", Title: "Titel", Selling: "Verkauf", Buying: "Einkauf", "Discount %": "Rabatt %", "Discount Amt": "Rabattbetrag", "Min Qty": "Mindestmenge", "Valid From": "Gültig ab", "Valid Upto": "Gültig bis", Priority: "Priorität", Enabled: "Aktiviert", "Fiscal Year": "Geschäftsjahr", "Budget Amount": "Budgetbetrag", "If Exceeded": "Bei Überschreitung", Month: "Monat", "Bank Account": "Bankkonto", Deposit: "Einzahlung", Withdrawal: "Auszahlung", "Reference No": "Referenznr.", "Matched Type": "Zugeordnete Art", "Matched Doc": "Zugeordneter Beleg", "Start Date": "Startdatum", "End Date": "Enddatum", "Billing Interval": "Abrechnungsintervall", "Current Period Start": "Aktueller Periodenbeginn", "Current Period End": "Aktuelles Periodenende", "Plan Items": "Planpositionen", "Total Amount": "Gesamtbetrag", "Stock Entry Type": "Lagerbuchungsart", "Rate Or Discount": "Preis oder Rabatt", "Discount Percentage": "Rabattprozentsatz", ID: "ID", "Customer Name": "Kundenname", "Customer Group": "Kundengruppe", Territory: "Region", "Credit Limit": "Kreditlimit", Email: "E-Mail", Phone: "Telefon", Address: "Adresse", City: "Stadt", "Zip Code": "PLZ", Country: "Land", "Tax ID": "Steuernummer", "Supplier Name": "Lieferantenname", "Supplier Group": "Lieferantengruppe", "Item Group": "Artikelgruppe", "Stock UOM": "Lagereinheit", "Standard Rate": "Standardpreis", "Warehouse Name": "Lagername", "Company Name": "Firmenname" }, Js = { items: "Positionen", taxes: "Steuern", references: "Zahlungsreferenzen", accounts: "Kontobuchungen", payments: "Zahlungen", plans: "Planpositionen", monthly_distribution: "Monatliche Verteilung" }, Ys = { "Create Sales Order": "Kundenauftrag erstellen", "Create Sales Invoice": "Ausgangsrechnung erstellen", "Create Delivery Note": "Lieferschein erstellen", "Create Purchase Invoice": "Eingangsrechnung erstellen", "Create Purchase Receipt": "Wareneingang erstellen", "Create Credit Note": "Gutschrift erstellen", "Create Debit Note": "Lastschrift erstellen", "Create Return": "Retoure erstellen" }, Zs = { totalRevenue: "Gesamtumsatz", outstandingReceivable: "Offene Forderungen", outstandingPayable: "Offene Verbindlichkeiten", totalStockValue: "Gesamter Lagerwert", recentDocuments: "Letzte Dokumente", noRecentDocuments: "Keine aktuellen Dokumente" }, Xs = { title: "Lambda ERP Chat", subtitle: "Bitten Sie mich, Dokumente zu erstellen, Daten abzurufen oder Berichte auszuführen.", s1: "Welche Kunden haben wir?", s2: "Zeig mir die Rohbilanz", s3: "Erstelle ein Angebot für 10 Bolt Pack M8", s4: "Liste alle unbezahlten Rechnungen auf", loadOlder: "Ältere Nachrichten laden", uploading: "Wird hochgeladen...", failed: "Fehlgeschlagen", remove: "Entfernen", placeholderDemo: "Live-Demo läuft...", placeholderType: "Nachricht eingeben...", placeholderConnecting: "Verbindung wird hergestellt...", attachTitle: "Datei anhängen (PDF oder Bild, max. 10 MB)", creating: "Chat wird erstellt...", dropToAttach: "Datei zum Anhängen ablegen (Bilder oder PDF, je max. 10 MB)", demoError: "Demo konnte nicht gestartet werden" }, ei = /* @__PURE__ */ JSON.parse('{"pageTitle":"Erste Schritte mit Lambda ERP","intro":"Lambda ERP ist ein KI-natives ERP-System, bei dem die gesamte Funktionalität – etwa das Erstellen von Aufträgen, das Prüfen von Beständen und das Erfassen von Zahlungen – über eine Chat-Oberfläche zugänglich ist. Es leitet an, denkt mit und prüft alle Ihre täglichen Geschäftsaufgaben.","openChat":"KI-Chat öffnen","tipLabel":"Tipp:","topTip":"Der KI-Chat kann Ihnen auch direkte Links zu Dokumenten und herunterladbaren PDFs geben. Bitten Sie ihn einfach, ein Dokument zu erstellen oder nachzuschlagen, und er fügt anklickbare Links in seine Antwort ein.","manualIntro":"Wenn Sie genau verstehen möchten, wie die Dinge unter der Haube funktionieren, oder Dinge lieber manuell erledigen, finden Sie hier einen vollständigen Geschäftszyklus Schritt für Schritt.","caTitle":"Dynamische Analysen – Chatten Sie sich zu jedem Diagramm","caBadge":"Kernfunktion","caBody":"Brauchen Sie einen Bericht, den die Vorlagen nicht liefern? Beschreiben Sie ihn einfach im Chat. Der Assistent ruft ein Code-Spezialmodell auf, das den Bericht für Sie schreibt, ihn live über Ihre ERP-Daten ausführt und einen teilbaren Link zurückgibt. Das Diagramm oder die Tabelle wird in Sekunden gerendert und als Entwurf unter „Eigene Analysen“ in der Seitenleiste gespeichert – Sie können ihn erneut öffnen, die URL mit Kollegen teilen oder den Assistenten bitten, ihn zu verfeinern.","caTryAsking":"Versuchen Sie zu fragen (zum Vorausfüllen im Chat klicken):","caPrompt1":"Zeig mir die Top 10 Kunden nach Umsatz dieses Jahr als Balkendiagramm","caPrompt2":"Monatlicher Einkaufstrend nach Lieferant über alle Monate, x-Achse mit Lieferantennamen beschriften","caPrompt3":"Bestseller-Artikel nach Menge, mit Tabelle und Diagramm","caPrompt4":"Welche Kunden schulden mir gerade am meisten?","caTryInChat":"Im Chat ausprobieren","caOpenWorkspace":"Analyse-Arbeitsbereich öffnen","flowTitle":"Überblick Dokumentenfluss","salesCycle":"Verkaufszyklus","purchaseCycle":"Einkaufszyklus","returns":"Retouren","flowShortcut":"Abkürzung: Das Angebot kann den Kundenauftrag überspringen und direkt zur Ausgangsrechnung oder zum Lieferschein führen","legendStock":"Lagerwirkung","legendGl":"Buchungswirkung","legendCash":"Geldwirkung","legendReversal":"Stornierung","lifecycleTitle":"Dokumenten-Lebenszyklus","lcDraftLabel":"Entwurf:","lcDraftDesc":"Bearbeitbar. Keine finanzielle oder Bestandswirkung.","lcSubmittedLabel":"Gebucht:","lcSubmittedDesc":"Gesperrt. Buchungen und Lagerbuchungen werden erzeugt.","lcCancelledLabel":"Storniert:","lcCancelledDesc":"Alle Buchungen storniert. Das Dokument wird dauerhaft archiviert.","lcNoDelete":"Es gibt kein Löschen. Um einen Entwurf zu verwerfen: buchen und dann stornieren.","lcCorrect":"Um ein gebuchtes Dokument zu korrigieren: stornieren und ein neues erstellen.","readyTitle":"Sie sind startklar","readyBody1":"Sie verstehen jetzt den vollständigen Zyklus. Ein typisches Praxisszenario sieht so aus: Sie erhalten einen Kundenauftrag (Angebot → Kundenauftrag), prüfen den Bestand, kaufen, was Sie brauchen (Bestellung → Wareneingang → Eingangsrechnung → Zahlung), liefern an den Kunden (Lieferschein), stellen ihm die Rechnung (Ausgangsrechnung) und ziehen die Zahlung ein (Zahlung). Kommt etwas zurück, erstellen Sie eine Gutschrift und eine Lieferschein-Retoure, um Finanzen und Bestand umzukehren. Die Rohbilanz bestätigt, dass alles ausgeglichen ist.","readyBody2":"Sie können all dies auch über den KI-Chat per natürlicher Konversation erledigen – beschreiben Sie einfach, was Sie brauchen, und er erstellt die richtigen Dokumente für Sie.","chips":{"Quotation":"Angebot","Sales Order":"Kundenauftrag","Delivery Note":"Lieferschein","Sales Invoice":"Ausgangsrechnung","Payment Entry":"Zahlung","Purchase Order":"Bestellung","Purchase Receipt":"Wareneingang","Purchase Invoice":"Eingangsrechnung","Credit Note":"Gutschrift","DN Return":"Lieferschein-Retoure","Debit Note":"Lastschrift","Draft":"Entwurf","Submitted":"Gebucht","Cancelled":"Storniert"},"links":{"Go to Setup":"Zur Einrichtung","Customers":"Kunden","Suppliers":"Lieferanten","Items":"Artikel","Warehouses":"Lager","New Quotation":"Neues Angebot","View Quotations":"Angebote anzeigen","Stock Balance":"Lagerbestand","New Purchase Order":"Neue Bestellung","Purchase Receipts":"Wareneingänge","Purchase Invoices":"Eingangsrechnungen","Delivery Notes":"Lieferscheine","Sales Invoices":"Ausgangsrechnungen","New Payment Entry":"Neue Zahlung","New Stock Entry":"Neue Lagerbuchung","New Journal Entry":"Neuer Buchungssatz","Profit & Loss":"Gewinn- und Verlustrechnung","Balance Sheet":"Bilanz","AR Aging":"Offene Posten Debitoren","AP Aging":"Offene Posten Kreditoren","Trial Balance":"Rohbilanz","General Ledger":"Hauptbuch","Open AI Chat":"KI-Chat öffnen"},"steps":{"1":{"title":"Unternehmen einrichten","description":"Erstellen Sie ein Unternehmen mit einer Basiswährung. Dadurch wird Ihr Kontenplan generiert (30 Standardkonten in den Bereichen Aktiva, Verbindlichkeiten, Eigenkapital, Erträge und Aufwendungen) sowie eine Standard-Kostenstelle. Sie können außerdem Demodaten mit Beispielkunden, -lieferanten und -artikeln anlegen, um schnell loszulegen."},"2":{"title":"Stammdaten anlegen","description":"Bevor Sie buchen können, benötigen Sie Stammdaten. Legen Sie mindestens einen Kunden, einen Lieferanten, einen Artikel (mit Standardpreis) und ein Lager an. Wenn Sie in Schritt 1 Demodaten angelegt haben, existieren diese bereits.","tip":"Artikel haben einen Standardpreis, der beim Hinzufügen zu Dokumenten automatisch ausgefüllt wird. Sie können den Preis pro Transaktion jederzeit überschreiben."},"3":{"title":"Angebot erstellen","description":"Ein Angebot ist eine unverbindliche Offerte an einen Kunden. Wählen Sie einen Kunden, fügen Sie Positionen mit Mengen und Preisen hinzu, optional Steuerzeilen, und speichern Sie. Angebote haben keine finanzielle Auswirkung – sie erzeugen keine Buchungs- oder Lagerbewegungen. Legen Sie ein Gültigkeitsdatum fest, damit das Angebot automatisch abläuft."},"4":{"title":"Buchen und in Kundenauftrag umwandeln","description":"Öffnen Sie Ihr gespeichertes Angebot und klicken Sie auf Buchen, um es zu bestätigen. Klicken Sie dann auf „Kundenauftrag erstellen“, um es umzuwandeln. Der Kundenauftrag stellt eine bestätigte Zusage des Kunden dar. Er hat weiterhin keine finanzielle Auswirkung, reserviert aber Bestand für die Planung.","tip":"Nur gebuchte Dokumente können in den nächsten Schritt umgewandelt werden. Entwurf → Buchen → Umwandeln ist der Standardablauf. Für schnelle Geschäfte können Sie den Kundenauftrag überspringen und direkt vom Angebot zur Ausgangsrechnung oder zum Lieferschein gehen."},"5":{"title":"Bestand vor der Erfüllung prüfen","description":"Bevor Sie liefern können, prüfen Sie, ob der Artikel tatsächlich auf Lager ist. Öffnen Sie den Bericht Lagerbestand und suchen Sie den Artikel. Wenn Ihr Lager eine Menge von null aufweist, müssen Sie zunächst Bestand beschaffen – entweder über eine Bestellung (Einkauf bei einem Lieferanten) oder eine Lagerbuchung (manueller Eingang).","tip":"Dies ist ein häufiges Szenario aus der Praxis: Sie verkaufen etwas und stellen dann fest, dass Sie es erst einkaufen müssen. Das ERP unterstützt beide Abläufe."},"6":{"title":"Einkaufszyklus: Bestand bei einem Lieferanten kaufen","description":"Wenn Sie Bestand einkaufen müssen, haben Sie zwei gültige Wege. Der Standardweg ist Bestellung → Wareneingang → Eingangsrechnung: Nutzen Sie ihn, wenn die Ware vor oder getrennt von der Lieferantenrechnung eintrifft. Treffen Rechnung und Wareneingang gleichzeitig ein, können Sie die Eingangsrechnung direkt erstellen und „Lager aktualisieren“ aktivieren, sodass dasselbe Dokument sowohl den Bestand vereinnahmt als auch die Verbindlichkeit erfasst.","tip":"Verwenden Sie zuerst den Wareneingang, wenn Sie Waren getrennt erhalten. Verwenden Sie die Eingangsrechnung mit „Lager aktualisieren“, wenn ein Schritt sowohl den Bestand vereinnahmen als auch die Lieferantenrechnung buchen soll. Setzen Sie in diesem direkten Weg ein Lager in jeder Bestandszeile."},"7":{"title":"Lieferschein erstellen","description":"Nachdem Sie nun Bestand haben, kehren Sie zu Ihrem gebuchten Kundenauftrag zurück und klicken Sie auf „Lieferschein erstellen“. Setzen Sie in jeder Position das Lager (von dem die Ware versendet wird) und buchen Sie. Dadurch wird Bestand aus dem Lager ausgebucht – Ihr Lagerbestand sinkt.","tip":"Der Lieferschein ist das Versanddokument. Er reduziert den Bestand, erzeugt aber keine Rechnung. Sie können Lieferung und Rechnungsstellung getrennt vornehmen."},"8":{"title":"Ausgangsrechnung erstellen und buchen","description":"Erstellen Sie aus dem gebuchten Kundenauftrag eine Ausgangsrechnung. Beim Buchen der Rechnung werden Buchungen erzeugt: Forderungen aus Lieferungen und Leistungen werden im Soll gebucht (der Kunde schuldet Ihnen Geld) und Umsatzerlöse im Haben (erzielter Ertrag). Sind Steuern konfiguriert, wird auch die Steuerverbindlichkeit im Haben gebucht. Der offene Betrag zeigt, was der Kunde noch schuldet."},"9":{"title":"Kundenzahlungen erfassen","description":"Erstellen Sie eine Zahlung, um vom Kunden erhaltenes Geld zu erfassen. Setzen Sie die Zahlungsart auf „Receive“ (Erhalten), wählen Sie den Kunden, geben Sie den Betrag an und ordnen Sie ihn der Ausgangsrechnung zu. Sie können Teilzahlungen vornehmen – der offene Betrag der Rechnung aktualisiert sich entsprechend. Erstellen Sie weitere Zahlungen, bis die Rechnung vollständig beglichen ist.","tip":"Teilzahlungen sind üblich. Eine Rechnung über 10.000 kann jetzt mit 3.000 und später mit 7.000 bezahlt werden. Jede Zahlung reduziert den offenen Betrag."},"10":{"title":"Lagerbuchungen (manuelle Bestandsführung)","description":"Verwenden Sie Lagerbuchungen für Bestandsbewegungen, die nicht mit Ein- oder Verkäufen verbunden sind. „Material Receipt“ fügt Bestand hinzu (Eröffnungsbestände, Korrekturen). „Material Issue“ bucht Bestand aus (Abschreibungen, interner Verbrauch). „Material Transfer“ verschiebt Bestand zwischen Lägern. Jede Buchung aktualisiert das Lagerbuch mit gleitender Durchschnittsbewertung.","tip":"Verwenden Sie für eingekaufte Waren Wareneingänge statt Lagerbuchungen – sie sind mit der Bestellung verknüpft und bieten einen sauberen Prüfpfad."},"11":{"title":"Buchungssätze","description":"Buchungssätze sind manuelle buchhalterische Anpassungen – Aufwandsabgrenzungen, Korrekturen, Umgliederungen, Eröffnungsbestände. Jeder Satz muss ausgeglichene Soll- und Haben-Beträge haben (Summe Soll = Summe Haben). Verwenden Sie sie, wenn kein anderer Dokumenttyp passt."},"12":{"title":"Gehaltszahlungen","description":"Lambda ERP wickelt Gehälter über die vorhandenen Buchhaltungswerkzeuge ab. Grenzen Sie zunächst den Gehaltsaufwand ab: Erstellen Sie einen Buchungssatz, der Gehaltsaufwand im Soll und Gehaltsverbindlichkeiten im Haben für den gesamten Lohnbetrag bucht. Bezahlen Sie dann die Mitarbeiter: Erstellen Sie einen weiteren Buchungssatz (oder eine Zahlung), der Gehaltsverbindlichkeiten im Soll und Ihr Bankkonto im Haben bucht. Dieser zweistufige Prozess hält Ihre Bücher korrekt – der Aufwand wird in der richtigen Periode erfasst und der Geldabfluss separat nachverfolgt.","tip":"Sie können den KI-Assistenten bitten, dies für Sie zu erledigen: „Grenze 15.000 an Gehältern für April ab“ gefolgt von „Zahle die April-Gehälter von der Bank“. Er erstellt die richtigen Buchungssätze automatisch."},"13":{"title":"Retouren und Gutschriften","description":"Wenn ein Kunde Waren zurückgibt oder Sie eine Gutschrift ausstellen müssen, erstellen Sie eine Retoure. Retouren verwenden denselben Dokumenttyp mit negativen Mengen. Öffnen Sie eine gebuchte Ausgangsrechnung und erstellen Sie eine Gutschrift (Ausgangsrechnungs-Retoure) – dies kehrt die Buchungen um und reduziert den offenen Betrag der ursprünglichen Rechnung. Erstellen Sie für den Bestand eine Lieferschein-Retoure, um Waren zurück ins Lager zu nehmen. Auf der Einkaufsseite erstellen Sie eine Lastschrift (Eingangsrechnungs-Retoure), um eine Lieferantenrechnung umzukehren, oder eine Wareneingangs-Retoure, um Waren zurückzusenden.","tip":"Eine Gutschrift ist einfach eine Ausgangsrechnung mit is_return=1 und negativen Mengen. Dieselbe Buchungslogik läuft – negative Beträge wechseln automatisch auf die richtige Soll-/Haben-Seite. Für eine vollständige Verkaufsretoure benötigen Sie sowohl eine Gutschrift (Finanzen) als auch eine Lieferschein-Retoure (Bestand)."},"14":{"title":"Berichte ausführen","description":"Prüfen Sie Ihre Bücher. Die Gewinn- und Verlustrechnung zeigt Erträge gegenüber Aufwendungen und den Periodengewinn. Die Bilanz zeigt Ihre finanzielle Lage (Aktiva = Verbindlichkeiten + Eigenkapital). Die Offenen Posten Debitoren zeigen, wer Ihnen Geld schuldet und wie überfällig es ist. Die Offenen Posten Kreditoren zeigen, was Sie Lieferanten schulden. Die Rohbilanz überprüft die doppelte Buchführung. Das Hauptbuch zeigt jede einzelne Buchung. Der Lagerbestand zeigt den aktuellen Bestand."},"15":{"title":"Arbeiten in Fremdwährungen","description":"Ihre Bücher werden in einer einzigen Basiswährung geführt (bei der Unternehmenseinrichtung gewählt), aber Sie können in jeder Währung buchen. Setzen Sie eine Währung auf einer Rechnung oder einem Beleg – oder geben Sie einem Kunden oder Lieferanten eine Standardwährung – und der Wechselkurs für dieses Datum wird automatisch ermittelt und auf dem Dokument gespeichert. Das Dokument behält seine Beträge in seiner eigenen Währung, während das Hauptbuch stets in Ihrer Basiswährung bucht. Wenn Sie später zu einem anderen Kurs einnehmen oder zahlen, wird der realisierte Währungsgewinn oder -verlust automatisch auf ein Konto Währungsgewinn/-verlust gebucht. Sie können sogar ein Fremdwährungs-Bankguthaben halten und es später zum Kurs Ihrer Bank umrechnen – die Differenz zum Buchwert wird dann realisiert. Zum Monatsende können Sie offene Fremdwährungssalden zum Stichtagskurs neu bewerten (ein unrealisierter Gewinn/Verlust, der in der nächsten Periode storniert wird), und Sie können jeden Jahresabschluss zur Anzeige in eine andere Währung umgerechnet betrachten.","tip":"Am einfachsten geht das über den KI-Chat – probieren Sie „Erstelle eine Ausgangsrechnung für Lumiere Audio in EUR“, „Zeig mir die Bilanz in EUR“ oder „Wie hoch ist unser unrealisiertes Währungsrisiko zum Monatsende?“. Die Demodaten enthalten bereits einen EUR-Kunden (Lumiere Audio SARL), dessen Rechnung zu einem anderen Kurs eingenommen wurde, sowie eine offene EUR-Lieferantenrechnung – öffnen Sie das Hauptbuch, um die realisierten Währungsbuchungen zu sehen."}}}'), ti = {
|
|
6183
|
+
}, qs = { save: "Speichern", saving: "Speichern...", submit: "Buchen", cancel: "Abbrechen", cancelDoc: "Stornieren", delete: "Löschen", edit: "Bearbeiten", pdf: "PDF", addRow: "Zeile hinzufügen", loading: "Lädt...", enable: "Aktivieren", disable: "Deaktivieren", refresh: "Aktualisieren", refreshing: "Aktualisiert...", areYouSure: "Sind Sie sicher?", all: "Alle", apply: "Anwenden", new: "Neu", prev: "Zurück", next: "Weiter", perPage: "Pro Seite", page: "Seite", of: "von", showing: "Zeige", total: "Gesamt", totals: "Summen", errorOccurred: "Ein Fehler ist aufgetreten" }, zs = { title: "Sprache", help: "Wählen Sie die Sprache der Oberfläche. Ihre Auswahl wird in diesem Browser gespeichert.", label: "Sprache" }, Fs = { logout: "Abmelden", openMenu: "Menü öffnen", closeMenu: "Menü schließen", new: "Neu: {{label}}" }, Ms = { dashboard: "Dashboard", setup: "Unternehmenseinrichtung", tutorial: "Erste Schritte", chat: "Chat", reports: "Berichte", "trial-balance": "Rohbilanz", "general-ledger": "Hauptbuch", "stock-balance": "Lagerbestand", "profit-and-loss": "Gewinn- und Verlustrechnung", "balance-sheet": "Bilanz", "ar-aging": "Offene Posten Debitoren", "ap-aging": "Offene Posten Kreditoren", analytics: "Analysen" }, $s = { quotation: { one: "Angebot", other: "Angebote" }, "sales-order": { one: "Kundenauftrag", other: "Kundenaufträge" }, "sales-invoice": { one: "Ausgangsrechnung", other: "Ausgangsrechnungen" }, "pos-invoice": { one: "Kassenbeleg", other: "Kassenbelege" }, "purchase-order": { one: "Bestellung", other: "Bestellungen" }, "purchase-invoice": { one: "Eingangsrechnung", other: "Eingangsrechnungen" }, "payment-entry": { one: "Zahlung", other: "Zahlungen" }, "journal-entry": { one: "Buchungssatz", other: "Buchungssätze" }, "bank-transaction": { one: "Banktransaktion", other: "Banktransaktionen" }, budget: { one: "Budget", other: "Budgets" }, subscription: { one: "Abonnement", other: "Abonnements" }, "stock-entry": { one: "Lagerbuchung", other: "Lagerbuchungen" }, "delivery-note": { one: "Lieferschein", other: "Lieferscheine" }, "purchase-receipt": { one: "Wareneingang", other: "Wareneingänge" }, "pricing-rule": { one: "Preisregel", other: "Preisregeln" } }, Us = { company: { one: "Unternehmen", other: "Unternehmen" }, customer: { one: "Kunde", other: "Kunden" }, supplier: { one: "Lieferant", other: "Lieferanten" }, item: { one: "Artikel", other: "Artikel" }, warehouse: { one: "Lager", other: "Lager" } }, Vs = { chats: "Chats", newChat: "Neuer Chat", deleteChat: "Chat löschen", customAnalytics: "Eigene Analysen", newAnalytics: "Neue Analyse", deleteReport: "Bericht löschen", groups: { Introduction: "Einführung", Selling: "Verkauf", Buying: "Einkauf", Accounting: "Buchhaltung", Stock: "Lager", Reports: "Berichte", Masters: "Stammdaten", Settings: "Einstellungen" }, items: { "Getting Started": "Erste Schritte", "Company Setup": "Unternehmenseinrichtung", "Opening Balances": "Eröffnungsbilanzen", Quotation: "Angebot", "Sales Order": "Kundenauftrag", "Sales Invoice": "Ausgangsrechnung", "POS Invoice": "Kassenbeleg", "Purchase Order": "Bestellung", "Purchase Invoice": "Eingangsrechnung", "Payment Entry": "Zahlung", "Journal Entry": "Buchungssatz", "Bank Transaction": "Banktransaktion", Budget: "Budget", Subscription: "Abonnement", "Stock Entry": "Lagerbuchung", "Delivery Note": "Lieferschein", "Purchase Receipt": "Wareneingang", "Trial Balance": "Rohbilanz", "Profit & Loss": "Gewinn- und Verlustrechnung", "Balance Sheet": "Bilanz", "General Ledger": "Hauptbuch", "AR Aging": "Offene Posten Debitoren", "AP Aging": "Offene Posten Kreditoren", Analytics: "Analysen", "Stock Balance": "Lagerbestand", Company: "Unternehmen", Customer: "Kunde", Supplier: "Lieferant", Item: "Artikel", Warehouse: "Lager", General: "Allgemein", "Pricing Rule": "Preisregel", "Users & Team": "Benutzer & Team" } }, Gs = { taglineFirstRun: "Erstellen Sie Ihr Administratorkonto, um zu beginnen", taglineRegister: "Erstellen Sie Ihr Konto", taglineSignIn: "Melden Sie sich bei Ihrem Konto an", demoBanner: "Der Demomodus ist aktiv. Melden Sie sich mit einem Administratorkonto an, um Einstellungen zu verwalten oder den öffentlichen Zugriff zu deaktivieren.", fullName: "Vollständiger Name", email: "E-Mail", password: "Passwort", confirmPassword: "Passwort bestätigen", createAdmin: "Administratorkonto erstellen", register: "Registrieren", signIn: "Anmelden", browsingTitle: "Nur am Stöbern?", browsingBody: "Starten Sie eine neue Chat-Sitzung und sehen Sie sich die Live-Demo an.", enterDemo: "Live-Demo starten", haveInvite: "Haben Sie eine Einladung?", registerLink: "Registrieren", alreadyHaveAccount: "Haben Sie bereits ein Konto?", signInLink: "Anmelden", passwordsNoMatch: "Passwörter stimmen nicht überein", passwordTooShort: "Das Passwort muss mindestens 6 Zeichen lang sein", registrationFailed: "Registrierung fehlgeschlagen", loginFailed: "Anmeldung fehlgeschlagen" }, js = { pdfTitle: "PDF & Druck", pageSize: "Seitengröße", pdfHelp: "A4 ist international Standard (210 x 297 mm). Letter ist Standard in den USA (8,5 x 11 Zoll).", openingTitle: "Eröffnungsbilanzen", openingBody: "Auf der Seite Eröffnungsbilanzen können Kontensalden, Lagerbestände und offene Rechnungen aus einem früheren System importiert werden.", openingEnabled: "Derzeit aktiviert — erreichbar unter Einführung > Eröffnungsbilanzen.", openingDisabled: "Derzeit deaktiviert — die Seite ist in der Seitenleiste ausgeblendet.", publicTitle: "Öffentlicher Zugriff (Demomodus)", publicActive: "Aktiv", publicActiveBody: "Der öffentliche Zugriff ist aktiviert. Jeder kann die Anwendung ohne Anmeldung nutzen. Alle Besucher erhalten Manager-Rechte.", disablePublic: "Öffentlichen Zugriff deaktivieren", disabling: "Wird deaktiviert...", publicInactiveBody: "Aktivieren Sie den öffentlichen Zugriff, damit jeder die Anwendung ohne Konto nutzen kann. Nützlich für Demos und Präsentationen. Alle Besucher erhalten Manager-Rechte und teilen sich dieselbe Identität.", enablePublic: "Öffentlichen Zugriff aktivieren", enableWarning: "Dadurch kann jeder ohne Anmeldung auf die Anwendung zugreifen. Besucher können Dokumente erstellen, bearbeiten und buchen. Ihr Administratorkonto erfordert weiterhin eine Anmeldung.", yesEnable: "Ja, aktivieren", enabling: "Wird aktiviert...", demoSpendTitle: "Demo-Ausgaben" }, Ws = { Draft: "Entwurf", Open: "Offen", Submitted: "Gebucht", "To Deliver and Bill": "Zu liefern und abzurechnen", "To Deliver": "Zu liefern", "To Bill": "Abzurechnen", Completed: "Abgeschlossen", Ordered: "Bestellt", Paid: "Bezahlt", Unpaid: "Unbezahlt", Cancelled: "Storniert", Overdue: "Überfällig", Return: "Retoure", Closed: "Geschlossen" }, Ks = { balanced: "AUSGEGLICHEN", imbalanced: "NICHT AUSGEGLICHEN", income: "Erträge", expenses: "Aufwendungen", totalIncome: "Summe Erträge", totalExpenses: "Summe Aufwendungen", netProfit: "Gewinn", netLoss: "Verlust", assets: "Aktiva", liabilities: "Verbindlichkeiten", equity: "Eigenkapital", totalAssets: "Summe Aktiva", totalLiabilities: "Summe Verbindlichkeiten", totalEquity: "Summe Eigenkapital", totalLiabilitiesEquity: "Summe Verbindlichkeiten + Eigenkapital", current: "Laufend", noData: "Keine Daten gefunden", noEntries: "Keine Buchungen gefunden", noStockData: "Keine Lagerdaten gefunden", noReceivables: "Keine offenen Forderungen", noPayables: "Keine offenen Verbindlichkeiten", noDocuments: "Keine Dokumente gefunden" }, Qs = { required: "Erforderlich: {{fields}}", deleteConfirm: "Diesen Datensatz löschen: {{label}}?", disabledNotice: "Dieser Datensatz ({{label}}) ist deaktiviert. Er verbleibt im System, weil andere Datensätze noch darauf verweisen.", disabledOnDelete: "{{label}} {{name}} wurde deaktiviert statt gelöscht, da er von {{reason}} referenziert wird." }, Hs = { Account: "Konto", Amount: "Betrag", Balance: "Saldo", Credit: "Haben", Debit: "Soll", Date: "Datum", Party: "Partner", "Party Type": "Partnertyp", "Voucher Type": "Belegart", "Voucher No": "Belegnr.", Invoice: "Rechnung", Customer: "Kunde", Supplier: "Lieferant", "Due Date": "Fälligkeitsdatum", Outstanding: "Offen", "Outstanding Amount": "Offener Betrag", "Item Code": "Artikelnr.", "Item Name": "Artikelname", Item: "Artikel", Warehouse: "Lager", Qty: "Menge", "Valuation Rate": "Bewertungspreis", "Stock Value": "Lagerwert", Name: "Name", Status: "Status", Company: "Unternehmen", "From Date": "Von Datum", "To Date": "Bis Datum", "As of Date": "Stichtag", "Valid Till": "Gültig bis", "Net Total": "Nettobetrag", Tax: "Steuer", "Grand Total": "Gesamtbetrag", "Notes / Terms": "Notizen / Bedingungen", "Posting Date": "Buchungsdatum", "Transaction Date": "Belegdatum", "Delivery Date": "Lieferdatum", "% Delivered": "% geliefert", "% Billed": "% abgerechnet", "Update Stock": "Lager aktualisieren", "Payment Type": "Zahlungsart", "Paid From": "Bezahlt von", "Paid To": "Bezahlt an", "Paid Amount": "Zahlbetrag", Type: "Art", Total: "Gesamt", Allocated: "Zugeordnet", Unallocated: "Nicht zugeordnet", Remark: "Bemerkung", "Total Debit": "Summe Soll", "Total Credit": "Summe Haben", "Cost Center": "Kostenstelle", "Source Warehouse": "Quelllager", "Target Warehouse": "Ziellager", Source: "Quelle", Target: "Ziel", "Incoming Value": "Eingangswert", "Outgoing Value": "Ausgangswert", Rate: "Preis", "Income Account": "Ertragskonto", "Expense Account": "Aufwandskonto", Description: "Beschreibung", "Rate (%)": "Satz (%)", Mode: "Art", Change: "Rückgeld", Currency: "Währung", Title: "Titel", Selling: "Verkauf", Buying: "Einkauf", "Discount %": "Rabatt %", "Discount Amt": "Rabattbetrag", "Min Qty": "Mindestmenge", "Valid From": "Gültig ab", "Valid Upto": "Gültig bis", Priority: "Priorität", Enabled: "Aktiviert", "Fiscal Year": "Geschäftsjahr", "Budget Amount": "Budgetbetrag", "If Exceeded": "Bei Überschreitung", Month: "Monat", "Bank Account": "Bankkonto", Deposit: "Einzahlung", Withdrawal: "Auszahlung", "Reference No": "Referenznr.", "Matched Type": "Zugeordnete Art", "Matched Doc": "Zugeordneter Beleg", "Start Date": "Startdatum", "End Date": "Enddatum", "Billing Interval": "Abrechnungsintervall", "Current Period Start": "Aktueller Periodenbeginn", "Current Period End": "Aktuelles Periodenende", "Plan Items": "Planpositionen", "Total Amount": "Gesamtbetrag", "Stock Entry Type": "Lagerbuchungsart", "Rate Or Discount": "Preis oder Rabatt", "Discount Percentage": "Rabattprozentsatz", ID: "ID", "Customer Name": "Kundenname", "Customer Group": "Kundengruppe", Territory: "Region", "Credit Limit": "Kreditlimit", Email: "E-Mail", Phone: "Telefon", Address: "Adresse", City: "Stadt", "Zip Code": "PLZ", Country: "Land", "Tax ID": "Steuernummer", "Supplier Name": "Lieferantenname", "Supplier Group": "Lieferantengruppe", "Item Group": "Artikelgruppe", "Stock UOM": "Lagereinheit", "Standard Rate": "Standardpreis", "Warehouse Name": "Lagername", "Company Name": "Firmenname" }, Js = { items: "Positionen", taxes: "Steuern", references: "Zahlungsreferenzen", accounts: "Kontobuchungen", payments: "Zahlungen", plans: "Planpositionen", monthly_distribution: "Monatliche Verteilung" }, Ys = { "Create Sales Order": "Kundenauftrag erstellen", "Create Sales Invoice": "Ausgangsrechnung erstellen", "Create Delivery Note": "Lieferschein erstellen", "Create Purchase Invoice": "Eingangsrechnung erstellen", "Create Purchase Receipt": "Wareneingang erstellen", "Create Credit Note": "Gutschrift erstellen", "Create Debit Note": "Lastschrift erstellen", "Create Return": "Retoure erstellen" }, Zs = { totalRevenue: "Gesamtumsatz", outstandingReceivable: "Offene Forderungen", outstandingPayable: "Offene Verbindlichkeiten", totalStockValue: "Gesamter Lagerwert", recentDocuments: "Letzte Dokumente", noRecentDocuments: "Keine aktuellen Dokumente" }, Xs = { title: "Lambda ERP Chat", subtitle: "Bitten Sie mich, Dokumente zu erstellen, Daten abzurufen oder Berichte auszuführen.", s1: "Welche Kunden haben wir?", s2: "Zeig mir die Rohbilanz", s3: "Erstelle ein Angebot für 10 Bolt Pack M8", s4: "Liste alle unbezahlten Rechnungen auf", loadOlder: "Ältere Nachrichten laden", uploading: "Wird hochgeladen...", failed: "Fehlgeschlagen", remove: "Entfernen", placeholderDemo: "Live-Demo läuft...", placeholderType: "Nachricht eingeben...", placeholderConnecting: "Verbindung wird hergestellt...", attachTitle: "Datei anhängen (PDF oder Bild, max. 10 MB)", creating: "Chat wird erstellt...", dropToAttach: "Datei zum Anhängen ablegen (Bilder oder PDF, je max. 10 MB)", demoError: "Demo konnte nicht gestartet werden" }, ei = /* @__PURE__ */ JSON.parse('{"pageTitle":"Erste Schritte mit Lambda ERP","intro":"Lambda ERP ist ein KI-natives ERP-System, bei dem die gesamte Funktionalität – etwa das Erstellen von Aufträgen, das Prüfen von Beständen und das Erfassen von Zahlungen – über eine Chat-Oberfläche zugänglich ist. Es leitet an, denkt mit und prüft alle Ihre täglichen Geschäftsaufgaben.","openChat":"KI-Chat öffnen","tipLabel":"Tipp:","topTip":"Der KI-Chat kann Ihnen auch direkte Links zu Dokumenten und herunterladbaren PDFs geben. Bitten Sie ihn einfach, ein Dokument zu erstellen oder nachzuschlagen, und er fügt anklickbare Links in seine Antwort ein.","manualIntro":"Wenn Sie genau verstehen möchten, wie die Dinge unter der Haube funktionieren, oder Dinge lieber manuell erledigen, finden Sie hier einen vollständigen Geschäftszyklus Schritt für Schritt.","caTitle":"Dynamische Analysen – Chatten Sie sich zu jedem Diagramm","caBadge":"Kernfunktion","caBody":"Brauchen Sie einen Bericht, den die Vorlagen nicht liefern? Beschreiben Sie ihn einfach im Chat. Der Assistent ruft ein Code-Spezialmodell auf, das den Bericht für Sie schreibt, ihn live über Ihre ERP-Daten ausführt und einen teilbaren Link zurückgibt. Das Diagramm oder die Tabelle wird in Sekunden gerendert und als Entwurf unter „Eigene Analysen“ in der Seitenleiste gespeichert – Sie können ihn erneut öffnen, die URL mit Kollegen teilen oder den Assistenten bitten, ihn zu verfeinern.","caTryAsking":"Versuchen Sie zu fragen (zum Vorausfüllen im Chat klicken):","caPrompt1":"Zeig mir die Top 10 Kunden nach Umsatz dieses Jahr als Balkendiagramm","caPrompt2":"Monatlicher Einkaufstrend nach Lieferant über alle Monate, x-Achse mit Lieferantennamen beschriften","caPrompt3":"Bestseller-Artikel nach Menge, mit Tabelle und Diagramm","caPrompt4":"Welche Kunden schulden mir gerade am meisten?","caTryInChat":"Im Chat ausprobieren","caOpenWorkspace":"Analyse-Arbeitsbereich öffnen","flowTitle":"Überblick Dokumentenfluss","salesCycle":"Verkaufszyklus","purchaseCycle":"Einkaufszyklus","returns":"Retouren","flowShortcut":"Abkürzung: Das Angebot kann den Kundenauftrag überspringen und direkt zur Ausgangsrechnung oder zum Lieferschein führen","legendStock":"Lagerwirkung","legendGl":"Buchungswirkung","legendCash":"Geldwirkung","legendReversal":"Stornierung","lifecycleTitle":"Dokumenten-Lebenszyklus","lcDraftLabel":"Entwurf:","lcDraftDesc":"Bearbeitbar. Keine finanzielle oder Bestandswirkung.","lcSubmittedLabel":"Gebucht:","lcSubmittedDesc":"Gesperrt. Buchungen und Lagerbuchungen werden erzeugt.","lcCancelledLabel":"Storniert:","lcCancelledDesc":"Alle Buchungen storniert. Das Dokument wird dauerhaft archiviert.","lcNoDelete":"Es gibt kein Löschen. Um einen Entwurf zu verwerfen: buchen und dann stornieren.","lcCorrect":"Um ein gebuchtes Dokument zu korrigieren: stornieren und ein neues erstellen.","readyTitle":"Sie sind startklar","readyBody1":"Sie verstehen jetzt den vollständigen Zyklus. Ein typisches Praxisszenario sieht so aus: Sie erhalten einen Kundenauftrag (Angebot → Kundenauftrag), prüfen den Bestand, kaufen, was Sie brauchen (Bestellung → Wareneingang → Eingangsrechnung → Zahlung), liefern an den Kunden (Lieferschein), stellen ihm die Rechnung (Ausgangsrechnung) und ziehen die Zahlung ein (Zahlung). Kommt etwas zurück, erstellen Sie eine Gutschrift und eine Lieferschein-Retoure, um Finanzen und Bestand umzukehren. Die Rohbilanz bestätigt, dass alles ausgeglichen ist.","readyBody2":"Sie können all dies auch über den KI-Chat per natürlicher Konversation erledigen – beschreiben Sie einfach, was Sie brauchen, und er erstellt die richtigen Dokumente für Sie.","chips":{"Quotation":"Angebot","Sales Order":"Kundenauftrag","Delivery Note":"Lieferschein","Sales Invoice":"Ausgangsrechnung","Payment Entry":"Zahlung","Purchase Order":"Bestellung","Purchase Receipt":"Wareneingang","Purchase Invoice":"Eingangsrechnung","Credit Note":"Gutschrift","DN Return":"Lieferschein-Retoure","Debit Note":"Lastschrift","Draft":"Entwurf","Submitted":"Gebucht","Cancelled":"Storniert"},"links":{"Go to Setup":"Zur Einrichtung","Customers":"Kunden","Suppliers":"Lieferanten","Items":"Artikel","Warehouses":"Lager","New Quotation":"Neues Angebot","View Quotations":"Angebote anzeigen","Stock Balance":"Lagerbestand","New Purchase Order":"Neue Bestellung","Purchase Receipts":"Wareneingänge","Purchase Invoices":"Eingangsrechnungen","Delivery Notes":"Lieferscheine","Sales Invoices":"Ausgangsrechnungen","New Payment Entry":"Neue Zahlung","New Stock Entry":"Neue Lagerbuchung","New Journal Entry":"Neuer Buchungssatz","Profit & Loss":"Gewinn- und Verlustrechnung","Balance Sheet":"Bilanz","AR Aging":"Offene Posten Debitoren","AP Aging":"Offene Posten Kreditoren","Trial Balance":"Rohbilanz","General Ledger":"Hauptbuch","Open AI Chat":"KI-Chat öffnen"},"steps":{"1":{"title":"Unternehmen einrichten","description":"Erstellen Sie ein Unternehmen mit einer Basiswährung. Dadurch wird Ihr Kontenplan generiert (30 Standardkonten in den Bereichen Aktiva, Verbindlichkeiten, Eigenkapital, Erträge und Aufwendungen) sowie eine Standard-Kostenstelle. Sie können außerdem Demodaten mit Beispielkunden, -lieferanten und -artikeln anlegen, um schnell loszulegen."},"2":{"title":"Stammdaten anlegen","description":"Bevor Sie buchen können, benötigen Sie Stammdaten. Legen Sie mindestens einen Kunden, einen Lieferanten, einen Artikel (mit Standardpreis) und ein Lager an. Wenn Sie in Schritt 1 Demodaten angelegt haben, existieren diese bereits.","tip":"Artikel haben einen Standardpreis, der beim Hinzufügen zu Dokumenten automatisch ausgefüllt wird. Sie können den Preis pro Transaktion jederzeit überschreiben."},"3":{"title":"Angebot erstellen","description":"Ein Angebot ist eine unverbindliche Offerte an einen Kunden. Wählen Sie einen Kunden, fügen Sie Positionen mit Mengen und Preisen hinzu, optional Steuerzeilen, und speichern Sie. Angebote haben keine finanzielle Auswirkung – sie erzeugen keine Buchungs- oder Lagerbewegungen. Legen Sie ein Gültigkeitsdatum fest, damit das Angebot automatisch abläuft."},"4":{"title":"Buchen und in Kundenauftrag umwandeln","description":"Öffnen Sie Ihr gespeichertes Angebot und klicken Sie auf Buchen, um es zu bestätigen. Klicken Sie dann auf „Kundenauftrag erstellen“, um es umzuwandeln. Der Kundenauftrag stellt eine bestätigte Zusage des Kunden dar. Er hat weiterhin keine finanzielle Auswirkung, reserviert aber Bestand für die Planung.","tip":"Nur gebuchte Dokumente können in den nächsten Schritt umgewandelt werden. Entwurf → Buchen → Umwandeln ist der Standardablauf. Für schnelle Geschäfte können Sie den Kundenauftrag überspringen und direkt vom Angebot zur Ausgangsrechnung oder zum Lieferschein gehen."},"5":{"title":"Bestand vor der Erfüllung prüfen","description":"Bevor Sie liefern können, prüfen Sie, ob der Artikel tatsächlich auf Lager ist. Öffnen Sie den Bericht Lagerbestand und suchen Sie den Artikel. Wenn Ihr Lager eine Menge von null aufweist, müssen Sie zunächst Bestand beschaffen – entweder über eine Bestellung (Einkauf bei einem Lieferanten) oder eine Lagerbuchung (manueller Eingang).","tip":"Dies ist ein häufiges Szenario aus der Praxis: Sie verkaufen etwas und stellen dann fest, dass Sie es erst einkaufen müssen. Das ERP unterstützt beide Abläufe."},"6":{"title":"Einkaufszyklus: Bestand bei einem Lieferanten kaufen","description":"Wenn Sie Bestand einkaufen müssen, haben Sie zwei gültige Wege. Der Standardweg ist Bestellung → Wareneingang → Eingangsrechnung: Nutzen Sie ihn, wenn die Ware vor oder getrennt von der Lieferantenrechnung eintrifft. Treffen Rechnung und Wareneingang gleichzeitig ein, können Sie die Eingangsrechnung direkt erstellen und „Lager aktualisieren“ aktivieren, sodass dasselbe Dokument sowohl den Bestand vereinnahmt als auch die Verbindlichkeit erfasst.","tip":"Verwenden Sie zuerst den Wareneingang, wenn Sie Waren getrennt erhalten. Verwenden Sie die Eingangsrechnung mit „Lager aktualisieren“, wenn ein Schritt sowohl den Bestand vereinnahmen als auch die Lieferantenrechnung buchen soll. Setzen Sie in diesem direkten Weg ein Lager in jeder Bestandszeile."},"7":{"title":"Lieferschein erstellen","description":"Nachdem Sie nun Bestand haben, kehren Sie zu Ihrem gebuchten Kundenauftrag zurück und klicken Sie auf „Lieferschein erstellen“. Setzen Sie in jeder Position das Lager (von dem die Ware versendet wird) und buchen Sie. Dadurch wird Bestand aus dem Lager ausgebucht – Ihr Lagerbestand sinkt.","tip":"Der Lieferschein ist das Versanddokument. Er reduziert den Bestand, erzeugt aber keine Rechnung. Sie können Lieferung und Rechnungsstellung getrennt vornehmen."},"8":{"title":"Ausgangsrechnung erstellen und buchen","description":"Erstellen Sie aus dem gebuchten Kundenauftrag eine Ausgangsrechnung. Beim Buchen der Rechnung werden Buchungen erzeugt: Forderungen aus Lieferungen und Leistungen werden im Soll gebucht (der Kunde schuldet Ihnen Geld) und Umsatzerlöse im Haben (erzielter Ertrag). Sind Steuern konfiguriert, wird auch die Steuerverbindlichkeit im Haben gebucht. Der offene Betrag zeigt, was der Kunde noch schuldet."},"9":{"title":"Kundenzahlungen erfassen","description":"Erstellen Sie eine Zahlung, um vom Kunden erhaltenes Geld zu erfassen. Setzen Sie die Zahlungsart auf „Receive“ (Erhalten), wählen Sie den Kunden, geben Sie den Betrag an und ordnen Sie ihn der Ausgangsrechnung zu. Sie können Teilzahlungen vornehmen – der offene Betrag der Rechnung aktualisiert sich entsprechend. Erstellen Sie weitere Zahlungen, bis die Rechnung vollständig beglichen ist.","tip":"Teilzahlungen sind üblich. Eine Rechnung über 10.000 kann jetzt mit 3.000 und später mit 7.000 bezahlt werden. Jede Zahlung reduziert den offenen Betrag."},"10":{"title":"Lagerbuchungen (manuelle Bestandsführung)","description":"Verwenden Sie Lagerbuchungen für Bestandsbewegungen, die nicht mit Ein- oder Verkäufen verbunden sind. „Material Receipt“ fügt Bestand hinzu (Eröffnungsbestände, Korrekturen). „Material Issue“ bucht Bestand aus (Abschreibungen, interner Verbrauch). „Material Transfer“ verschiebt Bestand zwischen Lägern. Jede Buchung aktualisiert das Lagerbuch mit gleitender Durchschnittsbewertung.","tip":"Verwenden Sie für eingekaufte Waren Wareneingänge statt Lagerbuchungen – sie sind mit der Bestellung verknüpft und bieten einen sauberen Prüfpfad."},"11":{"title":"Buchungssätze","description":"Buchungssätze sind manuelle buchhalterische Anpassungen – Aufwandsabgrenzungen, Korrekturen, Umgliederungen, Eröffnungsbestände. Jeder Satz muss ausgeglichene Soll- und Haben-Beträge haben (Summe Soll = Summe Haben). Verwenden Sie sie, wenn kein anderer Dokumenttyp passt."},"12":{"title":"Gehaltszahlungen","description":"Lambda ERP wickelt Gehälter über die vorhandenen Buchhaltungswerkzeuge ab. Grenzen Sie zunächst den Gehaltsaufwand ab: Erstellen Sie einen Buchungssatz, der Gehaltsaufwand im Soll und Gehaltsverbindlichkeiten im Haben für den gesamten Lohnbetrag bucht. Bezahlen Sie dann die Mitarbeiter: Erstellen Sie einen weiteren Buchungssatz (oder eine Zahlung), der Gehaltsverbindlichkeiten im Soll und Ihr Bankkonto im Haben bucht. Dieser zweistufige Prozess hält Ihre Bücher korrekt – der Aufwand wird in der richtigen Periode erfasst und der Geldabfluss separat nachverfolgt.","tip":"Sie können den KI-Assistenten bitten, dies für Sie zu erledigen: „Grenze 15.000 an Gehältern für April ab“ gefolgt von „Zahle die April-Gehälter von der Bank“. Er erstellt die richtigen Buchungssätze automatisch."},"13":{"title":"Retouren und Gutschriften","description":"Wenn ein Kunde Waren zurückgibt oder Sie eine Gutschrift ausstellen müssen, erstellen Sie eine Retoure. Retouren verwenden denselben Dokumenttyp mit negativen Mengen. Öffnen Sie eine gebuchte Ausgangsrechnung und erstellen Sie eine Gutschrift (Ausgangsrechnungs-Retoure) – dies kehrt die Buchungen um und reduziert den offenen Betrag der ursprünglichen Rechnung. Erstellen Sie für den Bestand eine Lieferschein-Retoure, um Waren zurück ins Lager zu nehmen. Auf der Einkaufsseite erstellen Sie eine Lastschrift (Eingangsrechnungs-Retoure), um eine Lieferantenrechnung umzukehren, oder eine Wareneingangs-Retoure, um Waren zurückzusenden.","tip":"Eine Gutschrift ist einfach eine Ausgangsrechnung mit is_return=1 und negativen Mengen. Dieselbe Buchungslogik läuft – negative Beträge wechseln automatisch auf die richtige Soll-/Haben-Seite. Für eine vollständige Verkaufsretoure benötigen Sie sowohl eine Gutschrift (Finanzen) als auch eine Lieferschein-Retoure (Bestand)."},"14":{"title":"Berichte ausführen","description":"Prüfen Sie Ihre Bücher. Die Gewinn- und Verlustrechnung zeigt Erträge gegenüber Aufwendungen und den Periodengewinn. Die Bilanz zeigt Ihre finanzielle Lage (Aktiva = Verbindlichkeiten + Eigenkapital). Die Offenen Posten Debitoren zeigen, wer Ihnen Geld schuldet und wie überfällig es ist. Die Offenen Posten Kreditoren zeigen, was Sie Lieferanten schulden. Die Rohbilanz überprüft die doppelte Buchführung. Das Hauptbuch zeigt jede einzelne Buchung. Der Lagerbestand zeigt den aktuellen Bestand."},"15":{"title":"Arbeiten in Fremdwährungen","description":"Ihre Bücher werden in einer einzigen Basiswährung geführt (bei der Unternehmenseinrichtung gewählt), aber Sie können in jeder Währung buchen. Setzen Sie eine Währung auf einer Rechnung oder einem Beleg – oder geben Sie einem Kunden oder Lieferanten eine Standardwährung – und der Wechselkurs für dieses Datum wird automatisch ermittelt und auf dem Dokument gespeichert. Das Dokument behält seine Beträge in seiner eigenen Währung, während das Hauptbuch stets in Ihrer Basiswährung bucht. Wenn Sie später zu einem anderen Kurs einnehmen oder zahlen, wird der realisierte Währungsgewinn oder -verlust automatisch auf ein Konto Währungsgewinn/-verlust gebucht. Sie können sogar ein Fremdwährungs-Bankguthaben halten und es später zum Kurs Ihrer Bank umrechnen – die Differenz zum Buchwert wird dann realisiert. Zum Monatsende können Sie offene Fremdwährungssalden zum Stichtagskurs neu bewerten (ein unrealisierter Gewinn/Verlust, der in der nächsten Periode storniert wird), und Sie können jeden Jahresabschluss zur Anzeige in eine andere Währung umgerechnet betrachten.","tip":"Am einfachsten geht das über den KI-Chat – probieren Sie „Erstelle eine Ausgangsrechnung für Lumiere Audio in EUR“, „Zeig mir die Bilanz in EUR“ oder „Wie hoch ist unser unrealisiertes Währungsrisiko zum Monatsende?“. Die Demodaten enthalten bereits einen EUR-Kunden (Lumiere Audio SARL), dessen Rechnung zu einem anderen Kurs eingenommen wurde, sowie eine offene EUR-Lieferantenrechnung – öffnen Sie das Hauptbuch, um die realisierten Währungsbuchungen zu sehen."}}}'), ti = {
|
|
6149
6184
|
common: qs,
|
|
6150
6185
|
language: zs,
|
|
6151
6186
|
header: Fs,
|
|
6152
6187
|
titles: Ms,
|
|
6153
6188
|
doctypes: $s,
|
|
6154
|
-
masters:
|
|
6155
|
-
nav:
|
|
6189
|
+
masters: Us,
|
|
6190
|
+
nav: Vs,
|
|
6156
6191
|
login: Gs,
|
|
6157
6192
|
settings: js,
|
|
6158
6193
|
status: Ws,
|
|
@@ -6245,14 +6280,14 @@ function Ze(t) {
|
|
|
6245
6280
|
return t === 0 ? "$0.00" : t < 0.01 ? `$${t.toFixed(4)}` : `$${t.toFixed(2)}`;
|
|
6246
6281
|
}
|
|
6247
6282
|
function Ci() {
|
|
6248
|
-
var
|
|
6249
|
-
const { t } = Z(), [n, a] =
|
|
6283
|
+
var R, B;
|
|
6284
|
+
const { t } = Z(), [n, a] = S("1h"), { data: s, isLoading: l, isFetching: i, error: c, refetch: o, dataUpdatedAt: m } = le({
|
|
6250
6285
|
queryKey: ["demo-spend"],
|
|
6251
6286
|
queryFn: () => O.getDemoSpend(),
|
|
6252
6287
|
// Refresh once a minute — demo spend changes slowly; no need to poll harder.
|
|
6253
6288
|
refetchInterval: 6e4
|
|
6254
|
-
}), d = Tn.find((C) => C.value === n), u = (
|
|
6255
|
-
return /* @__PURE__ */ r(
|
|
6289
|
+
}), d = Tn.find((C) => C.value === n), u = (R = s == null ? void 0 : s.windows) == null ? void 0 : R[n], p = ((B = s == null ? void 0 : s.caps) == null ? void 0 : B.global_hourly_usd) ?? 0, v = u ? u.demo_usd / d.hours : 0, D = u ? u.total_usd / d.hours : 0, h = p > 0 ? Math.min(100, v / p * 100) : 0, y = h >= 90 ? "bg-red-500" : h >= 60 ? "bg-amber-500" : "bg-emerald-500";
|
|
6290
|
+
return /* @__PURE__ */ r(U, { title: t("settings.demoSpendTitle"), children: [
|
|
6256
6291
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end justify-between gap-4", children: [
|
|
6257
6292
|
/* @__PURE__ */ r("div", { className: "max-w-lg text-sm text-gray-600", children: [
|
|
6258
6293
|
"Token spend from LLM calls in this deployment. Only",
|
|
@@ -6334,17 +6369,17 @@ function Ci() {
|
|
|
6334
6369
|
Ze(u.total_usd),
|
|
6335
6370
|
/* @__PURE__ */ r("span", { className: "ml-1 text-xs font-normal text-gray-500", children: [
|
|
6336
6371
|
"(",
|
|
6337
|
-
Ze(
|
|
6372
|
+
Ze(D),
|
|
6338
6373
|
"/hr)"
|
|
6339
6374
|
] })
|
|
6340
6375
|
] })
|
|
6341
6376
|
] })
|
|
6342
6377
|
] }),
|
|
6343
|
-
/* @__PURE__ */ e("div", { className: "mt-2 h-2 w-full overflow-hidden rounded-full bg-gray-100", children: /* @__PURE__ */ e("div", { className: `h-full ${y} transition-all`, style: { width: `${
|
|
6378
|
+
/* @__PURE__ */ e("div", { className: "mt-2 h-2 w-full overflow-hidden rounded-full bg-gray-100", children: /* @__PURE__ */ e("div", { className: `h-full ${y} transition-all`, style: { width: `${h}%` } }) }),
|
|
6344
6379
|
/* @__PURE__ */ r("div", { className: "mt-1 text-xs text-gray-400", children: [
|
|
6345
|
-
|
|
6380
|
+
h.toFixed(0),
|
|
6346
6381
|
"% of the hourly cap",
|
|
6347
|
-
|
|
6382
|
+
h >= 100 && " — demo visitors are currently blocked"
|
|
6348
6383
|
] })
|
|
6349
6384
|
] }),
|
|
6350
6385
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-4", children: [
|
|
@@ -6405,30 +6440,30 @@ function ft({ label: t, value: n }) {
|
|
|
6405
6440
|
] });
|
|
6406
6441
|
}
|
|
6407
6442
|
function Di() {
|
|
6408
|
-
const { user: t } = mt(), { t: n } = Z(), a = We(), s = (t == null ? void 0 : t.role) === "admin", { data: l, isLoading: i } =
|
|
6443
|
+
const { user: t } = mt(), { t: n } = Z(), a = We(), s = (t == null ? void 0 : t.role) === "admin", { data: l, isLoading: i } = le({
|
|
6409
6444
|
queryKey: ["settings"],
|
|
6410
6445
|
queryFn: () => O.getSettings()
|
|
6411
|
-
}), c =
|
|
6446
|
+
}), c = pe({
|
|
6412
6447
|
mutationFn: (v) => O.updateSettings(v),
|
|
6413
6448
|
onSuccess: () => a.invalidateQueries({ queryKey: ["settings"] })
|
|
6414
|
-
}), { data: o } =
|
|
6449
|
+
}), { data: o } = le({
|
|
6415
6450
|
queryKey: ["public-manager"],
|
|
6416
6451
|
queryFn: () => O.getPublicManagerStatus()
|
|
6417
|
-
}), [m, d] =
|
|
6452
|
+
}), [m, d] = S(!1), u = pe({
|
|
6418
6453
|
mutationFn: () => O.createPublicManager(),
|
|
6419
6454
|
onSuccess: () => {
|
|
6420
6455
|
a.invalidateQueries({ queryKey: ["public-manager"] }), d(!1);
|
|
6421
6456
|
}
|
|
6422
|
-
}), p =
|
|
6457
|
+
}), p = pe({
|
|
6423
6458
|
mutationFn: () => O.removePublicManager(),
|
|
6424
6459
|
onSuccess: () => a.invalidateQueries({ queryKey: ["public-manager"] })
|
|
6425
6460
|
});
|
|
6426
6461
|
return i ? /* @__PURE__ */ e("p", { className: "text-gray-500", children: n("common.loading") }) : /* @__PURE__ */ r("div", { className: "space-y-6", children: [
|
|
6427
|
-
/* @__PURE__ */ r(
|
|
6462
|
+
/* @__PURE__ */ r(U, { title: n("language.title"), children: [
|
|
6428
6463
|
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-end gap-4", children: /* @__PURE__ */ e("div", { className: "w-64", children: /* @__PURE__ */ e(wi, {}) }) }),
|
|
6429
6464
|
/* @__PURE__ */ e("p", { className: "mt-2 text-xs text-gray-400", children: n("language.help") })
|
|
6430
6465
|
] }),
|
|
6431
|
-
/* @__PURE__ */ r(
|
|
6466
|
+
/* @__PURE__ */ r(U, { title: n("settings.pdfTitle"), children: [
|
|
6432
6467
|
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-end gap-4", children: s ? /* @__PURE__ */ e(
|
|
6433
6468
|
Ke,
|
|
6434
6469
|
{
|
|
@@ -6443,7 +6478,7 @@ function Di() {
|
|
|
6443
6478
|
] }) }),
|
|
6444
6479
|
/* @__PURE__ */ e("p", { className: "mt-2 text-xs text-gray-400", children: n("settings.pdfHelp") })
|
|
6445
6480
|
] }),
|
|
6446
|
-
/* @__PURE__ */ e(
|
|
6481
|
+
/* @__PURE__ */ e(U, { title: n("settings.openingTitle"), children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
6447
6482
|
/* @__PURE__ */ r("div", { children: [
|
|
6448
6483
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-700", children: n("settings.openingBody") }),
|
|
6449
6484
|
/* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-400", children: (l == null ? void 0 : l.opening_balances_enabled) === "1" ? n("settings.openingEnabled") : n("settings.openingDisabled") })
|
|
@@ -6459,7 +6494,7 @@ function Di() {
|
|
|
6459
6494
|
}
|
|
6460
6495
|
)
|
|
6461
6496
|
] }) }),
|
|
6462
|
-
s && /* @__PURE__ */ e(
|
|
6497
|
+
s && /* @__PURE__ */ e(U, { title: n("settings.publicTitle"), children: o != null && o.active ? /* @__PURE__ */ r("div", { children: [
|
|
6463
6498
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
6464
6499
|
/* @__PURE__ */ e("span", { className: "inline-block h-2 w-2 rounded-full bg-green-500" }),
|
|
6465
6500
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium text-green-800", children: n("settings.publicActive") })
|
|
@@ -6547,7 +6582,7 @@ const Ti = [
|
|
|
6547
6582
|
{ path: "reports/balance-sheet", element: /* @__PURE__ */ e(zr, {}) },
|
|
6548
6583
|
{ path: "reports/ar-aging", element: /* @__PURE__ */ e(Fr, {}) },
|
|
6549
6584
|
{ path: "reports/ap-aging", element: /* @__PURE__ */ e(Mr, {}) },
|
|
6550
|
-
{ path: "reports/analytics", element: /* @__PURE__ */ e(
|
|
6585
|
+
{ path: "reports/analytics", element: /* @__PURE__ */ e(Vr, {}) },
|
|
6551
6586
|
// Admin
|
|
6552
6587
|
{ path: "admin/users", element: /* @__PURE__ */ e(fs, {}) },
|
|
6553
6588
|
{ path: "admin/settings", element: /* @__PURE__ */ e(Di, {}) }
|