warqadui 0.0.288 → 0.0.290
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/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1054 -662
- package/dist/index.mjs +906 -506
- package/dist/styles.js +21 -0
- package/dist/styles.mjs +21 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -351,7 +351,8 @@ var Enums = {
|
|
|
351
351
|
expenseAccount: ["branch", "account"],
|
|
352
352
|
integrationTypes: ["twilio-whatsapp"],
|
|
353
353
|
postTypes: ["umrah", "hajj", "visa", "hotel"],
|
|
354
|
-
postStatus: ["draft", "published", "archived"]
|
|
354
|
+
postStatus: ["draft", "published", "archived"],
|
|
355
|
+
collectionTypes: ["collected", "pending"]
|
|
355
356
|
};
|
|
356
357
|
var Enums_default = Enums;
|
|
357
358
|
|
|
@@ -1235,6 +1236,7 @@ var DashboardLayout = ({
|
|
|
1235
1236
|
title = "Dashboard",
|
|
1236
1237
|
logo,
|
|
1237
1238
|
userProfile,
|
|
1239
|
+
posIcon,
|
|
1238
1240
|
fontFamily = 'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
1239
1241
|
// Humanist System Stack
|
|
1240
1242
|
sidebarFooter
|
|
@@ -1432,10 +1434,16 @@ var DashboardLayout = ({
|
|
|
1432
1434
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Menu, { size: 20 })
|
|
1433
1435
|
}
|
|
1434
1436
|
) }),
|
|
1435
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1436
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1437
|
-
|
|
1438
|
-
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1438
|
+
posIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
|
|
1440
|
+
posIcon
|
|
1441
|
+
] }),
|
|
1442
|
+
userProfile && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
|
|
1444
|
+
userProfile
|
|
1445
|
+
] })
|
|
1446
|
+
] })
|
|
1439
1447
|
] }),
|
|
1440
1448
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("main", { className: "flex-1 overflow-y-auto", children: [
|
|
1441
1449
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sticky top-0 z-20 py-4 px-4 md:px-4 bg-gray-50/95 dark:bg-gray-900/80 backdrop-blur-sm border-b border-gray-200/50 dark:border-white/5 mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Breadcrumbs, {}) }),
|
|
@@ -2340,7 +2348,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
|
|
|
2340
2348
|
enumName,
|
|
2341
2349
|
...rest
|
|
2342
2350
|
} = props;
|
|
2343
|
-
const
|
|
2351
|
+
const options11 = (0, import_react15.useMemo)(() => {
|
|
2344
2352
|
if (initialOptions.length > 0) return initialOptions;
|
|
2345
2353
|
const targetEnum = enumData || (enumName ? enums[enumName] : void 0);
|
|
2346
2354
|
if (targetEnum) {
|
|
@@ -2376,7 +2384,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
|
|
|
2376
2384
|
SelectRoot,
|
|
2377
2385
|
{
|
|
2378
2386
|
...rest,
|
|
2379
|
-
options:
|
|
2387
|
+
options: options11,
|
|
2380
2388
|
currentValue: formValue,
|
|
2381
2389
|
onChangeHandler: (val) => {
|
|
2382
2390
|
formOnChange(val);
|
|
@@ -2393,7 +2401,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
|
|
|
2393
2401
|
SelectRoot,
|
|
2394
2402
|
{
|
|
2395
2403
|
...rest,
|
|
2396
|
-
options:
|
|
2404
|
+
options: options11,
|
|
2397
2405
|
currentValue: value,
|
|
2398
2406
|
onChangeHandler: onChange || (() => {
|
|
2399
2407
|
}),
|
|
@@ -2579,12 +2587,12 @@ var SelectTrigger = (0, import_react15.forwardRef)(
|
|
|
2579
2587
|
dropdownContentRef,
|
|
2580
2588
|
containerRef,
|
|
2581
2589
|
selectedValue,
|
|
2582
|
-
options:
|
|
2590
|
+
options: options11,
|
|
2583
2591
|
fieldInternalProps,
|
|
2584
2592
|
disabled
|
|
2585
2593
|
} = useSelectContext();
|
|
2586
2594
|
const lastFocusTime = (0, import_react15.useRef)(0);
|
|
2587
|
-
const displayOption =
|
|
2595
|
+
const displayOption = options11.find((o) => o.value === selectedValue);
|
|
2588
2596
|
const displayValue = displayOption ? displayOption.label : selectedValue != null && selectedValue !== "" ? String(selectedValue) : placeholder;
|
|
2589
2597
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2590
2598
|
"div",
|
|
@@ -3018,7 +3026,7 @@ var SearchApiRoot = ({
|
|
|
3018
3026
|
const [searchTerm, setSearchTerm] = (0, import_react17.useState)("");
|
|
3019
3027
|
const { theme } = useWarqadConfig();
|
|
3020
3028
|
const primaryColor = theme?.primaryColor;
|
|
3021
|
-
const [
|
|
3029
|
+
const [options11, setOptions] = (0, import_react17.useState)([]);
|
|
3022
3030
|
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
3023
3031
|
const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
|
|
3024
3032
|
const [activeIndex, setActiveIndex] = (0, import_react17.useState)(-1);
|
|
@@ -3070,7 +3078,7 @@ var SearchApiRoot = ({
|
|
|
3070
3078
|
return () => clearTimeout(timer);
|
|
3071
3079
|
}, [searchTerm, api, isOpen]);
|
|
3072
3080
|
(0, import_react17.useEffect)(() => {
|
|
3073
|
-
if (isOpen &&
|
|
3081
|
+
if (isOpen && options11.length === 0) {
|
|
3074
3082
|
fetchOptions("");
|
|
3075
3083
|
}
|
|
3076
3084
|
}, [isOpen]);
|
|
@@ -3101,8 +3109,8 @@ var SearchApiRoot = ({
|
|
|
3101
3109
|
return option[valueKey];
|
|
3102
3110
|
};
|
|
3103
3111
|
(0, import_react17.useEffect)(() => {
|
|
3104
|
-
if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject &&
|
|
3105
|
-
const found =
|
|
3112
|
+
if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject && options11.length > 0) {
|
|
3113
|
+
const found = options11.find((o) => getOptionValue(o) === currentValue);
|
|
3106
3114
|
if (found) {
|
|
3107
3115
|
setSelectedObject(found);
|
|
3108
3116
|
if (form && obj) {
|
|
@@ -3113,7 +3121,7 @@ var SearchApiRoot = ({
|
|
|
3113
3121
|
}
|
|
3114
3122
|
}
|
|
3115
3123
|
}
|
|
3116
|
-
}, [currentValue,
|
|
3124
|
+
}, [currentValue, options11, obj]);
|
|
3117
3125
|
(0, import_react17.useEffect)(() => {
|
|
3118
3126
|
if (prevApiRef.current !== api) {
|
|
3119
3127
|
prevApiRef.current = api;
|
|
@@ -3158,8 +3166,8 @@ var SearchApiRoot = ({
|
|
|
3158
3166
|
}, [fieldInternalProps]);
|
|
3159
3167
|
const getDisplayValue = () => {
|
|
3160
3168
|
if (selectedObject) return selectedObject[labelKey];
|
|
3161
|
-
if (
|
|
3162
|
-
const found =
|
|
3169
|
+
if (options11.length > 0 && currentValue !== void 0 && currentValue !== null && currentValue !== "") {
|
|
3170
|
+
const found = options11.find((o) => getOptionValue(o) === currentValue);
|
|
3163
3171
|
if (found) return found[labelKey];
|
|
3164
3172
|
}
|
|
3165
3173
|
if (isLoading || currentValue !== void 0 && currentValue !== null && currentValue !== "" && !hasAttemptedHydration)
|
|
@@ -3203,7 +3211,7 @@ var SearchApiRoot = ({
|
|
|
3203
3211
|
setSearchTerm("");
|
|
3204
3212
|
if (onClear) onClear();
|
|
3205
3213
|
};
|
|
3206
|
-
const filteredOptions =
|
|
3214
|
+
const filteredOptions = options11.filter(
|
|
3207
3215
|
(option) => !filter.includes(getOptionValue(option))
|
|
3208
3216
|
);
|
|
3209
3217
|
let message92 = error || errorMessage;
|
|
@@ -3368,7 +3376,7 @@ var SearchApiInput = (0, import_react17.forwardRef)(
|
|
|
3368
3376
|
variant,
|
|
3369
3377
|
activeIndex,
|
|
3370
3378
|
setActiveIndex,
|
|
3371
|
-
options:
|
|
3379
|
+
options: options11,
|
|
3372
3380
|
handleSelect,
|
|
3373
3381
|
clearSelection,
|
|
3374
3382
|
inputRef,
|
|
@@ -3400,7 +3408,7 @@ var SearchApiInput = (0, import_react17.forwardRef)(
|
|
|
3400
3408
|
e.preventDefault();
|
|
3401
3409
|
e.stopPropagation();
|
|
3402
3410
|
setActiveIndex(
|
|
3403
|
-
activeIndex <
|
|
3411
|
+
activeIndex < options11.length - 1 ? activeIndex + 1 : activeIndex
|
|
3404
3412
|
);
|
|
3405
3413
|
break;
|
|
3406
3414
|
case "ArrowUp":
|
|
@@ -3411,8 +3419,8 @@ var SearchApiInput = (0, import_react17.forwardRef)(
|
|
|
3411
3419
|
case "Enter":
|
|
3412
3420
|
e.preventDefault();
|
|
3413
3421
|
e.stopPropagation();
|
|
3414
|
-
if (activeIndex >= 0 && activeIndex <
|
|
3415
|
-
handleSelect(
|
|
3422
|
+
if (activeIndex >= 0 && activeIndex < options11.length)
|
|
3423
|
+
handleSelect(options11[activeIndex]);
|
|
3416
3424
|
break;
|
|
3417
3425
|
case "Escape":
|
|
3418
3426
|
e.preventDefault();
|
|
@@ -3488,7 +3496,7 @@ var SearchApiContent = (0, import_react17.forwardRef)(
|
|
|
3488
3496
|
dropdownContentRef,
|
|
3489
3497
|
isLoading,
|
|
3490
3498
|
searchTerm,
|
|
3491
|
-
options:
|
|
3499
|
+
options: options11,
|
|
3492
3500
|
error
|
|
3493
3501
|
} = useSearchApiContext();
|
|
3494
3502
|
const [dropdownStyle, setDropdownStyle] = (0, import_react17.useState)({});
|
|
@@ -3528,7 +3536,7 @@ var SearchApiContent = (0, import_react17.forwardRef)(
|
|
|
3528
3536
|
...props,
|
|
3529
3537
|
children: [
|
|
3530
3538
|
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 border-b border-gray-100 dark:border-zinc-800", children: error }),
|
|
3531
|
-
isLoading &&
|
|
3539
|
+
isLoading && options11.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-4 text-center text-sm text-gray-500", children: [
|
|
3532
3540
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Loader2, { className: "h-5 w-5 animate-spin mx-auto mb-2" }),
|
|
3533
3541
|
"Loading options..."
|
|
3534
3542
|
] }) : children ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "py-1", children }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-4 text-center text-sm text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
@@ -7570,13 +7578,13 @@ var import_moment = __toESM(require("moment"));
|
|
|
7570
7578
|
var import_react_to_print3 = require("react-to-print");
|
|
7571
7579
|
|
|
7572
7580
|
// src/utils/Formats.tsx
|
|
7573
|
-
function Price(price, currency = "USD", round2 = true,
|
|
7581
|
+
function Price(price, currency = "USD", round2 = true, options11) {
|
|
7574
7582
|
const num = Number(price);
|
|
7575
7583
|
const decimalPlaces = round2 ? 0 : Math.min(num.toString().split(".")[1]?.length ?? 0, 2);
|
|
7576
7584
|
const formatted = new Intl.NumberFormat("en-US", {
|
|
7577
7585
|
minimumFractionDigits: decimalPlaces,
|
|
7578
7586
|
maximumFractionDigits: decimalPlaces,
|
|
7579
|
-
...
|
|
7587
|
+
...options11
|
|
7580
7588
|
}).format(num);
|
|
7581
7589
|
return `${formatted} ${currency}`;
|
|
7582
7590
|
}
|
|
@@ -8082,7 +8090,7 @@ var useTransaction_default = useTransaction;
|
|
|
8082
8090
|
// src/utils/pdf.ts
|
|
8083
8091
|
var import_html2canvas_pro = __toESM(require("html2canvas-pro"));
|
|
8084
8092
|
var import_jspdf = require("jspdf");
|
|
8085
|
-
var generatePdf = async (elementId,
|
|
8093
|
+
var generatePdf = async (elementId, options11 = {}) => {
|
|
8086
8094
|
const {
|
|
8087
8095
|
orientation = "landscape",
|
|
8088
8096
|
unit = "mm",
|
|
@@ -8092,7 +8100,7 @@ var generatePdf = async (elementId, options10 = {}) => {
|
|
|
8092
8100
|
windowWidth = 1200,
|
|
8093
8101
|
scale = 1,
|
|
8094
8102
|
showPageNumbers = true
|
|
8095
|
-
} =
|
|
8103
|
+
} = options11;
|
|
8096
8104
|
const element = document.getElementById(elementId);
|
|
8097
8105
|
if (!element) {
|
|
8098
8106
|
console.error(
|
|
@@ -29731,7 +29739,7 @@ var StatusFilter = ({
|
|
|
29731
29739
|
value,
|
|
29732
29740
|
onChange
|
|
29733
29741
|
}) => {
|
|
29734
|
-
const
|
|
29742
|
+
const options11 = type === "rent" ? [
|
|
29735
29743
|
{ label: "All", value: "all", dotColor: "bg-slate-400" },
|
|
29736
29744
|
{ label: "Vacant", value: "vacant", dotColor: "bg-[#22c55e]" },
|
|
29737
29745
|
{ label: "Occupied", value: "occupied", dotColor: "bg-[#ef4444]" }
|
|
@@ -29741,7 +29749,7 @@ var StatusFilter = ({
|
|
|
29741
29749
|
{ label: "Booked", value: "booked", dotColor: "bg-[#3b82f6]" },
|
|
29742
29750
|
{ label: "Sold", value: "sold", dotColor: "bg-[#ef4444]" }
|
|
29743
29751
|
];
|
|
29744
|
-
return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex gap-1 p-1 bg-slate-100 dark:bg-slate-800/80 rounded-lg border border-slate-200/50 dark:border-slate-700/60", children:
|
|
29752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex gap-1 p-1 bg-slate-100 dark:bg-slate-800/80 rounded-lg border border-slate-200/50 dark:border-slate-700/60", children: options11.map((opt) => {
|
|
29745
29753
|
const isActive = value === opt.value;
|
|
29746
29754
|
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
|
|
29747
29755
|
"button",
|
|
@@ -46301,7 +46309,8 @@ var AdjustmentStockSchema5 = import_zod117.default.object({
|
|
|
46301
46309
|
cash: import_zod117.default.coerce.number(),
|
|
46302
46310
|
credit: import_zod117.default.coerce.number(),
|
|
46303
46311
|
discount: import_zod117.default.coerce.number(),
|
|
46304
|
-
currency: import_zod117.default.enum(Enums_default.currencies)
|
|
46312
|
+
currency: import_zod117.default.enum(Enums_default.currencies),
|
|
46313
|
+
collection: import_zod117.default.enum(Enums_default.collectionTypes)
|
|
46305
46314
|
});
|
|
46306
46315
|
var schema_default7 = AdjustmentStockSchema5;
|
|
46307
46316
|
|
|
@@ -46384,13 +46393,13 @@ var CompleteSaleModal2 = ({
|
|
|
46384
46393
|
] }),
|
|
46385
46394
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
|
|
46386
46395
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
46387
|
-
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount &
|
|
46396
|
+
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount, Rate & Collection" }),
|
|
46388
46397
|
(discount > 0 || isRate) && /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-xs px-2 py-0.5 bg-amber-50 text-amber-600 rounded-full font-medium dark:bg-amber-950/40 dark:text-amber-400", children: discount > 0 ? "Applied" : "Exchange Rate Required" })
|
|
46389
46398
|
] }),
|
|
46390
46399
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)(
|
|
46391
46400
|
"div",
|
|
46392
46401
|
{
|
|
46393
|
-
className: isRate ? "grid grid-cols-1 md:grid-cols-
|
|
46402
|
+
className: isRate ? "grid grid-cols-1 md:grid-cols-3 gap-4" : "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
46394
46403
|
children: [
|
|
46395
46404
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
|
|
46396
46405
|
Fields_default.Input,
|
|
@@ -46413,6 +46422,17 @@ var CompleteSaleModal2 = ({
|
|
|
46413
46422
|
type: "number",
|
|
46414
46423
|
className: "h-[40px]!"
|
|
46415
46424
|
}
|
|
46425
|
+
),
|
|
46426
|
+
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
|
|
46427
|
+
Fields_default.Select,
|
|
46428
|
+
{
|
|
46429
|
+
label: "Collection",
|
|
46430
|
+
name: "collection",
|
|
46431
|
+
form,
|
|
46432
|
+
enumName: "collectionTypes",
|
|
46433
|
+
required: true,
|
|
46434
|
+
className: "h-[40px]!"
|
|
46435
|
+
}
|
|
46416
46436
|
)
|
|
46417
46437
|
]
|
|
46418
46438
|
}
|
|
@@ -46451,7 +46471,7 @@ var CompleteSaleModal2 = ({
|
|
|
46451
46471
|
] }),
|
|
46452
46472
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
|
|
46453
46473
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
46454
|
-
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "
|
|
46474
|
+
/* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "3. Credit Payment" }),
|
|
46455
46475
|
credit > 0 && /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-xs px-2 py-0.5 bg-red-50 text-red-600 rounded-full font-medium dark:bg-red-950/40 dark:text-red-400", children: "Active" })
|
|
46456
46476
|
] }),
|
|
46457
46477
|
/* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
@@ -46575,7 +46595,8 @@ var Sale2Form2 = ({
|
|
|
46575
46595
|
cash: 0,
|
|
46576
46596
|
credit: 0,
|
|
46577
46597
|
discount: 0,
|
|
46578
|
-
invoiceNumber: ""
|
|
46598
|
+
invoiceNumber: "",
|
|
46599
|
+
collection: "collected"
|
|
46579
46600
|
}
|
|
46580
46601
|
});
|
|
46581
46602
|
const { handleSubmit, watch, setValue } = methods;
|
|
@@ -46652,7 +46673,8 @@ var Sale2Form2 = ({
|
|
|
46652
46673
|
cash: cashVal,
|
|
46653
46674
|
credit: creditVal,
|
|
46654
46675
|
discount: discountVal,
|
|
46655
|
-
invoiceNumber: data.invoiceNumber || void 0
|
|
46676
|
+
invoiceNumber: data.invoiceNumber || void 0,
|
|
46677
|
+
collection: data.collection
|
|
46656
46678
|
};
|
|
46657
46679
|
try {
|
|
46658
46680
|
await post({
|
|
@@ -46720,6 +46742,7 @@ var Sale2Form2 = ({
|
|
|
46720
46742
|
setValue("discount", datas.discount || 0);
|
|
46721
46743
|
setValue("invoiceNumber", datas.invoiceNumber || "");
|
|
46722
46744
|
setValue("currency", datas?.currency);
|
|
46745
|
+
setValue("collection", datas?.collection);
|
|
46723
46746
|
setTimeout(() => {
|
|
46724
46747
|
setValue("rate", datas?.rate);
|
|
46725
46748
|
setValue("wallet", datas?.toWalletData?._id);
|
|
@@ -46860,44 +46883,40 @@ function getStorageType5(type, branch) {
|
|
|
46860
46883
|
}
|
|
46861
46884
|
var pos_default5 = Sale2Form2;
|
|
46862
46885
|
|
|
46863
|
-
// src/components/Transactions/3/sale2/
|
|
46864
|
-
var
|
|
46865
|
-
List: List_default6,
|
|
46866
|
-
Form: pos_default5
|
|
46867
|
-
};
|
|
46868
|
-
var sale2_default2 = Sale22;
|
|
46869
|
-
|
|
46870
|
-
// src/components/Transactions/3/purchase3/List.tsx
|
|
46886
|
+
// src/components/Transactions/3/sale2/Collection.tsx
|
|
46887
|
+
var import_react156 = require("react");
|
|
46871
46888
|
var import_react_router_dom120 = require("react-router-dom");
|
|
46872
46889
|
var import_lucide_react123 = require("lucide-react");
|
|
46873
46890
|
var import_jsx_runtime258 = require("react/jsx-runtime");
|
|
46874
|
-
function
|
|
46891
|
+
function Collection3({
|
|
46875
46892
|
url,
|
|
46876
46893
|
type = "product"
|
|
46877
46894
|
}) {
|
|
46878
46895
|
const { branchId } = (0, import_react_router_dom120.useParams)();
|
|
46879
46896
|
const navigate = (0, import_react_router_dom120.useNavigate)();
|
|
46897
|
+
const { currencies } = useWarqadConfig();
|
|
46898
|
+
const { defaultCurrency } = currencies;
|
|
46880
46899
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
46881
46900
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
46882
|
-
url: url || `/transactions/get?type=stock&stock=
|
|
46883
|
-
dateFilter:
|
|
46901
|
+
url: url || `/transactions/get?type=stock&stock=sale-3&stockType=${type}&collection=pending${branchId ? `&fromBranch=${branchId}` : ""}`,
|
|
46902
|
+
dateFilter: false
|
|
46884
46903
|
});
|
|
46885
46904
|
const { Modal: Modal2 } = useModal();
|
|
46886
46905
|
const { PosPrinter } = usePosPrinter_default();
|
|
46887
46906
|
const items = (data2) => [
|
|
46888
46907
|
{
|
|
46889
|
-
label: `View Stock
|
|
46908
|
+
label: `View Stock Sale`,
|
|
46890
46909
|
icon: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Eye, { size: 16 }),
|
|
46891
46910
|
className: "w-[200px]",
|
|
46892
46911
|
onClick: () => openTransaction({ id: data2?._id, type: "stock" })
|
|
46893
46912
|
},
|
|
46894
46913
|
{
|
|
46895
|
-
label: `Edit Stock
|
|
46914
|
+
label: `Edit Stock Sale`,
|
|
46896
46915
|
icon: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.FilePenLine, { size: 16 }),
|
|
46897
46916
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
46898
46917
|
},
|
|
46899
46918
|
{
|
|
46900
|
-
label: `Delete Stock
|
|
46919
|
+
label: `Delete Stock Sale`,
|
|
46901
46920
|
icon: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Trash2, { className: "text-red-500", size: 16 }),
|
|
46902
46921
|
onClick: () => {
|
|
46903
46922
|
openTransaction({
|
|
@@ -46937,11 +46956,11 @@ function purchase3List({
|
|
|
46937
46956
|
}
|
|
46938
46957
|
},
|
|
46939
46958
|
{
|
|
46940
|
-
accessorKey: "
|
|
46941
|
-
header: "
|
|
46959
|
+
accessorKey: "customer/wallet",
|
|
46960
|
+
header: "Customer/Wallet",
|
|
46942
46961
|
cell: ({ row }) => {
|
|
46943
46962
|
const stock = row.original;
|
|
46944
|
-
const walletName = stock?.
|
|
46963
|
+
const walletName = stock?.toWalletData?.name;
|
|
46945
46964
|
const accountName = stock?.accountData?.name || stock?.accountName;
|
|
46946
46965
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
46947
46966
|
stock?.cash > 0 && walletName && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
@@ -46950,11 +46969,11 @@ function purchase3List({
|
|
|
46950
46969
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: walletName })
|
|
46951
46970
|
] }),
|
|
46952
46971
|
stock?.credit > 0 && accountName && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
46953
|
-
"
|
|
46972
|
+
"Customer:",
|
|
46954
46973
|
" ",
|
|
46955
46974
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: accountName })
|
|
46956
46975
|
] }),
|
|
46957
|
-
!(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { children: stock?.
|
|
46976
|
+
!(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { children: stock?.sale === "cash" ? walletName || "Cash Wallet" : accountName || "Customer" })
|
|
46958
46977
|
] });
|
|
46959
46978
|
}
|
|
46960
46979
|
},
|
|
@@ -46971,25 +46990,33 @@ function purchase3List({
|
|
|
46971
46990
|
header: "Action",
|
|
46972
46991
|
cell: ({ row }) => {
|
|
46973
46992
|
const stock = row.original;
|
|
46974
|
-
const
|
|
46993
|
+
const saleType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.sale;
|
|
46975
46994
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex flex-col", children: [
|
|
46976
|
-
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: `capitalize text-red-600`, children: "Stock
|
|
46977
|
-
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "capitalize", children:
|
|
46995
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: `capitalize text-red-600`, children: "Stock Sold" }),
|
|
46996
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "capitalize", children: saleType })
|
|
46978
46997
|
] });
|
|
46979
46998
|
}
|
|
46980
46999
|
},
|
|
46981
47000
|
{
|
|
46982
47001
|
accessorKey: "amount",
|
|
46983
|
-
header: "Amount",
|
|
47002
|
+
header: "Amount (USD)",
|
|
46984
47003
|
cell: ({ row }) => {
|
|
46985
47004
|
const stock = row.original;
|
|
46986
|
-
const
|
|
47005
|
+
const isUSD = (stock?.currency || "").toUpperCase() === "USD";
|
|
47006
|
+
const netAmount = (Number(stock?.amount) || 0) - (Number(stock?.discount) || 0);
|
|
47007
|
+
const usdAmount = !isUSD && stock?.exchange?.amount !== void 0 ? Number(stock.exchange.amount) : netAmount;
|
|
46987
47008
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex flex-col", children: [
|
|
46988
|
-
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold", children: Formats_default.Price(
|
|
46989
|
-
|
|
47009
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold", children: Formats_default.Price(usdAmount, "USD", false) }),
|
|
47010
|
+
!isUSD && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47011
|
+
"Original: ",
|
|
47012
|
+
Formats_default.Price(netAmount, stock?.currency, false),
|
|
47013
|
+
stock?.exchange?.rate ? ` @ ${stock.exchange.rate}` : ""
|
|
47014
|
+
] }),
|
|
47015
|
+
isUSD && stock?.discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-red-600", children: [
|
|
46990
47016
|
"Original:",
|
|
47017
|
+
" ",
|
|
46991
47018
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("del", { children: Formats_default.Price(stock?.amount, stock?.currency, false) })
|
|
46992
|
-
] })
|
|
47019
|
+
] })
|
|
46993
47020
|
] });
|
|
46994
47021
|
}
|
|
46995
47022
|
},
|
|
@@ -47011,11 +47038,374 @@ function purchase3List({
|
|
|
47011
47038
|
}
|
|
47012
47039
|
];
|
|
47013
47040
|
const stocks = data?.data || [];
|
|
47041
|
+
const stats = (0, import_react156.useMemo)(() => {
|
|
47042
|
+
const totalInvoices = stocks.length;
|
|
47043
|
+
let totalPendingUSD = 0;
|
|
47044
|
+
let totalCashUSD = 0;
|
|
47045
|
+
let totalCreditUSD = 0;
|
|
47046
|
+
stocks.forEach((item) => {
|
|
47047
|
+
const isUSD = (item?.currency || "").toUpperCase() === "USD";
|
|
47048
|
+
const netAmount = (Number(item?.amount) || 0) - (Number(item?.discount) || 0);
|
|
47049
|
+
let itemUsdAmount = netAmount;
|
|
47050
|
+
if (!isUSD && item?.exchange?.amount !== void 0) {
|
|
47051
|
+
itemUsdAmount = Number(item.exchange.amount) || 0;
|
|
47052
|
+
}
|
|
47053
|
+
totalPendingUSD += itemUsdAmount;
|
|
47054
|
+
if (isUSD) {
|
|
47055
|
+
totalCashUSD += Number(item?.cash) || 0;
|
|
47056
|
+
totalCreditUSD += Number(item?.credit) || 0;
|
|
47057
|
+
} else {
|
|
47058
|
+
const cashRatio = netAmount > 0 ? (Number(item?.cash) || 0) / netAmount : 0;
|
|
47059
|
+
const creditRatio = netAmount > 0 ? (Number(item?.credit) || 0) / netAmount : 0;
|
|
47060
|
+
totalCashUSD += itemUsdAmount * cashRatio;
|
|
47061
|
+
totalCreditUSD += itemUsdAmount * creditRatio;
|
|
47062
|
+
}
|
|
47063
|
+
});
|
|
47064
|
+
return {
|
|
47065
|
+
totalInvoices,
|
|
47066
|
+
totalPendingUSD,
|
|
47067
|
+
totalCashUSD,
|
|
47068
|
+
totalCreditUSD
|
|
47069
|
+
};
|
|
47070
|
+
}, [stocks]);
|
|
47014
47071
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)(import_jsx_runtime258.Fragment, { children: [
|
|
47015
47072
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)(TransactionView, {}),
|
|
47016
47073
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)(Modal2, {}),
|
|
47017
47074
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)(PosPrinter, {}),
|
|
47075
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("header", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-6", children: [
|
|
47076
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "bg-white dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 rounded-2xl p-5 shadow-xs flex items-center justify-between transition-all hover:shadow-md", children: [
|
|
47077
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "space-y-1", children: [
|
|
47078
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
47079
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "Pending Invoices" }),
|
|
47080
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "px-2 py-0.5 text-[10px] font-bold bg-amber-50 text-amber-700 dark:bg-amber-950/60 dark:text-amber-400 border border-amber-200/60 dark:border-amber-900/40 rounded-full", children: "Waiting" })
|
|
47081
|
+
] }),
|
|
47082
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("h3", { className: "text-3xl font-black text-zinc-900 dark:text-white", children: stats.totalInvoices }),
|
|
47083
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: [
|
|
47084
|
+
stats.totalInvoices === 1 ? "1 invoice" : `${stats.totalInvoices} invoices`,
|
|
47085
|
+
" ",
|
|
47086
|
+
"awaiting collection"
|
|
47087
|
+
] })
|
|
47088
|
+
] }),
|
|
47089
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { className: "p-3.5 rounded-2xl bg-amber-50 dark:bg-amber-950/40 text-amber-600 dark:text-amber-400 border border-amber-100 dark:border-amber-900/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Clock, { size: 24 }) })
|
|
47090
|
+
] }),
|
|
47091
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "bg-white dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 rounded-2xl p-5 shadow-xs flex items-center justify-between transition-all hover:shadow-md", children: [
|
|
47092
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "space-y-1", children: [
|
|
47093
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
47094
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "To Be Collected (USD)" }),
|
|
47095
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "px-2 py-0.5 text-[10px] font-bold bg-emerald-50 text-emerald-700 dark:bg-emerald-950/60 dark:text-emerald-400 border border-emerald-200/60 dark:border-emerald-900/40 rounded-full", children: "USD" })
|
|
47096
|
+
] }),
|
|
47097
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("h3", { className: "text-3xl font-black text-emerald-600 dark:text-emerald-400", children: Formats_default.Price(stats.totalPendingUSD, "USD", false) }),
|
|
47098
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: "Total sales waiting for collection (USD)" })
|
|
47099
|
+
] }),
|
|
47100
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { className: "p-3.5 rounded-2xl bg-emerald-50 dark:bg-emerald-950/40 text-emerald-600 dark:text-emerald-400 border border-emerald-100 dark:border-emerald-900/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.CircleDollarSign, { size: 24 }) })
|
|
47101
|
+
] }),
|
|
47102
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "bg-white dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 rounded-2xl p-5 shadow-xs flex items-center justify-between transition-all hover:shadow-md", children: [
|
|
47103
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "space-y-2 w-full pr-3", children: [
|
|
47104
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "Payment Breakdown (USD)" }),
|
|
47105
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
|
|
47106
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-zinc-500 dark:text-zinc-400 flex items-center gap-1.5", children: [
|
|
47107
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "h-2 w-2 rounded-full bg-blue-500" }),
|
|
47108
|
+
"Cash:"
|
|
47109
|
+
] }),
|
|
47110
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-bold text-blue-600 dark:text-blue-400", children: Formats_default.Price(stats.totalCashUSD, "USD", false) })
|
|
47111
|
+
] }),
|
|
47112
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
|
|
47113
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-zinc-500 dark:text-zinc-400 flex items-center gap-1.5", children: [
|
|
47114
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "h-2 w-2 rounded-full bg-red-500" }),
|
|
47115
|
+
"Credit:"
|
|
47116
|
+
] }),
|
|
47117
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-bold text-red-500 dark:text-red-400", children: Formats_default.Price(stats.totalCreditUSD, "USD", false) })
|
|
47118
|
+
] })
|
|
47119
|
+
] }),
|
|
47120
|
+
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { className: "p-3.5 rounded-2xl bg-blue-50 dark:bg-blue-950/40 text-blue-600 dark:text-blue-400 border border-blue-100 dark:border-blue-900/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Wallet, { size: 24 }) })
|
|
47121
|
+
] })
|
|
47122
|
+
] }),
|
|
47018
47123
|
/* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
|
|
47124
|
+
TransactionViewComponent,
|
|
47125
|
+
{
|
|
47126
|
+
columns,
|
|
47127
|
+
data: stocks,
|
|
47128
|
+
title: `${type} Sales (Pending Collection)`,
|
|
47129
|
+
description: `Manage ${type} sales waiting for collection`,
|
|
47130
|
+
index: true
|
|
47131
|
+
},
|
|
47132
|
+
type
|
|
47133
|
+
)
|
|
47134
|
+
] });
|
|
47135
|
+
}
|
|
47136
|
+
var Collection_default = Collection3;
|
|
47137
|
+
|
|
47138
|
+
// src/components/Transactions/3/sale2/CollectionLevel.tsx
|
|
47139
|
+
var import_react_router_dom121 = require("react-router-dom");
|
|
47140
|
+
var import_jsx_runtime259 = require("react/jsx-runtime");
|
|
47141
|
+
var options9 = [
|
|
47142
|
+
{ label: "Product", value: "product" },
|
|
47143
|
+
{ label: "Pack", value: "pack" }
|
|
47144
|
+
];
|
|
47145
|
+
var CollectionLevel = ({
|
|
47146
|
+
value = false,
|
|
47147
|
+
showYard = false
|
|
47148
|
+
}) => {
|
|
47149
|
+
const { apiConfig, currencies } = useWarqadConfig();
|
|
47150
|
+
const { stock } = currencies;
|
|
47151
|
+
const { branchId } = (0, import_react_router_dom121.useParams)();
|
|
47152
|
+
const { branches } = useAuth_default();
|
|
47153
|
+
const { TransactionView } = useTransactionView_default();
|
|
47154
|
+
const { getQuery, setQuery } = useApp_default();
|
|
47155
|
+
const stockType = getQuery("stockType") || "product";
|
|
47156
|
+
const { A4DataView, data } = useA4DataView_default({
|
|
47157
|
+
url: `${apiConfig.stockLevelReportApi}?stockType=${stockType}&collection=pending${branchId ? `&branch=${branchId}` : ""}`,
|
|
47158
|
+
v: 1,
|
|
47159
|
+
// No prefix
|
|
47160
|
+
params: {}
|
|
47161
|
+
});
|
|
47162
|
+
let branchesData = branches || [];
|
|
47163
|
+
if (branchId) {
|
|
47164
|
+
branchesData = branchesData.filter((b) => b._id === branchId);
|
|
47165
|
+
}
|
|
47166
|
+
const branchNames = branchesData.map((b) => b.name);
|
|
47167
|
+
const currency = stock;
|
|
47168
|
+
const currentBranch = branchesData.find((b) => b._id === branchId);
|
|
47169
|
+
const columns = [
|
|
47170
|
+
{
|
|
47171
|
+
header: "Name",
|
|
47172
|
+
key: "name",
|
|
47173
|
+
className: "text-xs whitespace-nowrap",
|
|
47174
|
+
render: (row) => {
|
|
47175
|
+
const yard = row?.yard || 0;
|
|
47176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
|
|
47177
|
+
}
|
|
47178
|
+
},
|
|
47179
|
+
...!value ? branchNames.map((branchName) => ({
|
|
47180
|
+
header: branchName,
|
|
47181
|
+
key: branchName,
|
|
47182
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
47183
|
+
render: (row) => {
|
|
47184
|
+
const qty = row[branchName];
|
|
47185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
|
|
47186
|
+
"div",
|
|
47187
|
+
{
|
|
47188
|
+
className: qty > 0 ? "text-green-500 font-bold" : qty < 0 ? "text-red-500 font-bold" : "",
|
|
47189
|
+
children: Formats_default.Amount(qty, false)
|
|
47190
|
+
}
|
|
47191
|
+
);
|
|
47192
|
+
}
|
|
47193
|
+
})) : [],
|
|
47194
|
+
{
|
|
47195
|
+
header: "Total Qty",
|
|
47196
|
+
key: "total",
|
|
47197
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
47198
|
+
render: (row) => {
|
|
47199
|
+
const total = row.total;
|
|
47200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
|
|
47201
|
+
"span",
|
|
47202
|
+
{
|
|
47203
|
+
className: total > 0 ? "text-green-500 font-bold" : total < 0 ? "text-red-500 font-bold" : "",
|
|
47204
|
+
children: Formats_default.Amount(total, false)
|
|
47205
|
+
}
|
|
47206
|
+
);
|
|
47207
|
+
},
|
|
47208
|
+
renderFooter: (data2) => {
|
|
47209
|
+
const total = data2.reduce((acc, row) => acc + row.total, 0);
|
|
47210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("span", { className: " font-bold", children: Formats_default.Amount(total, false) });
|
|
47211
|
+
}
|
|
47212
|
+
}
|
|
47213
|
+
];
|
|
47214
|
+
let runningBalance = 0;
|
|
47215
|
+
const datas = (data?.data || []).map((item) => {
|
|
47216
|
+
runningBalance += item.calculatedAmount;
|
|
47217
|
+
return {
|
|
47218
|
+
...item,
|
|
47219
|
+
runningBalance
|
|
47220
|
+
};
|
|
47221
|
+
});
|
|
47222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)(import_jsx_runtime259.Fragment, { children: [
|
|
47223
|
+
/* @__PURE__ */ (0, import_jsx_runtime259.jsx)(TransactionView, {}),
|
|
47224
|
+
/* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
|
|
47225
|
+
A4DataView,
|
|
47226
|
+
{
|
|
47227
|
+
columns,
|
|
47228
|
+
data: datas || [],
|
|
47229
|
+
index: true,
|
|
47230
|
+
title: `Pending Collections`,
|
|
47231
|
+
subtitle: branchId ? currentBranch?.name : "All Branches",
|
|
47232
|
+
tableTitle: value ? "Current Stock Value" : "Current Stock Level",
|
|
47233
|
+
fixed: false,
|
|
47234
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
|
|
47235
|
+
Select,
|
|
47236
|
+
{
|
|
47237
|
+
options: options9,
|
|
47238
|
+
value: stockType,
|
|
47239
|
+
className: "w-32! print:hidden",
|
|
47240
|
+
onChange: (e) => {
|
|
47241
|
+
setQuery({ stockType: e });
|
|
47242
|
+
}
|
|
47243
|
+
}
|
|
47244
|
+
)
|
|
47245
|
+
}
|
|
47246
|
+
)
|
|
47247
|
+
] });
|
|
47248
|
+
};
|
|
47249
|
+
var CollectionLevel_default = CollectionLevel;
|
|
47250
|
+
|
|
47251
|
+
// src/components/Transactions/3/sale2/index.ts
|
|
47252
|
+
var Sale22 = {
|
|
47253
|
+
List: List_default6,
|
|
47254
|
+
Form: pos_default5,
|
|
47255
|
+
Collection: Collection_default,
|
|
47256
|
+
CollectionLevel: CollectionLevel_default
|
|
47257
|
+
};
|
|
47258
|
+
var sale2_default2 = Sale22;
|
|
47259
|
+
|
|
47260
|
+
// src/components/Transactions/3/purchase3/List.tsx
|
|
47261
|
+
var import_react_router_dom122 = require("react-router-dom");
|
|
47262
|
+
var import_lucide_react124 = require("lucide-react");
|
|
47263
|
+
var import_jsx_runtime260 = require("react/jsx-runtime");
|
|
47264
|
+
function purchase3List({
|
|
47265
|
+
url,
|
|
47266
|
+
type = "product"
|
|
47267
|
+
}) {
|
|
47268
|
+
const { branchId } = (0, import_react_router_dom122.useParams)();
|
|
47269
|
+
const navigate = (0, import_react_router_dom122.useNavigate)();
|
|
47270
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
47271
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
47272
|
+
url: url || `/transactions/get?type=stock&stock=purchase-3&stockType=${type}${branchId ? `&fromBranch=${branchId}` : ""}`,
|
|
47273
|
+
dateFilter: true
|
|
47274
|
+
});
|
|
47275
|
+
const { Modal: Modal2 } = useModal();
|
|
47276
|
+
const { PosPrinter } = usePosPrinter_default();
|
|
47277
|
+
const items = (data2) => [
|
|
47278
|
+
{
|
|
47279
|
+
label: `View Stock Purchase`,
|
|
47280
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.Eye, { size: 16 }),
|
|
47281
|
+
className: "w-[200px]",
|
|
47282
|
+
onClick: () => openTransaction({ id: data2?._id, type: "stock" })
|
|
47283
|
+
},
|
|
47284
|
+
{
|
|
47285
|
+
label: `Edit Stock Purchase`,
|
|
47286
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.FilePenLine, { size: 16 }),
|
|
47287
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
47288
|
+
},
|
|
47289
|
+
{
|
|
47290
|
+
label: `Delete Stock Purchase`,
|
|
47291
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.Trash2, { className: "text-red-500", size: 16 }),
|
|
47292
|
+
onClick: () => {
|
|
47293
|
+
openTransaction({
|
|
47294
|
+
id: data2?._id,
|
|
47295
|
+
type: "stock",
|
|
47296
|
+
reverseable: { reload }
|
|
47297
|
+
});
|
|
47298
|
+
}
|
|
47299
|
+
}
|
|
47300
|
+
].filter(Boolean);
|
|
47301
|
+
const columns = [
|
|
47302
|
+
{
|
|
47303
|
+
accessorKey: "date",
|
|
47304
|
+
header: "Date",
|
|
47305
|
+
cell: ({ row }) => {
|
|
47306
|
+
const stock = row.original;
|
|
47307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col", children: [
|
|
47308
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: stock?.date }),
|
|
47309
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
47310
|
+
"span",
|
|
47311
|
+
{
|
|
47312
|
+
onClick: () => openTransaction({ id: stock?._id, type: "stock" }),
|
|
47313
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
47314
|
+
children: stock.ref
|
|
47315
|
+
}
|
|
47316
|
+
)
|
|
47317
|
+
] });
|
|
47318
|
+
}
|
|
47319
|
+
},
|
|
47320
|
+
{
|
|
47321
|
+
accessorKey: "branch",
|
|
47322
|
+
header: "Branch",
|
|
47323
|
+
cell: ({ row }) => {
|
|
47324
|
+
const stock = row.original;
|
|
47325
|
+
const branch = stock?.fromBranchData?.name;
|
|
47326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: branch });
|
|
47327
|
+
}
|
|
47328
|
+
},
|
|
47329
|
+
{
|
|
47330
|
+
accessorKey: "supplier/wallet",
|
|
47331
|
+
header: "Supplier/Wallet",
|
|
47332
|
+
cell: ({ row }) => {
|
|
47333
|
+
const stock = row.original;
|
|
47334
|
+
const walletName = stock?.fromWalletData?.name;
|
|
47335
|
+
const accountName = stock?.accountData?.name || stock?.accountName;
|
|
47336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
47337
|
+
stock?.cash > 0 && walletName && /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47338
|
+
"Wallet:",
|
|
47339
|
+
" ",
|
|
47340
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: walletName })
|
|
47341
|
+
] }),
|
|
47342
|
+
stock?.credit > 0 && accountName && /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47343
|
+
"Supplier:",
|
|
47344
|
+
" ",
|
|
47345
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: accountName })
|
|
47346
|
+
] }),
|
|
47347
|
+
!(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: stock?.purchase === "cash" ? walletName || "Cash Wallet" : accountName || "Supplier" })
|
|
47348
|
+
] });
|
|
47349
|
+
}
|
|
47350
|
+
},
|
|
47351
|
+
{
|
|
47352
|
+
accessorKey: "stockType",
|
|
47353
|
+
header: "Stock Type",
|
|
47354
|
+
cell: ({ row }) => {
|
|
47355
|
+
const stock = row.original;
|
|
47356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: stock?.stockType }) });
|
|
47357
|
+
}
|
|
47358
|
+
},
|
|
47359
|
+
{
|
|
47360
|
+
accessorKey: "action",
|
|
47361
|
+
header: "Action",
|
|
47362
|
+
cell: ({ row }) => {
|
|
47363
|
+
const stock = row.original;
|
|
47364
|
+
const purchaseType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.purchase;
|
|
47365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col", children: [
|
|
47366
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: `capitalize text-red-600`, children: "Stock Purchased" }),
|
|
47367
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "capitalize", children: purchaseType })
|
|
47368
|
+
] });
|
|
47369
|
+
}
|
|
47370
|
+
},
|
|
47371
|
+
{
|
|
47372
|
+
accessorKey: "amount",
|
|
47373
|
+
header: "Amount",
|
|
47374
|
+
cell: ({ row }) => {
|
|
47375
|
+
const stock = row.original;
|
|
47376
|
+
const amount = stock?.amount - (stock?.discount || 0);
|
|
47377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col", children: [
|
|
47378
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "font-semibold", children: Formats_default.Price(amount, stock?.currency, false) }),
|
|
47379
|
+
stock?.discount ? /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("span", { className: "text-xs text-red-600 ", children: [
|
|
47380
|
+
"Original:",
|
|
47381
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)("del", { children: Formats_default.Price(stock?.amount, stock?.currency, false) })
|
|
47382
|
+
] }) : null
|
|
47383
|
+
] });
|
|
47384
|
+
}
|
|
47385
|
+
},
|
|
47386
|
+
{
|
|
47387
|
+
accessorKey: "actions",
|
|
47388
|
+
header: "Actions",
|
|
47389
|
+
cell: ({ row }) => {
|
|
47390
|
+
const data2 = row.original;
|
|
47391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
47392
|
+
Dropdown,
|
|
47393
|
+
{
|
|
47394
|
+
className: "cursor-pointer",
|
|
47395
|
+
items: items(data2),
|
|
47396
|
+
triggerMode: "hover",
|
|
47397
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.EllipsisVertical, {})
|
|
47398
|
+
}
|
|
47399
|
+
);
|
|
47400
|
+
}
|
|
47401
|
+
}
|
|
47402
|
+
];
|
|
47403
|
+
const stocks = data?.data || [];
|
|
47404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)(import_jsx_runtime260.Fragment, { children: [
|
|
47405
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)(TransactionView, {}),
|
|
47406
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)(Modal2, {}),
|
|
47407
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)(PosPrinter, {}),
|
|
47408
|
+
/* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
47019
47409
|
TransactionViewComponent,
|
|
47020
47410
|
{
|
|
47021
47411
|
columns,
|
|
@@ -47035,23 +47425,23 @@ function purchase3List({
|
|
|
47035
47425
|
var List_default7 = purchase3List;
|
|
47036
47426
|
|
|
47037
47427
|
// src/components/Transactions/3/purchase3/pos.tsx
|
|
47038
|
-
var
|
|
47428
|
+
var import_react160 = require("react");
|
|
47039
47429
|
|
|
47040
47430
|
// src/components/Transactions/3/purchase3/header.tsx
|
|
47041
47431
|
var import_react_hook_form71 = require("react-hook-form");
|
|
47042
|
-
var
|
|
47043
|
-
var
|
|
47044
|
-
var
|
|
47432
|
+
var import_react_router_dom123 = require("react-router-dom");
|
|
47433
|
+
var import_react157 = require("react");
|
|
47434
|
+
var import_jsx_runtime261 = require("react/jsx-runtime");
|
|
47045
47435
|
function SaleHeader4({ stockType }) {
|
|
47046
47436
|
const form = (0, import_react_hook_form71.useFormContext)();
|
|
47047
|
-
const { branchId } = (0,
|
|
47048
|
-
(0,
|
|
47437
|
+
const { branchId } = (0, import_react_router_dom123.useParams)();
|
|
47438
|
+
(0, import_react157.useEffect)(() => {
|
|
47049
47439
|
if (branchId) {
|
|
47050
47440
|
form.setValue("branch", branchId);
|
|
47051
47441
|
}
|
|
47052
47442
|
}, [branchId]);
|
|
47053
|
-
return /* @__PURE__ */ (0,
|
|
47054
|
-
/* @__PURE__ */ (0,
|
|
47443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("section", { className: "grid grid-cols-1 md:grid-cols-4 lg:grid-cols-5 border-b-2 pb-4 pt-2 gap-4", children: [
|
|
47444
|
+
/* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
47055
47445
|
Fields_default.DateInput,
|
|
47056
47446
|
{
|
|
47057
47447
|
label: "Date",
|
|
@@ -47061,7 +47451,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47061
47451
|
required: true
|
|
47062
47452
|
}
|
|
47063
47453
|
),
|
|
47064
|
-
/* @__PURE__ */ (0,
|
|
47454
|
+
/* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
47065
47455
|
Feilds_default.Branches,
|
|
47066
47456
|
{
|
|
47067
47457
|
name: "branch",
|
|
@@ -47072,7 +47462,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47072
47462
|
className: "h-[30px]!"
|
|
47073
47463
|
}
|
|
47074
47464
|
),
|
|
47075
|
-
/* @__PURE__ */ (0,
|
|
47465
|
+
/* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
47076
47466
|
Fields_default.Select,
|
|
47077
47467
|
{
|
|
47078
47468
|
label: "Stock Type",
|
|
@@ -47087,7 +47477,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47087
47477
|
className: "rounded-md! min-w-[100px]! h-[30px]!"
|
|
47088
47478
|
}
|
|
47089
47479
|
),
|
|
47090
|
-
/* @__PURE__ */ (0,
|
|
47480
|
+
/* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
47091
47481
|
Fields_default.Select,
|
|
47092
47482
|
{
|
|
47093
47483
|
label: "Currency",
|
|
@@ -47102,7 +47492,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47102
47492
|
className: "rounded-md! min-w-[100px]! h-[30px]!"
|
|
47103
47493
|
}
|
|
47104
47494
|
),
|
|
47105
|
-
/* @__PURE__ */ (0,
|
|
47495
|
+
/* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
47106
47496
|
Fields_default.Input,
|
|
47107
47497
|
{
|
|
47108
47498
|
label: "Invoice Number",
|
|
@@ -47150,8 +47540,8 @@ var useFetchBalance6 = ({ form, branch, type }) => {
|
|
|
47150
47540
|
var FetchBalance_default6 = useFetchBalance6;
|
|
47151
47541
|
|
|
47152
47542
|
// src/components/Transactions/3/purchase3/table.tsx
|
|
47153
|
-
var
|
|
47154
|
-
var
|
|
47543
|
+
var import_react158 = require("react");
|
|
47544
|
+
var import_jsx_runtime262 = require("react/jsx-runtime");
|
|
47155
47545
|
function PurchaseStockTable({
|
|
47156
47546
|
data,
|
|
47157
47547
|
methods,
|
|
@@ -47237,12 +47627,12 @@ function PurchaseStockTable({
|
|
|
47237
47627
|
size: 400,
|
|
47238
47628
|
meta: {
|
|
47239
47629
|
field: ({ value, onChange, rowData }) => {
|
|
47240
|
-
(0,
|
|
47630
|
+
(0, import_react158.useEffect)(() => {
|
|
47241
47631
|
if (rowData?.lineObj && methods.getValues("lineObj") !== rowData.lineObj) {
|
|
47242
47632
|
methods.setValue("lineObj", rowData.lineObj);
|
|
47243
47633
|
}
|
|
47244
47634
|
}, [rowData?.lineObj]);
|
|
47245
|
-
return /* @__PURE__ */ (0,
|
|
47635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "flex items-center gap-2 w-full ", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47246
47636
|
Fields_default.SearchApi,
|
|
47247
47637
|
{
|
|
47248
47638
|
id: "pti-lineId",
|
|
@@ -47291,8 +47681,8 @@ function PurchaseStockTable({
|
|
|
47291
47681
|
cell: ({ row }) => {
|
|
47292
47682
|
const lineObj2 = row.original?.lineObj;
|
|
47293
47683
|
const lineName = lineObj2?.name;
|
|
47294
|
-
return /* @__PURE__ */ (0,
|
|
47295
|
-
stockType === "product" && /* @__PURE__ */ (0,
|
|
47684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)("div", { className: "flex items-center gap-2 w-full ", children: [
|
|
47685
|
+
stockType === "product" && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "h-[20px] w-[20px] rounded-md overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47296
47686
|
ProductImage_default,
|
|
47297
47687
|
{
|
|
47298
47688
|
src: lineObj2?.imgUrl || lineObj2?.image || null,
|
|
@@ -47300,7 +47690,7 @@ function PurchaseStockTable({
|
|
|
47300
47690
|
width: 20
|
|
47301
47691
|
}
|
|
47302
47692
|
) }),
|
|
47303
|
-
/* @__PURE__ */ (0,
|
|
47693
|
+
/* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h1", { children: lineName })
|
|
47304
47694
|
] });
|
|
47305
47695
|
}
|
|
47306
47696
|
},
|
|
@@ -47309,7 +47699,7 @@ function PurchaseStockTable({
|
|
|
47309
47699
|
header: "Available",
|
|
47310
47700
|
maxSize: 90,
|
|
47311
47701
|
meta: {
|
|
47312
|
-
field: ({ value, onChange }) => /* @__PURE__ */ (0,
|
|
47702
|
+
field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(import_jsx_runtime262.Fragment, { children: balanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(LoadingSpin, { size: "sm", className: "text-blue-600" }) : /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47313
47703
|
Fields_default.Input,
|
|
47314
47704
|
{
|
|
47315
47705
|
id: "pti-lineBalance",
|
|
@@ -47327,7 +47717,7 @@ function PurchaseStockTable({
|
|
|
47327
47717
|
) })
|
|
47328
47718
|
},
|
|
47329
47719
|
cell: () => {
|
|
47330
|
-
return /* @__PURE__ */ (0,
|
|
47720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: "-" });
|
|
47331
47721
|
}
|
|
47332
47722
|
},
|
|
47333
47723
|
...!isRate ? [
|
|
@@ -47336,7 +47726,7 @@ function PurchaseStockTable({
|
|
|
47336
47726
|
header: "Cost",
|
|
47337
47727
|
maxSize: 140,
|
|
47338
47728
|
meta: {
|
|
47339
|
-
field: ({ value, onChange }) => /* @__PURE__ */ (0,
|
|
47729
|
+
field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47340
47730
|
Fields_default.Input,
|
|
47341
47731
|
{
|
|
47342
47732
|
id: "pti-lineCost",
|
|
@@ -47354,7 +47744,7 @@ function PurchaseStockTable({
|
|
|
47354
47744
|
)
|
|
47355
47745
|
},
|
|
47356
47746
|
cell: ({ row }) => {
|
|
47357
|
-
return /* @__PURE__ */ (0,
|
|
47747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.Amount(row.original?.lineCost || 0) });
|
|
47358
47748
|
}
|
|
47359
47749
|
}
|
|
47360
47750
|
] : [],
|
|
@@ -47363,7 +47753,7 @@ function PurchaseStockTable({
|
|
|
47363
47753
|
header: "Qty",
|
|
47364
47754
|
maxSize: 90,
|
|
47365
47755
|
meta: {
|
|
47366
|
-
field: ({ value, onChange }) => /* @__PURE__ */ (0,
|
|
47756
|
+
field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47367
47757
|
Fields_default.Input,
|
|
47368
47758
|
{
|
|
47369
47759
|
id: "pti-lineQuantity",
|
|
@@ -47380,7 +47770,7 @@ function PurchaseStockTable({
|
|
|
47380
47770
|
)
|
|
47381
47771
|
},
|
|
47382
47772
|
cell: ({ row }) => {
|
|
47383
|
-
return /* @__PURE__ */ (0,
|
|
47773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.XQty(row.original?.lineQuantity || 0) });
|
|
47384
47774
|
}
|
|
47385
47775
|
},
|
|
47386
47776
|
{
|
|
@@ -47388,7 +47778,7 @@ function PurchaseStockTable({
|
|
|
47388
47778
|
header: "Price",
|
|
47389
47779
|
maxSize: 90,
|
|
47390
47780
|
meta: {
|
|
47391
|
-
field: ({ value, onChange }) => /* @__PURE__ */ (0,
|
|
47781
|
+
field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47392
47782
|
Fields_default.Input,
|
|
47393
47783
|
{
|
|
47394
47784
|
id: "pti-lineCost",
|
|
@@ -47405,7 +47795,7 @@ function PurchaseStockTable({
|
|
|
47405
47795
|
)
|
|
47406
47796
|
},
|
|
47407
47797
|
cell: ({ row }) => {
|
|
47408
|
-
return /* @__PURE__ */ (0,
|
|
47798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.XQty(row.original?.lineSell || 0) });
|
|
47409
47799
|
}
|
|
47410
47800
|
},
|
|
47411
47801
|
{
|
|
@@ -47413,7 +47803,7 @@ function PurchaseStockTable({
|
|
|
47413
47803
|
header: "Total",
|
|
47414
47804
|
maxSize: 150,
|
|
47415
47805
|
meta: {
|
|
47416
|
-
field: ({ value, onChange }) => /* @__PURE__ */ (0,
|
|
47806
|
+
field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47417
47807
|
Fields_default.Input,
|
|
47418
47808
|
{
|
|
47419
47809
|
id: "pti-lineTotal",
|
|
@@ -47431,22 +47821,22 @@ function PurchaseStockTable({
|
|
|
47431
47821
|
)
|
|
47432
47822
|
},
|
|
47433
47823
|
cell: ({ row }) => {
|
|
47434
|
-
return /* @__PURE__ */ (0,
|
|
47824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.Amount(row.original?.lineTotal || 0) });
|
|
47435
47825
|
},
|
|
47436
47826
|
footer: ({ row }) => {
|
|
47437
47827
|
const total = data?.reduce((acc, row2) => acc + row2.lineTotal, 0);
|
|
47438
|
-
return /* @__PURE__ */ (0,
|
|
47828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.Price(total || 0, currency, false) });
|
|
47439
47829
|
}
|
|
47440
47830
|
}
|
|
47441
47831
|
];
|
|
47442
|
-
(0,
|
|
47832
|
+
(0, import_react158.useEffect)(() => {
|
|
47443
47833
|
if (lineId) {
|
|
47444
47834
|
fetchBalance();
|
|
47445
47835
|
} else {
|
|
47446
47836
|
methods.setValue("lineBalance", 0);
|
|
47447
47837
|
}
|
|
47448
47838
|
}, [lineId, branch]);
|
|
47449
|
-
return /* @__PURE__ */ (0,
|
|
47839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(import_jsx_runtime262.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
|
|
47450
47840
|
PostTable,
|
|
47451
47841
|
{
|
|
47452
47842
|
data: data || [],
|
|
@@ -47460,7 +47850,7 @@ function PurchaseStockTable({
|
|
|
47460
47850
|
isLoading: getLoading,
|
|
47461
47851
|
defaultExpanded: true,
|
|
47462
47852
|
hasSubComponent: () => stockType !== "product",
|
|
47463
|
-
renderSubComponent: ({ row }) => /* @__PURE__ */ (0,
|
|
47853
|
+
renderSubComponent: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(PackView_default, { type: stockType, data: row?.lineObj?.products })
|
|
47464
47854
|
},
|
|
47465
47855
|
data?.length
|
|
47466
47856
|
) });
|
|
@@ -47503,13 +47893,13 @@ var AdjustmentStockSchema6 = import_zod119.default.object({
|
|
|
47503
47893
|
var schema_default8 = AdjustmentStockSchema6;
|
|
47504
47894
|
|
|
47505
47895
|
// src/components/Transactions/3/purchase3/pos.tsx
|
|
47506
|
-
var
|
|
47507
|
-
var
|
|
47896
|
+
var import_lucide_react125 = require("lucide-react");
|
|
47897
|
+
var import_react_router_dom124 = require("react-router-dom");
|
|
47508
47898
|
|
|
47509
47899
|
// src/components/Transactions/3/purchase3/Submit.tsx
|
|
47510
47900
|
var import_react_hook_form72 = require("react-hook-form");
|
|
47511
|
-
var
|
|
47512
|
-
var
|
|
47901
|
+
var import_react159 = require("react");
|
|
47902
|
+
var import_jsx_runtime263 = require("react/jsx-runtime");
|
|
47513
47903
|
var CompletePurchaseModal = ({
|
|
47514
47904
|
totalAmount,
|
|
47515
47905
|
onSubmit,
|
|
@@ -47558,7 +47948,7 @@ var CompletePurchaseModal = ({
|
|
|
47558
47948
|
}
|
|
47559
47949
|
};
|
|
47560
47950
|
const isRate = defaultCurrency !== currency;
|
|
47561
|
-
const exchangedNet = (0,
|
|
47951
|
+
const exchangedNet = (0, import_react159.useMemo)(() => {
|
|
47562
47952
|
const total = forex_default.exchangedAmount({
|
|
47563
47953
|
accountCurrency: defaultCurrency,
|
|
47564
47954
|
transactionCurrency: currency,
|
|
@@ -47569,27 +47959,27 @@ var CompletePurchaseModal = ({
|
|
|
47569
47959
|
return Formats_default.Price(total, defaultCurrency, false);
|
|
47570
47960
|
}, [netAmount, currency, defaultCurrency, cash, credit, discount]);
|
|
47571
47961
|
const { isSubmitting } = form.formState;
|
|
47572
|
-
return /* @__PURE__ */ (0,
|
|
47573
|
-
/* @__PURE__ */ (0,
|
|
47574
|
-
/* @__PURE__ */ (0,
|
|
47575
|
-
/* @__PURE__ */ (0,
|
|
47576
|
-
discount > 0 && /* @__PURE__ */ (0,
|
|
47962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Card, { isLoading: isSubmitting, children: /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "space-y-5", children: [
|
|
47963
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-emerald-50 dark:bg-emerald-950/20 p-5 rounded-xl text-center space-y-1 border border-emerald-100 dark:border-emerald-900/30", children: [
|
|
47964
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs uppercase tracking-wider text-emerald-600 dark:text-emerald-400 font-bold", children: "Net Total Amount" }),
|
|
47965
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("h2", { className: "text-3xl font-black text-emerald-700 dark:text-emerald-300", children: Formats_default.Price(netAmount, currency, false) }),
|
|
47966
|
+
discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("p", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47577
47967
|
"Original:",
|
|
47578
47968
|
" ",
|
|
47579
|
-
/* @__PURE__ */ (0,
|
|
47969
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "line-through", children: Formats_default.Price(totalAmount, currency, false) })
|
|
47580
47970
|
] })
|
|
47581
47971
|
] }),
|
|
47582
|
-
/* @__PURE__ */ (0,
|
|
47583
|
-
/* @__PURE__ */ (0,
|
|
47584
|
-
/* @__PURE__ */ (0,
|
|
47585
|
-
(discount > 0 || isRate) && /* @__PURE__ */ (0,
|
|
47972
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
|
|
47973
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
47974
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount & Rate" }),
|
|
47975
|
+
(discount > 0 || isRate) && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs px-2 py-0.5 bg-amber-50 text-amber-600 rounded-full font-medium dark:bg-amber-950/40 dark:text-amber-400", children: discount > 0 ? "Applied" : "Exchange Rate Required" })
|
|
47586
47976
|
] }),
|
|
47587
|
-
/* @__PURE__ */ (0,
|
|
47977
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(
|
|
47588
47978
|
"div",
|
|
47589
47979
|
{
|
|
47590
47980
|
className: isRate ? "grid grid-cols-1 md:grid-cols-2 gap-4" : "grid grid-cols-1 gap-4",
|
|
47591
47981
|
children: [
|
|
47592
|
-
/* @__PURE__ */ (0,
|
|
47982
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47593
47983
|
Fields_default.Input,
|
|
47594
47984
|
{
|
|
47595
47985
|
label: "Discount Amount",
|
|
@@ -47600,7 +47990,7 @@ var CompletePurchaseModal = ({
|
|
|
47600
47990
|
className: "h-[40px]!"
|
|
47601
47991
|
}
|
|
47602
47992
|
),
|
|
47603
|
-
isRate && /* @__PURE__ */ (0,
|
|
47993
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47604
47994
|
Fields_default.Input,
|
|
47605
47995
|
{
|
|
47606
47996
|
label: "Rate",
|
|
@@ -47615,13 +48005,13 @@ var CompletePurchaseModal = ({
|
|
|
47615
48005
|
}
|
|
47616
48006
|
)
|
|
47617
48007
|
] }),
|
|
47618
|
-
/* @__PURE__ */ (0,
|
|
47619
|
-
/* @__PURE__ */ (0,
|
|
47620
|
-
/* @__PURE__ */ (0,
|
|
47621
|
-
cash > 0 && /* @__PURE__ */ (0,
|
|
48008
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
|
|
48009
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
48010
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Cash Payment" }),
|
|
48011
|
+
cash > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs px-2 py-0.5 bg-blue-50 text-blue-600 rounded-full font-medium dark:bg-blue-950/40 dark:text-blue-400", children: "Active" })
|
|
47622
48012
|
] }),
|
|
47623
|
-
/* @__PURE__ */ (0,
|
|
47624
|
-
/* @__PURE__ */ (0,
|
|
48013
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
48014
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47625
48015
|
Fields_default.Input,
|
|
47626
48016
|
{
|
|
47627
48017
|
label: "Cash Amount",
|
|
@@ -47632,7 +48022,7 @@ var CompletePurchaseModal = ({
|
|
|
47632
48022
|
className: "h-[40px]!"
|
|
47633
48023
|
}
|
|
47634
48024
|
),
|
|
47635
|
-
/* @__PURE__ */ (0,
|
|
48025
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47636
48026
|
Feilds_default2.Wallet,
|
|
47637
48027
|
{
|
|
47638
48028
|
name: "wallet",
|
|
@@ -47646,13 +48036,13 @@ var CompletePurchaseModal = ({
|
|
|
47646
48036
|
)
|
|
47647
48037
|
] })
|
|
47648
48038
|
] }),
|
|
47649
|
-
/* @__PURE__ */ (0,
|
|
47650
|
-
/* @__PURE__ */ (0,
|
|
47651
|
-
/* @__PURE__ */ (0,
|
|
47652
|
-
credit > 0 && /* @__PURE__ */ (0,
|
|
48039
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
|
|
48040
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
48041
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Credit Payment" }),
|
|
48042
|
+
credit > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs px-2 py-0.5 bg-red-50 text-red-600 rounded-full font-medium dark:bg-red-950/40 dark:text-red-400", children: "Active" })
|
|
47653
48043
|
] }),
|
|
47654
|
-
/* @__PURE__ */ (0,
|
|
47655
|
-
/* @__PURE__ */ (0,
|
|
48044
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
48045
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47656
48046
|
Fields_default.Input,
|
|
47657
48047
|
{
|
|
47658
48048
|
label: "Credit Amount",
|
|
@@ -47663,7 +48053,7 @@ var CompletePurchaseModal = ({
|
|
|
47663
48053
|
className: "h-[40px]!"
|
|
47664
48054
|
}
|
|
47665
48055
|
),
|
|
47666
|
-
/* @__PURE__ */ (0,
|
|
48056
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47667
48057
|
Feilds_default.Customer,
|
|
47668
48058
|
{
|
|
47669
48059
|
name: "supplier",
|
|
@@ -47677,37 +48067,37 @@ var CompletePurchaseModal = ({
|
|
|
47677
48067
|
)
|
|
47678
48068
|
] })
|
|
47679
48069
|
] }),
|
|
47680
|
-
/* @__PURE__ */ (0,
|
|
47681
|
-
/* @__PURE__ */ (0,
|
|
47682
|
-
/* @__PURE__ */ (0,
|
|
47683
|
-
/* @__PURE__ */ (0,
|
|
48070
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "pt-2 space-y-2.5", children: [
|
|
48071
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2", children: [
|
|
48072
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-gray-500 dark:text-zinc-400", children: "Total Before Discount:" }),
|
|
48073
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "font-semibold text-gray-900 dark:text-white", children: Formats_default.Price(totalAmount, currency, false) })
|
|
47684
48074
|
] }),
|
|
47685
|
-
discount > 0 && /* @__PURE__ */ (0,
|
|
47686
|
-
/* @__PURE__ */ (0,
|
|
47687
|
-
/* @__PURE__ */ (0,
|
|
48075
|
+
discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-amber-600 dark:text-amber-400", children: [
|
|
48076
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Discount Applied:" }),
|
|
48077
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("span", { children: [
|
|
47688
48078
|
"-",
|
|
47689
48079
|
Formats_default.Price(discount, currency, false)
|
|
47690
48080
|
] })
|
|
47691
48081
|
] }),
|
|
47692
|
-
/* @__PURE__ */ (0,
|
|
47693
|
-
/* @__PURE__ */ (0,
|
|
47694
|
-
/* @__PURE__ */ (0,
|
|
48082
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-blue-600 dark:text-blue-400", children: [
|
|
48083
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Cash Paid:" }),
|
|
48084
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: Formats_default.Price(cash, currency, false) })
|
|
47695
48085
|
] }),
|
|
47696
|
-
/* @__PURE__ */ (0,
|
|
47697
|
-
/* @__PURE__ */ (0,
|
|
47698
|
-
/* @__PURE__ */ (0,
|
|
48086
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-red-500 dark:text-red-400", children: [
|
|
48087
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Credit Amount:" }),
|
|
48088
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: Formats_default.Price(credit, currency, false) })
|
|
47699
48089
|
] }),
|
|
47700
|
-
/* @__PURE__ */ (0,
|
|
47701
|
-
/* @__PURE__ */ (0,
|
|
47702
|
-
/* @__PURE__ */ (0,
|
|
48090
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-base font-bold bg-zinc-100 dark:bg-zinc-800/80 p-3 rounded-lg text-gray-900 dark:text-white mt-1", children: [
|
|
48091
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Net Total:" }),
|
|
48092
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: Formats_default.Price(netAmount, currency, false) })
|
|
47703
48093
|
] }),
|
|
47704
|
-
isRate && /* @__PURE__ */ (0,
|
|
47705
|
-
/* @__PURE__ */ (0,
|
|
47706
|
-
/* @__PURE__ */ (0,
|
|
48094
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-base font-bold bg-zinc-100 dark:bg-zinc-800/80 p-3 rounded-lg text-gray-900 dark:text-white mt-1", children: [
|
|
48095
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Exchanged Net Total:" }),
|
|
48096
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: exchangedNet })
|
|
47707
48097
|
] })
|
|
47708
48098
|
] }),
|
|
47709
|
-
/* @__PURE__ */ (0,
|
|
47710
|
-
/* @__PURE__ */ (0,
|
|
48099
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-end gap-3 pt-3 border-t dark:border-zinc-800", children: [
|
|
48100
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47711
48101
|
Button,
|
|
47712
48102
|
{
|
|
47713
48103
|
onClick: closeModal,
|
|
@@ -47719,7 +48109,7 @@ var CompletePurchaseModal = ({
|
|
|
47719
48109
|
children: "Cancel"
|
|
47720
48110
|
}
|
|
47721
48111
|
),
|
|
47722
|
-
/* @__PURE__ */ (0,
|
|
48112
|
+
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
|
|
47723
48113
|
Button,
|
|
47724
48114
|
{
|
|
47725
48115
|
onClick: onSubmit,
|
|
@@ -47737,15 +48127,15 @@ var CompletePurchaseModal = ({
|
|
|
47737
48127
|
var Submit_default3 = CompletePurchaseModal;
|
|
47738
48128
|
|
|
47739
48129
|
// src/components/Transactions/3/purchase3/pos.tsx
|
|
47740
|
-
var
|
|
48130
|
+
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
47741
48131
|
var Purchase3Form = ({ type }) => {
|
|
47742
48132
|
const { getQuery, navigate } = useApp_default();
|
|
47743
48133
|
const stockType = type;
|
|
47744
|
-
const { branchId } = (0,
|
|
48134
|
+
const { branchId } = (0, import_react_router_dom124.useParams)();
|
|
47745
48135
|
const purchaseId = getQuery("id");
|
|
47746
48136
|
const { currencies } = useWarqadConfig();
|
|
47747
48137
|
const { defaultCurrency } = currencies;
|
|
47748
|
-
const [ref2, setRef] = (0,
|
|
48138
|
+
const [ref2, setRef] = (0, import_react160.useState)();
|
|
47749
48139
|
const { Modal: Modal2, openState, close: closeModal } = useModal_default();
|
|
47750
48140
|
const methods = (0, import_react_hook_form73.useForm)({
|
|
47751
48141
|
resolver: (0, import_zod120.zodResolver)(schema_default8),
|
|
@@ -47778,7 +48168,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
47778
48168
|
const lineCost = watch("lineCost");
|
|
47779
48169
|
const isRate = defaultCurrency !== currency;
|
|
47780
48170
|
const draft = purchaseId ? [] : storage.get(getStorageType6(stockType)) || [];
|
|
47781
|
-
const [postData, setPostData] = (0,
|
|
48171
|
+
const [postData, setPostData] = (0, import_react160.useState)(draft);
|
|
47782
48172
|
const { post, isLoading: submitLoading } = useApis_default();
|
|
47783
48173
|
const { get, isLoading: getLoading } = useApis_default();
|
|
47784
48174
|
const onSubmit = async (data) => {
|
|
@@ -47883,7 +48273,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
47883
48273
|
type: "complete_purchase2",
|
|
47884
48274
|
title: "Complete purchase",
|
|
47885
48275
|
width: 650,
|
|
47886
|
-
content: /* @__PURE__ */ (0,
|
|
48276
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
47887
48277
|
Submit_default3,
|
|
47888
48278
|
{
|
|
47889
48279
|
totalAmount,
|
|
@@ -47936,37 +48326,37 @@ var Purchase3Form = ({ type }) => {
|
|
|
47936
48326
|
navigate(-1);
|
|
47937
48327
|
}
|
|
47938
48328
|
};
|
|
47939
|
-
(0,
|
|
48329
|
+
(0, import_react160.useEffect)(() => {
|
|
47940
48330
|
setValue("lineCost", lineObj?.cost || 0);
|
|
47941
48331
|
}, [lineObj]);
|
|
47942
|
-
(0,
|
|
48332
|
+
(0, import_react160.useEffect)(() => {
|
|
47943
48333
|
const total = (lineQuantity || 0) * (lineCost || 0);
|
|
47944
48334
|
setValue("lineTotal", total);
|
|
47945
48335
|
}, [lineCost, lineQuantity]);
|
|
47946
|
-
(0,
|
|
48336
|
+
(0, import_react160.useLayoutEffect)(() => {
|
|
47947
48337
|
if (purchaseId) {
|
|
47948
48338
|
fetchData();
|
|
47949
48339
|
}
|
|
47950
48340
|
}, [purchaseId]);
|
|
47951
|
-
return /* @__PURE__ */ (0,
|
|
47952
|
-
/* @__PURE__ */ (0,
|
|
47953
|
-
/* @__PURE__ */ (0,
|
|
47954
|
-
/* @__PURE__ */ (0,
|
|
47955
|
-
/* @__PURE__ */ (0,
|
|
47956
|
-
/* @__PURE__ */ (0,
|
|
47957
|
-
/* @__PURE__ */ (0,
|
|
48341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_react_hook_form73.FormProvider, { ...methods, children: [
|
|
48342
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Modal2, {}),
|
|
48343
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "space-y-6 ", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "grid grid-cols-1 gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card, { children: [
|
|
48344
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card.Header, { children: [
|
|
48345
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "flex justify-between gap-2 items-center", children: [
|
|
48346
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("section", { children: [
|
|
48347
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card.Title, { children: [
|
|
47958
48348
|
stockType,
|
|
47959
48349
|
" Stock purchase Table"
|
|
47960
48350
|
] }),
|
|
47961
|
-
/* @__PURE__ */ (0,
|
|
48351
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Description, { children: !purchaseId ? "Add items to the table and process the purchase" : "Edit items in the table and update the purchase" })
|
|
47962
48352
|
] }),
|
|
47963
|
-
/* @__PURE__ */ (0,
|
|
48353
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
47964
48354
|
Button,
|
|
47965
48355
|
{
|
|
47966
48356
|
onClick: () => {
|
|
47967
48357
|
navigate(-1);
|
|
47968
48358
|
},
|
|
47969
|
-
icon: /* @__PURE__ */ (0,
|
|
48359
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(import_lucide_react125.ArrowLeft, {}),
|
|
47970
48360
|
size: "sm",
|
|
47971
48361
|
type: "button",
|
|
47972
48362
|
variant: "warning",
|
|
@@ -47975,9 +48365,9 @@ var Purchase3Form = ({ type }) => {
|
|
|
47975
48365
|
}
|
|
47976
48366
|
)
|
|
47977
48367
|
] }),
|
|
47978
|
-
/* @__PURE__ */ (0,
|
|
48368
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(header_default6, { stockType })
|
|
47979
48369
|
] }),
|
|
47980
|
-
/* @__PURE__ */ (0,
|
|
48370
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
47981
48371
|
table_default6,
|
|
47982
48372
|
{
|
|
47983
48373
|
data: postData,
|
|
@@ -47988,8 +48378,8 @@ var Purchase3Form = ({ type }) => {
|
|
|
47988
48378
|
adjustmentId: purchaseId
|
|
47989
48379
|
}
|
|
47990
48380
|
) }),
|
|
47991
|
-
/* @__PURE__ */ (0,
|
|
47992
|
-
!purchaseId ? /* @__PURE__ */ (0,
|
|
48381
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Footer, { className: "flex justify-end space-y-2", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
48382
|
+
!purchaseId ? /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(import_jsx_runtime264.Fragment, { children: storage.has(getStorageType6(stockType)) && postData?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
47993
48383
|
import_antd94.Popconfirm,
|
|
47994
48384
|
{
|
|
47995
48385
|
title: "Are you sure you want to clear the draft?",
|
|
@@ -47998,7 +48388,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
47998
48388
|
storage.remove(getStorageType6(stockType));
|
|
47999
48389
|
setPostData([]);
|
|
48000
48390
|
},
|
|
48001
|
-
children: /* @__PURE__ */ (0,
|
|
48391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
48002
48392
|
Button,
|
|
48003
48393
|
{
|
|
48004
48394
|
size: "md",
|
|
@@ -48009,7 +48399,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
48009
48399
|
}
|
|
48010
48400
|
)
|
|
48011
48401
|
}
|
|
48012
|
-
) }) : /* @__PURE__ */ (0,
|
|
48402
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
48013
48403
|
Button,
|
|
48014
48404
|
{
|
|
48015
48405
|
onClick: () => {
|
|
@@ -48023,7 +48413,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
48023
48413
|
children: "Cancel"
|
|
48024
48414
|
}
|
|
48025
48415
|
),
|
|
48026
|
-
/* @__PURE__ */ (0,
|
|
48416
|
+
/* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
|
|
48027
48417
|
Button,
|
|
48028
48418
|
{
|
|
48029
48419
|
onClick: handleSubmit(onMainFormSubmit, (e) => {
|
|
@@ -48061,12 +48451,12 @@ var purchase3 = {
|
|
|
48061
48451
|
var purchase3_default = purchase3;
|
|
48062
48452
|
|
|
48063
48453
|
// src/components/Transactions/3/expense/Expenses.tsx
|
|
48064
|
-
var
|
|
48065
|
-
var
|
|
48066
|
-
var
|
|
48454
|
+
var import_react_router_dom125 = require("react-router-dom");
|
|
48455
|
+
var import_lucide_react126 = require("lucide-react");
|
|
48456
|
+
var import_jsx_runtime265 = require("react/jsx-runtime");
|
|
48067
48457
|
function Expenses3({ url }) {
|
|
48068
|
-
const { branchId } = (0,
|
|
48069
|
-
const navigate = (0,
|
|
48458
|
+
const { branchId } = (0, import_react_router_dom125.useParams)();
|
|
48459
|
+
const navigate = (0, import_react_router_dom125.useNavigate)();
|
|
48070
48460
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48071
48461
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48072
48462
|
url: url || `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -48076,17 +48466,17 @@ function Expenses3({ url }) {
|
|
|
48076
48466
|
const items = (data2) => [
|
|
48077
48467
|
{
|
|
48078
48468
|
label: `View Expense`,
|
|
48079
|
-
icon: /* @__PURE__ */ (0,
|
|
48469
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
|
|
48080
48470
|
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48081
48471
|
},
|
|
48082
48472
|
{
|
|
48083
48473
|
label: `Edit Expense`,
|
|
48084
|
-
icon: /* @__PURE__ */ (0,
|
|
48474
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
|
|
48085
48475
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48086
48476
|
},
|
|
48087
48477
|
{
|
|
48088
48478
|
label: `Delete Expense`,
|
|
48089
|
-
icon: /* @__PURE__ */ (0,
|
|
48479
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
|
|
48090
48480
|
onClick: () => {
|
|
48091
48481
|
openTransaction({
|
|
48092
48482
|
id: data2?._id,
|
|
@@ -48102,9 +48492,9 @@ function Expenses3({ url }) {
|
|
|
48102
48492
|
header: "Date",
|
|
48103
48493
|
cell: ({ row }) => {
|
|
48104
48494
|
const expense = row.original;
|
|
48105
|
-
return /* @__PURE__ */ (0,
|
|
48106
|
-
/* @__PURE__ */ (0,
|
|
48107
|
-
/* @__PURE__ */ (0,
|
|
48495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex flex-col", children: [
|
|
48496
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { children: expense?.date }),
|
|
48497
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48108
48498
|
"span",
|
|
48109
48499
|
{
|
|
48110
48500
|
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
@@ -48120,9 +48510,9 @@ function Expenses3({ url }) {
|
|
|
48120
48510
|
header: "Description",
|
|
48121
48511
|
cell: ({ row }) => {
|
|
48122
48512
|
const expense = row.original;
|
|
48123
|
-
return /* @__PURE__ */ (0,
|
|
48124
|
-
/* @__PURE__ */ (0,
|
|
48125
|
-
expense?.note && /* @__PURE__ */ (0,
|
|
48513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex flex-col", children: [
|
|
48514
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "capitalize", children: expense?.description }),
|
|
48515
|
+
expense?.note && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48126
48516
|
] });
|
|
48127
48517
|
}
|
|
48128
48518
|
},
|
|
@@ -48132,7 +48522,7 @@ function Expenses3({ url }) {
|
|
|
48132
48522
|
cell: ({ row }) => {
|
|
48133
48523
|
const expense = row.original;
|
|
48134
48524
|
const walletData = expense?.fromWalletData || expense?.toWalletData;
|
|
48135
|
-
return /* @__PURE__ */ (0,
|
|
48525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { children: walletData?.name || "N/A" });
|
|
48136
48526
|
}
|
|
48137
48527
|
},
|
|
48138
48528
|
{
|
|
@@ -48140,7 +48530,7 @@ function Expenses3({ url }) {
|
|
|
48140
48530
|
header: "Amount",
|
|
48141
48531
|
cell: ({ row }) => {
|
|
48142
48532
|
const expense = row.original;
|
|
48143
|
-
return /* @__PURE__ */ (0,
|
|
48533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }) });
|
|
48144
48534
|
}
|
|
48145
48535
|
},
|
|
48146
48536
|
{
|
|
@@ -48148,23 +48538,23 @@ function Expenses3({ url }) {
|
|
|
48148
48538
|
header: "Actions",
|
|
48149
48539
|
cell: ({ row }) => {
|
|
48150
48540
|
const data2 = row.original;
|
|
48151
|
-
return /* @__PURE__ */ (0,
|
|
48541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48152
48542
|
Dropdown,
|
|
48153
48543
|
{
|
|
48154
48544
|
className: "cursor-pointer w-[150px]",
|
|
48155
48545
|
items: items(data2),
|
|
48156
48546
|
triggerMode: "hover",
|
|
48157
|
-
children: /* @__PURE__ */ (0,
|
|
48547
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.EllipsisVertical, {})
|
|
48158
48548
|
}
|
|
48159
48549
|
);
|
|
48160
48550
|
}
|
|
48161
48551
|
}
|
|
48162
48552
|
];
|
|
48163
48553
|
const expenses = data?.data || [];
|
|
48164
|
-
return /* @__PURE__ */ (0,
|
|
48165
|
-
/* @__PURE__ */ (0,
|
|
48166
|
-
/* @__PURE__ */ (0,
|
|
48167
|
-
/* @__PURE__ */ (0,
|
|
48554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
|
|
48555
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
|
|
48556
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Modal2, {}),
|
|
48557
|
+
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48168
48558
|
TransactionViewComponent,
|
|
48169
48559
|
{
|
|
48170
48560
|
columns,
|
|
@@ -48183,8 +48573,8 @@ function Expenses3({ url }) {
|
|
|
48183
48573
|
var Expenses_default2 = Expenses3;
|
|
48184
48574
|
|
|
48185
48575
|
// src/components/Transactions/3/expense/ExpenseForm.tsx
|
|
48186
|
-
var
|
|
48187
|
-
var
|
|
48576
|
+
var import_react161 = require("react");
|
|
48577
|
+
var import_react_router_dom126 = require("react-router-dom");
|
|
48188
48578
|
var import_react_hook_form74 = require("react-hook-form");
|
|
48189
48579
|
var import_zod123 = require("@hookform/resolvers/zod");
|
|
48190
48580
|
var import_antd95 = require("antd");
|
|
@@ -48204,13 +48594,13 @@ var expenseSchema4 = import_zod122.z.object({
|
|
|
48204
48594
|
});
|
|
48205
48595
|
|
|
48206
48596
|
// src/components/Transactions/3/expense/ExpenseForm.tsx
|
|
48207
|
-
var
|
|
48597
|
+
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
48208
48598
|
function ExpenseForm2() {
|
|
48209
|
-
const { branchId } = (0,
|
|
48599
|
+
const { branchId } = (0, import_react_router_dom126.useParams)();
|
|
48210
48600
|
const { getQuery, navigate } = useApp_default();
|
|
48211
48601
|
const id = getQuery("id");
|
|
48212
48602
|
const isEdit = !!id;
|
|
48213
|
-
const [ref2, setRef] = (0,
|
|
48603
|
+
const [ref2, setRef] = (0, import_react161.useState)("");
|
|
48214
48604
|
const { post, isLoading } = useApis_default();
|
|
48215
48605
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48216
48606
|
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
@@ -48231,7 +48621,7 @@ function ExpenseForm2() {
|
|
|
48231
48621
|
const isRate = currency && currency !== defaultCurrency;
|
|
48232
48622
|
const amount = watch("amount");
|
|
48233
48623
|
const rate = watch("rate");
|
|
48234
|
-
const exchangedAmount2 = (0,
|
|
48624
|
+
const exchangedAmount2 = (0, import_react161.useMemo)(() => {
|
|
48235
48625
|
if (isRate) {
|
|
48236
48626
|
const am = forex_default.exchangedAmount({
|
|
48237
48627
|
accountCurrency: defaultCurrency,
|
|
@@ -48279,30 +48669,30 @@ function ExpenseForm2() {
|
|
|
48279
48669
|
navigate(-1);
|
|
48280
48670
|
}
|
|
48281
48671
|
};
|
|
48282
|
-
(0,
|
|
48672
|
+
(0, import_react161.useEffect)(() => {
|
|
48283
48673
|
if (isEdit) {
|
|
48284
48674
|
fetches();
|
|
48285
48675
|
}
|
|
48286
48676
|
}, [id]);
|
|
48287
|
-
return /* @__PURE__ */ (0,
|
|
48677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
|
|
48288
48678
|
Card,
|
|
48289
48679
|
{
|
|
48290
48680
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
48291
48681
|
isLoading: isLoadingGet,
|
|
48292
48682
|
loadingText: "Processing...",
|
|
48293
48683
|
children: [
|
|
48294
|
-
/* @__PURE__ */ (0,
|
|
48295
|
-
/* @__PURE__ */ (0,
|
|
48296
|
-
/* @__PURE__ */ (0,
|
|
48684
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(Card.Header, { children: [
|
|
48685
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
48686
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
48297
48687
|
] }),
|
|
48298
|
-
/* @__PURE__ */ (0,
|
|
48688
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
|
|
48299
48689
|
"form",
|
|
48300
48690
|
{
|
|
48301
48691
|
className: "space-y-4",
|
|
48302
48692
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
48303
48693
|
children: [
|
|
48304
|
-
/* @__PURE__ */ (0,
|
|
48305
|
-
/* @__PURE__ */ (0,
|
|
48694
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48695
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48306
48696
|
Fields_default.Input,
|
|
48307
48697
|
{
|
|
48308
48698
|
label: "Description",
|
|
@@ -48312,7 +48702,7 @@ function ExpenseForm2() {
|
|
|
48312
48702
|
required: true
|
|
48313
48703
|
}
|
|
48314
48704
|
),
|
|
48315
|
-
/* @__PURE__ */ (0,
|
|
48705
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48316
48706
|
Feilds_default2.Wallet,
|
|
48317
48707
|
{
|
|
48318
48708
|
label: "Wallet",
|
|
@@ -48325,8 +48715,8 @@ function ExpenseForm2() {
|
|
|
48325
48715
|
}
|
|
48326
48716
|
)
|
|
48327
48717
|
] }),
|
|
48328
|
-
/* @__PURE__ */ (0,
|
|
48329
|
-
/* @__PURE__ */ (0,
|
|
48718
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48719
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48330
48720
|
Fields_default.DateInput,
|
|
48331
48721
|
{
|
|
48332
48722
|
label: "Date",
|
|
@@ -48335,7 +48725,7 @@ function ExpenseForm2() {
|
|
|
48335
48725
|
required: true
|
|
48336
48726
|
}
|
|
48337
48727
|
),
|
|
48338
|
-
/* @__PURE__ */ (0,
|
|
48728
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48339
48729
|
Fields_default.Input,
|
|
48340
48730
|
{
|
|
48341
48731
|
label: "Amount",
|
|
@@ -48346,8 +48736,8 @@ function ExpenseForm2() {
|
|
|
48346
48736
|
required: true
|
|
48347
48737
|
}
|
|
48348
48738
|
),
|
|
48349
|
-
isRate && /* @__PURE__ */ (0,
|
|
48350
|
-
/* @__PURE__ */ (0,
|
|
48739
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
|
|
48740
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48351
48741
|
Fields_default.Input,
|
|
48352
48742
|
{
|
|
48353
48743
|
label: "Rate",
|
|
@@ -48358,7 +48748,7 @@ function ExpenseForm2() {
|
|
|
48358
48748
|
required: true
|
|
48359
48749
|
}
|
|
48360
48750
|
),
|
|
48361
|
-
/* @__PURE__ */ (0,
|
|
48751
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48362
48752
|
Fields_default.Input,
|
|
48363
48753
|
{
|
|
48364
48754
|
label: "Exchanged Amount",
|
|
@@ -48370,7 +48760,7 @@ function ExpenseForm2() {
|
|
|
48370
48760
|
)
|
|
48371
48761
|
] })
|
|
48372
48762
|
] }),
|
|
48373
|
-
/* @__PURE__ */ (0,
|
|
48763
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48374
48764
|
Fields_default.Textarea,
|
|
48375
48765
|
{
|
|
48376
48766
|
label: "Note",
|
|
@@ -48379,7 +48769,7 @@ function ExpenseForm2() {
|
|
|
48379
48769
|
placeholder: "Add any additional details..."
|
|
48380
48770
|
}
|
|
48381
48771
|
),
|
|
48382
|
-
/* @__PURE__ */ (0,
|
|
48772
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48383
48773
|
Button,
|
|
48384
48774
|
{
|
|
48385
48775
|
isLoading,
|
|
@@ -48407,153 +48797,17 @@ var Expenses32 = {
|
|
|
48407
48797
|
var expense_default = Expenses32;
|
|
48408
48798
|
|
|
48409
48799
|
// src/components/Transactions/3/reports/Expenses3Reports.tsx
|
|
48410
|
-
var
|
|
48411
|
-
var
|
|
48800
|
+
var import_react_router_dom127 = require("react-router-dom");
|
|
48801
|
+
var import_react162 = require("react");
|
|
48412
48802
|
var import_antd96 = require("antd");
|
|
48413
48803
|
var import_dayjs11 = __toESM(require("dayjs"));
|
|
48414
|
-
var
|
|
48804
|
+
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
48415
48805
|
var Expenses3Reports = () => {
|
|
48416
|
-
const { branchId } = (0,
|
|
48417
|
-
const [startDate, setStartDate] = (0, import_react161.useState)(null);
|
|
48418
|
-
const [endDate, setEndDate] = (0, import_react161.useState)(null);
|
|
48419
|
-
const { A4DataView, data } = useA4DataView_default({
|
|
48420
|
-
url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48421
|
-
v: 1
|
|
48422
|
-
// No prefix
|
|
48423
|
-
});
|
|
48424
|
-
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48425
|
-
const { defaultCurrency } = useWarqadConfig()?.currencies;
|
|
48426
|
-
const columns = [
|
|
48427
|
-
{
|
|
48428
|
-
header: "Date",
|
|
48429
|
-
key: "date",
|
|
48430
|
-
className: "text-xs whitespace-nowrap",
|
|
48431
|
-
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
|
|
48432
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48433
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48434
|
-
"span",
|
|
48435
|
-
{
|
|
48436
|
-
onClick: () => {
|
|
48437
|
-
openTransaction({
|
|
48438
|
-
id: row?._id,
|
|
48439
|
-
type: row?.type
|
|
48440
|
-
});
|
|
48441
|
-
},
|
|
48442
|
-
className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
|
|
48443
|
-
children: row?.ref
|
|
48444
|
-
}
|
|
48445
|
-
)
|
|
48446
|
-
] })
|
|
48447
|
-
},
|
|
48448
|
-
{
|
|
48449
|
-
header: "Description",
|
|
48450
|
-
key: "description",
|
|
48451
|
-
className: "text-xs whitespace-nowrap ",
|
|
48452
|
-
render: (row) => {
|
|
48453
|
-
return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
|
|
48454
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
48455
|
-
row.note && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48456
|
-
] });
|
|
48457
|
-
}
|
|
48458
|
-
},
|
|
48459
|
-
{
|
|
48460
|
-
header: "Amount",
|
|
48461
|
-
key: "changedAmountString",
|
|
48462
|
-
className: "text-xs whitespace-nowrap text-right",
|
|
48463
|
-
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48464
|
-
renderFooter: (data2) => {
|
|
48465
|
-
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48466
|
-
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48467
|
-
defaultCurrency
|
|
48468
|
-
) });
|
|
48469
|
-
}
|
|
48470
|
-
}
|
|
48471
|
-
];
|
|
48472
|
-
const datas = (0, import_react161.useMemo)(() => {
|
|
48473
|
-
let runningBalance = 0;
|
|
48474
|
-
let filteredData = data?.data || [];
|
|
48475
|
-
const mapped = filteredData.map((item) => {
|
|
48476
|
-
const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
|
|
48477
|
-
runningBalance += changedAmount;
|
|
48478
|
-
return {
|
|
48479
|
-
...item,
|
|
48480
|
-
changedAmountString: Formats_default.Amount(changedAmount, false),
|
|
48481
|
-
changedAmount,
|
|
48482
|
-
runningBalance
|
|
48483
|
-
};
|
|
48484
|
-
});
|
|
48485
|
-
let filtered = mapped;
|
|
48486
|
-
if (startDate) {
|
|
48487
|
-
const startOfDay = startDate.startOf("day");
|
|
48488
|
-
filtered = filtered.filter((tx) => {
|
|
48489
|
-
const rawDate = tx.dateObj || tx.date;
|
|
48490
|
-
if (!rawDate) return false;
|
|
48491
|
-
const txDate = (0, import_dayjs11.default)(rawDate);
|
|
48492
|
-
return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
|
|
48493
|
-
});
|
|
48494
|
-
}
|
|
48495
|
-
if (endDate) {
|
|
48496
|
-
const endOfDay = endDate.endOf("day");
|
|
48497
|
-
filtered = filtered.filter((tx) => {
|
|
48498
|
-
const rawDate = tx.dateObj || tx.date;
|
|
48499
|
-
if (!rawDate) return false;
|
|
48500
|
-
const txDate = (0, import_dayjs11.default)(rawDate);
|
|
48501
|
-
return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
|
|
48502
|
-
});
|
|
48503
|
-
}
|
|
48504
|
-
return filtered;
|
|
48505
|
-
}, [data, startDate, endDate]);
|
|
48506
|
-
return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
|
|
48507
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
|
|
48508
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48509
|
-
A4DataView,
|
|
48510
|
-
{
|
|
48511
|
-
columns,
|
|
48512
|
-
data: datas,
|
|
48513
|
-
index: true,
|
|
48514
|
-
title: `Expenses Report`,
|
|
48515
|
-
subtitle: `All Expenses`,
|
|
48516
|
-
fixed: false,
|
|
48517
|
-
headers: /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
48518
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48519
|
-
import_antd96.DatePicker,
|
|
48520
|
-
{
|
|
48521
|
-
placeholder: "Start Date",
|
|
48522
|
-
onChange: (date) => setStartDate(date),
|
|
48523
|
-
value: startDate,
|
|
48524
|
-
format: "DD/MM/YYYY",
|
|
48525
|
-
className: "min-w-[140px] max-w-[160px]"
|
|
48526
|
-
}
|
|
48527
|
-
),
|
|
48528
|
-
/* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
48529
|
-
import_antd96.DatePicker,
|
|
48530
|
-
{
|
|
48531
|
-
placeholder: "End Date",
|
|
48532
|
-
onChange: (date) => setEndDate(date),
|
|
48533
|
-
value: endDate,
|
|
48534
|
-
format: "DD/MM/YYYY",
|
|
48535
|
-
className: "min-w-[140px] max-w-[160px]"
|
|
48536
|
-
}
|
|
48537
|
-
)
|
|
48538
|
-
] })
|
|
48539
|
-
}
|
|
48540
|
-
)
|
|
48541
|
-
] });
|
|
48542
|
-
};
|
|
48543
|
-
var Expenses3Reports_default = Expenses3Reports;
|
|
48544
|
-
|
|
48545
|
-
// src/components/Transactions/3/reports/ExpensesJournal3.tsx
|
|
48546
|
-
var import_react_router_dom126 = require("react-router-dom");
|
|
48547
|
-
var import_react162 = require("react");
|
|
48548
|
-
var import_antd97 = require("antd");
|
|
48549
|
-
var import_dayjs12 = __toESM(require("dayjs"));
|
|
48550
|
-
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
48551
|
-
var Expenses3Reports2 = () => {
|
|
48552
|
-
const { branchId } = (0, import_react_router_dom126.useParams)();
|
|
48806
|
+
const { branchId } = (0, import_react_router_dom127.useParams)();
|
|
48553
48807
|
const [startDate, setStartDate] = (0, import_react162.useState)(null);
|
|
48554
48808
|
const [endDate, setEndDate] = (0, import_react162.useState)(null);
|
|
48555
48809
|
const { A4DataView, data } = useA4DataView_default({
|
|
48556
|
-
url: `/transactions/get?type=expense-
|
|
48810
|
+
url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48557
48811
|
v: 1
|
|
48558
48812
|
// No prefix
|
|
48559
48813
|
});
|
|
@@ -48564,9 +48818,9 @@ var Expenses3Reports2 = () => {
|
|
|
48564
48818
|
header: "Date",
|
|
48565
48819
|
key: "date",
|
|
48566
48820
|
className: "text-xs whitespace-nowrap",
|
|
48567
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48568
|
-
/* @__PURE__ */ (0,
|
|
48569
|
-
/* @__PURE__ */ (0,
|
|
48821
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "", children: [
|
|
48822
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48823
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48570
48824
|
"span",
|
|
48571
48825
|
{
|
|
48572
48826
|
onClick: () => {
|
|
@@ -48586,9 +48840,9 @@ var Expenses3Reports2 = () => {
|
|
|
48586
48840
|
key: "description",
|
|
48587
48841
|
className: "text-xs whitespace-nowrap ",
|
|
48588
48842
|
render: (row) => {
|
|
48589
|
-
return /* @__PURE__ */ (0,
|
|
48590
|
-
/* @__PURE__ */ (0,
|
|
48591
|
-
row.note && /* @__PURE__ */ (0,
|
|
48843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "", children: [
|
|
48844
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
48845
|
+
row.note && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48592
48846
|
] });
|
|
48593
48847
|
}
|
|
48594
48848
|
},
|
|
@@ -48596,9 +48850,9 @@ var Expenses3Reports2 = () => {
|
|
|
48596
48850
|
header: "Amount",
|
|
48597
48851
|
key: "changedAmountString",
|
|
48598
48852
|
className: "text-xs whitespace-nowrap text-right",
|
|
48599
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48853
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48600
48854
|
renderFooter: (data2) => {
|
|
48601
|
-
return /* @__PURE__ */ (0,
|
|
48855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48602
48856
|
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48603
48857
|
defaultCurrency
|
|
48604
48858
|
) });
|
|
@@ -48606,6 +48860,142 @@ var Expenses3Reports2 = () => {
|
|
|
48606
48860
|
}
|
|
48607
48861
|
];
|
|
48608
48862
|
const datas = (0, import_react162.useMemo)(() => {
|
|
48863
|
+
let runningBalance = 0;
|
|
48864
|
+
let filteredData = data?.data || [];
|
|
48865
|
+
const mapped = filteredData.map((item) => {
|
|
48866
|
+
const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
|
|
48867
|
+
runningBalance += changedAmount;
|
|
48868
|
+
return {
|
|
48869
|
+
...item,
|
|
48870
|
+
changedAmountString: Formats_default.Amount(changedAmount, false),
|
|
48871
|
+
changedAmount,
|
|
48872
|
+
runningBalance
|
|
48873
|
+
};
|
|
48874
|
+
});
|
|
48875
|
+
let filtered = mapped;
|
|
48876
|
+
if (startDate) {
|
|
48877
|
+
const startOfDay = startDate.startOf("day");
|
|
48878
|
+
filtered = filtered.filter((tx) => {
|
|
48879
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48880
|
+
if (!rawDate) return false;
|
|
48881
|
+
const txDate = (0, import_dayjs11.default)(rawDate);
|
|
48882
|
+
return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
|
|
48883
|
+
});
|
|
48884
|
+
}
|
|
48885
|
+
if (endDate) {
|
|
48886
|
+
const endOfDay = endDate.endOf("day");
|
|
48887
|
+
filtered = filtered.filter((tx) => {
|
|
48888
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48889
|
+
if (!rawDate) return false;
|
|
48890
|
+
const txDate = (0, import_dayjs11.default)(rawDate);
|
|
48891
|
+
return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
|
|
48892
|
+
});
|
|
48893
|
+
}
|
|
48894
|
+
return filtered;
|
|
48895
|
+
}, [data, startDate, endDate]);
|
|
48896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
|
|
48897
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(TransactionView, {}),
|
|
48898
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48899
|
+
A4DataView,
|
|
48900
|
+
{
|
|
48901
|
+
columns,
|
|
48902
|
+
data: datas,
|
|
48903
|
+
index: true,
|
|
48904
|
+
title: `Expenses Report`,
|
|
48905
|
+
subtitle: `All Expenses`,
|
|
48906
|
+
fixed: false,
|
|
48907
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
48908
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48909
|
+
import_antd96.DatePicker,
|
|
48910
|
+
{
|
|
48911
|
+
placeholder: "Start Date",
|
|
48912
|
+
onChange: (date) => setStartDate(date),
|
|
48913
|
+
value: startDate,
|
|
48914
|
+
format: "DD/MM/YYYY",
|
|
48915
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48916
|
+
}
|
|
48917
|
+
),
|
|
48918
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48919
|
+
import_antd96.DatePicker,
|
|
48920
|
+
{
|
|
48921
|
+
placeholder: "End Date",
|
|
48922
|
+
onChange: (date) => setEndDate(date),
|
|
48923
|
+
value: endDate,
|
|
48924
|
+
format: "DD/MM/YYYY",
|
|
48925
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48926
|
+
}
|
|
48927
|
+
)
|
|
48928
|
+
] })
|
|
48929
|
+
}
|
|
48930
|
+
)
|
|
48931
|
+
] });
|
|
48932
|
+
};
|
|
48933
|
+
var Expenses3Reports_default = Expenses3Reports;
|
|
48934
|
+
|
|
48935
|
+
// src/components/Transactions/3/reports/ExpensesJournal3.tsx
|
|
48936
|
+
var import_react_router_dom128 = require("react-router-dom");
|
|
48937
|
+
var import_react163 = require("react");
|
|
48938
|
+
var import_antd97 = require("antd");
|
|
48939
|
+
var import_dayjs12 = __toESM(require("dayjs"));
|
|
48940
|
+
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
48941
|
+
var Expenses3Reports2 = () => {
|
|
48942
|
+
const { branchId } = (0, import_react_router_dom128.useParams)();
|
|
48943
|
+
const [startDate, setStartDate] = (0, import_react163.useState)(null);
|
|
48944
|
+
const [endDate, setEndDate] = (0, import_react163.useState)(null);
|
|
48945
|
+
const { A4DataView, data } = useA4DataView_default({
|
|
48946
|
+
url: `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48947
|
+
v: 1
|
|
48948
|
+
// No prefix
|
|
48949
|
+
});
|
|
48950
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48951
|
+
const { defaultCurrency } = useWarqadConfig()?.currencies;
|
|
48952
|
+
const columns = [
|
|
48953
|
+
{
|
|
48954
|
+
header: "Date",
|
|
48955
|
+
key: "date",
|
|
48956
|
+
className: "text-xs whitespace-nowrap",
|
|
48957
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
|
|
48958
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48959
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48960
|
+
"span",
|
|
48961
|
+
{
|
|
48962
|
+
onClick: () => {
|
|
48963
|
+
openTransaction({
|
|
48964
|
+
id: row?._id,
|
|
48965
|
+
type: row?.type
|
|
48966
|
+
});
|
|
48967
|
+
},
|
|
48968
|
+
className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
|
|
48969
|
+
children: row?.ref
|
|
48970
|
+
}
|
|
48971
|
+
)
|
|
48972
|
+
] })
|
|
48973
|
+
},
|
|
48974
|
+
{
|
|
48975
|
+
header: "Description",
|
|
48976
|
+
key: "description",
|
|
48977
|
+
className: "text-xs whitespace-nowrap ",
|
|
48978
|
+
render: (row) => {
|
|
48979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
|
|
48980
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
48981
|
+
row.note && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48982
|
+
] });
|
|
48983
|
+
}
|
|
48984
|
+
},
|
|
48985
|
+
{
|
|
48986
|
+
header: "Amount",
|
|
48987
|
+
key: "changedAmountString",
|
|
48988
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
48989
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48990
|
+
renderFooter: (data2) => {
|
|
48991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48992
|
+
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48993
|
+
defaultCurrency
|
|
48994
|
+
) });
|
|
48995
|
+
}
|
|
48996
|
+
}
|
|
48997
|
+
];
|
|
48998
|
+
const datas = (0, import_react163.useMemo)(() => {
|
|
48609
48999
|
let runningBalance = 0;
|
|
48610
49000
|
let filteredData = data?.data || [];
|
|
48611
49001
|
const mapped = filteredData.map((item) => {
|
|
@@ -48639,9 +49029,9 @@ var Expenses3Reports2 = () => {
|
|
|
48639
49029
|
}
|
|
48640
49030
|
return filtered;
|
|
48641
49031
|
}, [data, startDate, endDate]);
|
|
48642
|
-
return /* @__PURE__ */ (0,
|
|
48643
|
-
/* @__PURE__ */ (0,
|
|
48644
|
-
/* @__PURE__ */ (0,
|
|
49032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
|
|
49033
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(TransactionView, {}),
|
|
49034
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48645
49035
|
A4DataView,
|
|
48646
49036
|
{
|
|
48647
49037
|
columns,
|
|
@@ -48650,8 +49040,8 @@ var Expenses3Reports2 = () => {
|
|
|
48650
49040
|
title: `Expenses Journal Report`,
|
|
48651
49041
|
subtitle: `All Expenses`,
|
|
48652
49042
|
fixed: false,
|
|
48653
|
-
headers: /* @__PURE__ */ (0,
|
|
48654
|
-
/* @__PURE__ */ (0,
|
|
49043
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
49044
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48655
49045
|
import_antd97.DatePicker,
|
|
48656
49046
|
{
|
|
48657
49047
|
placeholder: "Start Date",
|
|
@@ -48661,7 +49051,7 @@ var Expenses3Reports2 = () => {
|
|
|
48661
49051
|
className: "min-w-[140px] max-w-[160px]"
|
|
48662
49052
|
}
|
|
48663
49053
|
),
|
|
48664
|
-
/* @__PURE__ */ (0,
|
|
49054
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48665
49055
|
import_antd97.DatePicker,
|
|
48666
49056
|
{
|
|
48667
49057
|
placeholder: "End Date",
|
|
@@ -48686,12 +49076,12 @@ var Reports3 = {
|
|
|
48686
49076
|
var reports_default = Reports3;
|
|
48687
49077
|
|
|
48688
49078
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48689
|
-
var
|
|
48690
|
-
var
|
|
48691
|
-
var
|
|
49079
|
+
var import_react_router_dom129 = require("react-router-dom");
|
|
49080
|
+
var import_lucide_react127 = require("lucide-react");
|
|
49081
|
+
var import_jsx_runtime269 = require("react/jsx-runtime");
|
|
48692
49082
|
function ExpensesJournal3({ url }) {
|
|
48693
|
-
const { branchId } = (0,
|
|
48694
|
-
const navigate = (0,
|
|
49083
|
+
const { branchId } = (0, import_react_router_dom129.useParams)();
|
|
49084
|
+
const navigate = (0, import_react_router_dom129.useNavigate)();
|
|
48695
49085
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48696
49086
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48697
49087
|
url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -48701,17 +49091,17 @@ function ExpensesJournal3({ url }) {
|
|
|
48701
49091
|
const items = (data2) => [
|
|
48702
49092
|
{
|
|
48703
49093
|
label: `View Expense`,
|
|
48704
|
-
icon: /* @__PURE__ */ (0,
|
|
49094
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
|
|
48705
49095
|
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48706
49096
|
},
|
|
48707
49097
|
{
|
|
48708
49098
|
label: `Edit Expense`,
|
|
48709
|
-
icon: /* @__PURE__ */ (0,
|
|
49099
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
|
|
48710
49100
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48711
49101
|
},
|
|
48712
49102
|
{
|
|
48713
49103
|
label: `Delete Expense`,
|
|
48714
|
-
icon: /* @__PURE__ */ (0,
|
|
49104
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.Trash2, { className: "text-red-500", size: 16 }),
|
|
48715
49105
|
onClick: () => {
|
|
48716
49106
|
openTransaction({
|
|
48717
49107
|
id: data2?._id,
|
|
@@ -48727,9 +49117,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48727
49117
|
header: "Date",
|
|
48728
49118
|
cell: ({ row }) => {
|
|
48729
49119
|
const expense = row.original;
|
|
48730
|
-
return /* @__PURE__ */ (0,
|
|
48731
|
-
/* @__PURE__ */ (0,
|
|
48732
|
-
/* @__PURE__ */ (0,
|
|
49120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex flex-col", children: [
|
|
49121
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { children: expense?.date }),
|
|
49122
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
48733
49123
|
"span",
|
|
48734
49124
|
{
|
|
48735
49125
|
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
@@ -48745,9 +49135,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48745
49135
|
header: "Description",
|
|
48746
49136
|
cell: ({ row }) => {
|
|
48747
49137
|
const expense = row.original;
|
|
48748
|
-
return /* @__PURE__ */ (0,
|
|
48749
|
-
/* @__PURE__ */ (0,
|
|
48750
|
-
expense?.note && /* @__PURE__ */ (0,
|
|
49138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex flex-col", children: [
|
|
49139
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "capitalize", children: expense?.description }),
|
|
49140
|
+
expense?.note && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48751
49141
|
] });
|
|
48752
49142
|
}
|
|
48753
49143
|
},
|
|
@@ -48756,9 +49146,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48756
49146
|
header: "Amount",
|
|
48757
49147
|
cell: ({ row }) => {
|
|
48758
49148
|
const expense = row.original;
|
|
48759
|
-
return /* @__PURE__ */ (0,
|
|
48760
|
-
/* @__PURE__ */ (0,
|
|
48761
|
-
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0,
|
|
49149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "", children: [
|
|
49150
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
49151
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48762
49152
|
"rate ",
|
|
48763
49153
|
expense?.exchange?.rate,
|
|
48764
49154
|
" ,",
|
|
@@ -48776,23 +49166,23 @@ function ExpensesJournal3({ url }) {
|
|
|
48776
49166
|
header: "Actions",
|
|
48777
49167
|
cell: ({ row }) => {
|
|
48778
49168
|
const data2 = row.original;
|
|
48779
|
-
return /* @__PURE__ */ (0,
|
|
49169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
48780
49170
|
Dropdown,
|
|
48781
49171
|
{
|
|
48782
49172
|
className: "cursor-pointer w-[150px]",
|
|
48783
49173
|
items: items(data2),
|
|
48784
49174
|
triggerMode: "hover",
|
|
48785
|
-
children: /* @__PURE__ */ (0,
|
|
49175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.EllipsisVertical, {})
|
|
48786
49176
|
}
|
|
48787
49177
|
);
|
|
48788
49178
|
}
|
|
48789
49179
|
}
|
|
48790
49180
|
];
|
|
48791
49181
|
const expenses = data?.data || [];
|
|
48792
|
-
return /* @__PURE__ */ (0,
|
|
48793
|
-
/* @__PURE__ */ (0,
|
|
48794
|
-
/* @__PURE__ */ (0,
|
|
48795
|
-
/* @__PURE__ */ (0,
|
|
49182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
|
|
49183
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
|
|
49184
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Modal2, {}),
|
|
49185
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
48796
49186
|
TransactionViewComponent,
|
|
48797
49187
|
{
|
|
48798
49188
|
columns,
|
|
@@ -48811,8 +49201,8 @@ function ExpensesJournal3({ url }) {
|
|
|
48811
49201
|
var ExpensesJournal_default = ExpensesJournal3;
|
|
48812
49202
|
|
|
48813
49203
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48814
|
-
var
|
|
48815
|
-
var
|
|
49204
|
+
var import_react164 = require("react");
|
|
49205
|
+
var import_react_router_dom130 = require("react-router-dom");
|
|
48816
49206
|
var import_react_hook_form75 = require("react-hook-form");
|
|
48817
49207
|
var import_zod126 = require("@hookform/resolvers/zod");
|
|
48818
49208
|
var import_antd98 = require("antd");
|
|
@@ -48830,13 +49220,13 @@ var expenseSchema5 = import_zod125.z.object({
|
|
|
48830
49220
|
});
|
|
48831
49221
|
|
|
48832
49222
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48833
|
-
var
|
|
49223
|
+
var import_jsx_runtime270 = require("react/jsx-runtime");
|
|
48834
49224
|
function ExpensesJournal3Form() {
|
|
48835
|
-
const { branchId } = (0,
|
|
49225
|
+
const { branchId } = (0, import_react_router_dom130.useParams)();
|
|
48836
49226
|
const { getQuery, navigate } = useApp_default();
|
|
48837
49227
|
const id = getQuery("id");
|
|
48838
49228
|
const isEdit = !!id;
|
|
48839
|
-
const [ref2, setRef] = (0,
|
|
49229
|
+
const [ref2, setRef] = (0, import_react164.useState)("");
|
|
48840
49230
|
const { post, isLoading } = useApis_default();
|
|
48841
49231
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48842
49232
|
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
@@ -48855,7 +49245,7 @@ function ExpensesJournal3Form() {
|
|
|
48855
49245
|
const isRate = currency && currency !== defaultCurrency;
|
|
48856
49246
|
const amount = watch("amount");
|
|
48857
49247
|
const rate = watch("rate");
|
|
48858
|
-
const exchangedAmount2 = (0,
|
|
49248
|
+
const exchangedAmount2 = (0, import_react164.useMemo)(() => {
|
|
48859
49249
|
if (isRate) {
|
|
48860
49250
|
const am = forex_default.exchangedAmount({
|
|
48861
49251
|
accountCurrency: defaultCurrency,
|
|
@@ -48901,30 +49291,30 @@ function ExpensesJournal3Form() {
|
|
|
48901
49291
|
navigate(-1);
|
|
48902
49292
|
}
|
|
48903
49293
|
};
|
|
48904
|
-
(0,
|
|
49294
|
+
(0, import_react164.useEffect)(() => {
|
|
48905
49295
|
if (isEdit) {
|
|
48906
49296
|
fetches();
|
|
48907
49297
|
}
|
|
48908
49298
|
}, [id]);
|
|
48909
|
-
return /* @__PURE__ */ (0,
|
|
49299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
|
|
48910
49300
|
Card,
|
|
48911
49301
|
{
|
|
48912
49302
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
48913
49303
|
isLoading: isLoadingGet,
|
|
48914
49304
|
loadingText: "Processing...",
|
|
48915
49305
|
children: [
|
|
48916
|
-
/* @__PURE__ */ (0,
|
|
48917
|
-
/* @__PURE__ */ (0,
|
|
48918
|
-
/* @__PURE__ */ (0,
|
|
49306
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(Card.Header, { children: [
|
|
49307
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
49308
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
48919
49309
|
] }),
|
|
48920
|
-
/* @__PURE__ */ (0,
|
|
49310
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
|
|
48921
49311
|
"form",
|
|
48922
49312
|
{
|
|
48923
49313
|
className: "space-y-4",
|
|
48924
49314
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
48925
49315
|
children: [
|
|
48926
|
-
/* @__PURE__ */ (0,
|
|
48927
|
-
/* @__PURE__ */ (0,
|
|
49316
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49317
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48928
49318
|
Fields_default.Input,
|
|
48929
49319
|
{
|
|
48930
49320
|
label: "Description",
|
|
@@ -48934,7 +49324,7 @@ function ExpensesJournal3Form() {
|
|
|
48934
49324
|
required: true
|
|
48935
49325
|
}
|
|
48936
49326
|
),
|
|
48937
|
-
/* @__PURE__ */ (0,
|
|
49327
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48938
49328
|
Fields_default.Select,
|
|
48939
49329
|
{
|
|
48940
49330
|
label: "Currency",
|
|
@@ -48945,8 +49335,8 @@ function ExpensesJournal3Form() {
|
|
|
48945
49335
|
}
|
|
48946
49336
|
)
|
|
48947
49337
|
] }),
|
|
48948
|
-
/* @__PURE__ */ (0,
|
|
48949
|
-
/* @__PURE__ */ (0,
|
|
49338
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49339
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48950
49340
|
Fields_default.DateInput,
|
|
48951
49341
|
{
|
|
48952
49342
|
label: "Date",
|
|
@@ -48955,7 +49345,7 @@ function ExpensesJournal3Form() {
|
|
|
48955
49345
|
required: true
|
|
48956
49346
|
}
|
|
48957
49347
|
),
|
|
48958
|
-
/* @__PURE__ */ (0,
|
|
49348
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48959
49349
|
Fields_default.Input,
|
|
48960
49350
|
{
|
|
48961
49351
|
label: "Amount",
|
|
@@ -48966,8 +49356,8 @@ function ExpensesJournal3Form() {
|
|
|
48966
49356
|
required: true
|
|
48967
49357
|
}
|
|
48968
49358
|
),
|
|
48969
|
-
isRate && /* @__PURE__ */ (0,
|
|
48970
|
-
/* @__PURE__ */ (0,
|
|
49359
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
|
|
49360
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48971
49361
|
Fields_default.Input,
|
|
48972
49362
|
{
|
|
48973
49363
|
label: "Rate",
|
|
@@ -48978,7 +49368,7 @@ function ExpensesJournal3Form() {
|
|
|
48978
49368
|
required: true
|
|
48979
49369
|
}
|
|
48980
49370
|
),
|
|
48981
|
-
/* @__PURE__ */ (0,
|
|
49371
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48982
49372
|
Fields_default.Input,
|
|
48983
49373
|
{
|
|
48984
49374
|
label: "Exchanged Amount",
|
|
@@ -48990,7 +49380,7 @@ function ExpensesJournal3Form() {
|
|
|
48990
49380
|
)
|
|
48991
49381
|
] })
|
|
48992
49382
|
] }),
|
|
48993
|
-
/* @__PURE__ */ (0,
|
|
49383
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
48994
49384
|
Fields_default.Textarea,
|
|
48995
49385
|
{
|
|
48996
49386
|
label: "Note",
|
|
@@ -48999,7 +49389,7 @@ function ExpensesJournal3Form() {
|
|
|
48999
49389
|
placeholder: "Add any additional details..."
|
|
49000
49390
|
}
|
|
49001
49391
|
),
|
|
49002
|
-
/* @__PURE__ */ (0,
|
|
49392
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49003
49393
|
Button,
|
|
49004
49394
|
{
|
|
49005
49395
|
isLoading,
|
|
@@ -49034,31 +49424,33 @@ var Transaction3 = {
|
|
|
49034
49424
|
JournalsForm: JournalsForm_default,
|
|
49035
49425
|
Sale2: sale2_default2.List,
|
|
49036
49426
|
Sale2Form: sale2_default2.Form,
|
|
49427
|
+
Collection: sale2_default2.Collection,
|
|
49037
49428
|
Purchase3: purchase3_default.List,
|
|
49038
49429
|
Purchase3Form: purchase3_default.Form,
|
|
49039
49430
|
Expenses: expense_default.List,
|
|
49040
49431
|
ExpenseForm: expense_default.Form,
|
|
49041
49432
|
Reports: reports_default,
|
|
49042
|
-
ExpensesJournal3: expenseJournal_default
|
|
49433
|
+
ExpensesJournal3: expenseJournal_default,
|
|
49434
|
+
CollectionLevel: sale2_default2.CollectionLevel
|
|
49043
49435
|
};
|
|
49044
49436
|
var __default = Transaction3;
|
|
49045
49437
|
|
|
49046
49438
|
// src/components/reports/ItemReport.tsx
|
|
49047
|
-
var
|
|
49439
|
+
var import_react_router_dom131 = require("react-router-dom");
|
|
49048
49440
|
var import_zod127 = require("zod");
|
|
49049
49441
|
var import_react_hook_form76 = require("react-hook-form");
|
|
49050
49442
|
var import_zod128 = require("@hookform/resolvers/zod");
|
|
49051
|
-
var
|
|
49443
|
+
var import_react165 = require("react");
|
|
49052
49444
|
var import_antd99 = require("antd");
|
|
49053
|
-
var
|
|
49445
|
+
var import_jsx_runtime271 = require("react/jsx-runtime");
|
|
49054
49446
|
var ItemReport = ({
|
|
49055
49447
|
value = false,
|
|
49056
49448
|
type
|
|
49057
49449
|
}) => {
|
|
49058
49450
|
const { apiConfig } = useWarqadConfig();
|
|
49059
|
-
const { branchId } = (0,
|
|
49451
|
+
const { branchId } = (0, import_react_router_dom131.useParams)();
|
|
49060
49452
|
const { branches } = useAuth_default();
|
|
49061
|
-
const [params, setParams] = (0,
|
|
49453
|
+
const [params, setParams] = (0, import_react165.useState)({
|
|
49062
49454
|
id: "",
|
|
49063
49455
|
branch: "all"
|
|
49064
49456
|
});
|
|
@@ -49083,9 +49475,9 @@ var ItemReport = ({
|
|
|
49083
49475
|
header: "Date",
|
|
49084
49476
|
key: "date",
|
|
49085
49477
|
className: "text-xs whitespace-nowrap",
|
|
49086
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49087
|
-
/* @__PURE__ */ (0,
|
|
49088
|
-
/* @__PURE__ */ (0,
|
|
49478
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "", children: [
|
|
49479
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49480
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49089
49481
|
"span",
|
|
49090
49482
|
{
|
|
49091
49483
|
onClick: () => {
|
|
@@ -49104,7 +49496,7 @@ var ItemReport = ({
|
|
|
49104
49496
|
header: "Description",
|
|
49105
49497
|
key: "description",
|
|
49106
49498
|
className: "text-xs whitespace-nowrap",
|
|
49107
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49499
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
49108
49500
|
},
|
|
49109
49501
|
{
|
|
49110
49502
|
header: "Quantity",
|
|
@@ -49112,7 +49504,7 @@ var ItemReport = ({
|
|
|
49112
49504
|
className: "text-xs whitespace-nowrap",
|
|
49113
49505
|
render: (row) => {
|
|
49114
49506
|
const Qty = row.quantity;
|
|
49115
|
-
return /* @__PURE__ */ (0,
|
|
49507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49116
49508
|
"div",
|
|
49117
49509
|
{
|
|
49118
49510
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -49129,7 +49521,7 @@ var ItemReport = ({
|
|
|
49129
49521
|
header: "Balance",
|
|
49130
49522
|
key: "runningBalance",
|
|
49131
49523
|
className: "text-xs whitespace-nowrap",
|
|
49132
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49524
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
49133
49525
|
}
|
|
49134
49526
|
];
|
|
49135
49527
|
let runningBalance = 0;
|
|
@@ -49141,10 +49533,10 @@ var ItemReport = ({
|
|
|
49141
49533
|
};
|
|
49142
49534
|
});
|
|
49143
49535
|
const itemName = datas[0]?.name;
|
|
49144
|
-
return /* @__PURE__ */ (0,
|
|
49145
|
-
/* @__PURE__ */ (0,
|
|
49146
|
-
/* @__PURE__ */ (0,
|
|
49147
|
-
/* @__PURE__ */ (0,
|
|
49536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
|
|
49537
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Modal2, {}),
|
|
49538
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(TransactionView, {}),
|
|
49539
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49148
49540
|
A4DataView,
|
|
49149
49541
|
{
|
|
49150
49542
|
columns,
|
|
@@ -49155,14 +49547,14 @@ var ItemReport = ({
|
|
|
49155
49547
|
tableTitle: `${type} Movement Report`,
|
|
49156
49548
|
fixed: false,
|
|
49157
49549
|
error: !id ? "Please select an item" : void 0,
|
|
49158
|
-
headers: /* @__PURE__ */ (0,
|
|
49550
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49159
49551
|
Button,
|
|
49160
49552
|
{
|
|
49161
49553
|
type: "button",
|
|
49162
49554
|
size: "sm",
|
|
49163
49555
|
onClick: () => openState({
|
|
49164
49556
|
title: "Item Transactions",
|
|
49165
|
-
content: /* @__PURE__ */ (0,
|
|
49557
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49166
49558
|
ItemReportHeader2,
|
|
49167
49559
|
{
|
|
49168
49560
|
type,
|
|
@@ -49205,7 +49597,7 @@ function ItemReportHeader2({
|
|
|
49205
49597
|
label: b.name,
|
|
49206
49598
|
value: b._id
|
|
49207
49599
|
}));
|
|
49208
|
-
return /* @__PURE__ */ (0,
|
|
49600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49209
49601
|
"form",
|
|
49210
49602
|
{
|
|
49211
49603
|
className: "space-y-3",
|
|
@@ -49223,8 +49615,8 @@ function ItemReportHeader2({
|
|
|
49223
49615
|
close();
|
|
49224
49616
|
}),
|
|
49225
49617
|
children: [
|
|
49226
|
-
/* @__PURE__ */ (0,
|
|
49227
|
-
/* @__PURE__ */ (0,
|
|
49618
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49619
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49228
49620
|
Select,
|
|
49229
49621
|
{
|
|
49230
49622
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -49232,7 +49624,7 @@ function ItemReportHeader2({
|
|
|
49232
49624
|
name: "branch"
|
|
49233
49625
|
}
|
|
49234
49626
|
),
|
|
49235
|
-
type === "pack" ? /* @__PURE__ */ (0,
|
|
49627
|
+
type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49236
49628
|
Pack_default.Pack,
|
|
49237
49629
|
{
|
|
49238
49630
|
api: "/packs/get",
|
|
@@ -49240,7 +49632,7 @@ function ItemReportHeader2({
|
|
|
49240
49632
|
form: methods,
|
|
49241
49633
|
name: "pack"
|
|
49242
49634
|
}
|
|
49243
|
-
) : /* @__PURE__ */ (0,
|
|
49635
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49244
49636
|
Feilds_default5.Product,
|
|
49245
49637
|
{
|
|
49246
49638
|
label: "",
|
|
@@ -49251,7 +49643,7 @@ function ItemReportHeader2({
|
|
|
49251
49643
|
}
|
|
49252
49644
|
)
|
|
49253
49645
|
] }),
|
|
49254
|
-
/* @__PURE__ */ (0,
|
|
49646
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Button, { type: "submit", children: "Filter" }) })
|
|
49255
49647
|
]
|
|
49256
49648
|
}
|
|
49257
49649
|
);
|
|
@@ -49259,19 +49651,19 @@ function ItemReportHeader2({
|
|
|
49259
49651
|
var ItemReport_default = ItemReport;
|
|
49260
49652
|
|
|
49261
49653
|
// src/components/accounts/LeaseCollection.tsx
|
|
49262
|
-
var
|
|
49263
|
-
var
|
|
49264
|
-
var
|
|
49654
|
+
var import_react_router_dom132 = require("react-router-dom");
|
|
49655
|
+
var import_react166 = require("react");
|
|
49656
|
+
var import_jsx_runtime272 = require("react/jsx-runtime");
|
|
49265
49657
|
var LeaseCollection = ({
|
|
49266
49658
|
leaseType,
|
|
49267
49659
|
defaultCurrency = "KES"
|
|
49268
49660
|
}) => {
|
|
49269
|
-
const navigate = (0,
|
|
49270
|
-
const [searchParams] = (0,
|
|
49661
|
+
const navigate = (0, import_react_router_dom132.useNavigate)();
|
|
49662
|
+
const [searchParams] = (0, import_react_router_dom132.useSearchParams)();
|
|
49271
49663
|
const { apiConfig } = useWarqadConfig();
|
|
49272
|
-
const { branchId } = (0,
|
|
49664
|
+
const { branchId } = (0, import_react_router_dom132.useParams)();
|
|
49273
49665
|
const { branches } = useAuth_default();
|
|
49274
|
-
const currentBranch = (0,
|
|
49666
|
+
const currentBranch = (0, import_react166.useMemo)(
|
|
49275
49667
|
() => branches?.find((b) => b?._id === branchId),
|
|
49276
49668
|
[branches, branchId]
|
|
49277
49669
|
);
|
|
@@ -49279,16 +49671,16 @@ var LeaseCollection = ({
|
|
|
49279
49671
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
49280
49672
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49281
49673
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
49282
|
-
const [filter, setFilter] = (0,
|
|
49674
|
+
const [filter, setFilter] = (0, import_react166.useState)(
|
|
49283
49675
|
initialFilter
|
|
49284
49676
|
);
|
|
49285
|
-
const [currencyFilter, setCurrencyFilter] = (0,
|
|
49286
|
-
(0,
|
|
49677
|
+
const [currencyFilter, setCurrencyFilter] = (0, import_react166.useState)(initialCurrency);
|
|
49678
|
+
(0, import_react166.useEffect)(() => {
|
|
49287
49679
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
49288
49680
|
setFilter(urlFilter);
|
|
49289
49681
|
}
|
|
49290
49682
|
}, [urlFilter]);
|
|
49291
|
-
(0,
|
|
49683
|
+
(0, import_react166.useEffect)(() => {
|
|
49292
49684
|
if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
|
|
49293
49685
|
setCurrencyFilter(urlCurrency);
|
|
49294
49686
|
} else {
|
|
@@ -49307,9 +49699,9 @@ var LeaseCollection = ({
|
|
|
49307
49699
|
key: "name",
|
|
49308
49700
|
className: "text-xs whitespace-nowrap ",
|
|
49309
49701
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
49310
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49311
|
-
/* @__PURE__ */ (0,
|
|
49312
|
-
row.unitNames && /* @__PURE__ */ (0,
|
|
49702
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-1", children: [
|
|
49703
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49704
|
+
row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("p", { className: "text-[9px]! capitalize", children: [
|
|
49313
49705
|
"(",
|
|
49314
49706
|
row.unitNames,
|
|
49315
49707
|
")"
|
|
@@ -49321,7 +49713,7 @@ var LeaseCollection = ({
|
|
|
49321
49713
|
key: "phoneNumber",
|
|
49322
49714
|
maxWidth: 70,
|
|
49323
49715
|
render: (row) => {
|
|
49324
|
-
return /* @__PURE__ */ (0,
|
|
49716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: row?.phoneNumber || "N/A" });
|
|
49325
49717
|
}
|
|
49326
49718
|
},
|
|
49327
49719
|
// </span>
|
|
@@ -49331,11 +49723,11 @@ var LeaseCollection = ({
|
|
|
49331
49723
|
className: "text-xs whitespace-nowrap text-right",
|
|
49332
49724
|
render: (row) => {
|
|
49333
49725
|
const Amount = row.totalCollectionString;
|
|
49334
|
-
return /* @__PURE__ */ (0,
|
|
49726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "font-bold ", children: Amount }) });
|
|
49335
49727
|
},
|
|
49336
49728
|
renderFooter: (data2) => {
|
|
49337
49729
|
if (currencyFilter === "all") return;
|
|
49338
|
-
return /* @__PURE__ */ (0,
|
|
49730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: " font-bold", children: Formats_default.Price(
|
|
49339
49731
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
49340
49732
|
defaultCurrency,
|
|
49341
49733
|
false
|
|
@@ -49343,7 +49735,7 @@ var LeaseCollection = ({
|
|
|
49343
49735
|
}
|
|
49344
49736
|
}
|
|
49345
49737
|
];
|
|
49346
|
-
const datas = (0,
|
|
49738
|
+
const datas = (0, import_react166.useMemo)(() => {
|
|
49347
49739
|
let runningBalance = 0;
|
|
49348
49740
|
let filteredData = data?.data || [];
|
|
49349
49741
|
const result = filteredData.map((item) => {
|
|
@@ -49356,9 +49748,9 @@ var LeaseCollection = ({
|
|
|
49356
49748
|
});
|
|
49357
49749
|
return result;
|
|
49358
49750
|
}, [filter, currencyFilter, data]);
|
|
49359
|
-
return /* @__PURE__ */ (0,
|
|
49360
|
-
/* @__PURE__ */ (0,
|
|
49361
|
-
/* @__PURE__ */ (0,
|
|
49751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_jsx_runtime272.Fragment, { children: [
|
|
49752
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(TransactionView, {}),
|
|
49753
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49362
49754
|
A4DataView,
|
|
49363
49755
|
{
|
|
49364
49756
|
columns,
|
|
@@ -49368,7 +49760,7 @@ var LeaseCollection = ({
|
|
|
49368
49760
|
subtitle: `All Collections`,
|
|
49369
49761
|
fixed: false,
|
|
49370
49762
|
startPage: 1e9,
|
|
49371
|
-
headers: /* @__PURE__ */ (0,
|
|
49763
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "flex gap-2" })
|
|
49372
49764
|
}
|
|
49373
49765
|
)
|
|
49374
49766
|
] });
|
|
@@ -49376,9 +49768,9 @@ var LeaseCollection = ({
|
|
|
49376
49768
|
var LeaseCollection_default = LeaseCollection;
|
|
49377
49769
|
|
|
49378
49770
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49379
|
-
var
|
|
49380
|
-
var
|
|
49381
|
-
var
|
|
49771
|
+
var import_react_router_dom136 = require("react-router-dom");
|
|
49772
|
+
var import_lucide_react129 = require("lucide-react");
|
|
49773
|
+
var import_react170 = require("react");
|
|
49382
49774
|
var import_antd103 = require("antd");
|
|
49383
49775
|
|
|
49384
49776
|
// src/components/Transactions/cargoIM/schema.ts
|
|
@@ -49414,15 +49806,15 @@ var journalSchema5 = import_zod130.z.object({
|
|
|
49414
49806
|
var import_react_hook_form77 = require("react-hook-form");
|
|
49415
49807
|
var import_zod131 = require("@hookform/resolvers/zod");
|
|
49416
49808
|
var import_antd100 = require("antd");
|
|
49417
|
-
var
|
|
49418
|
-
var
|
|
49419
|
-
var
|
|
49809
|
+
var import_react167 = require("react");
|
|
49810
|
+
var import_react_router_dom133 = require("react-router-dom");
|
|
49811
|
+
var import_jsx_runtime273 = require("react/jsx-runtime");
|
|
49420
49812
|
function AccountForm3({
|
|
49421
49813
|
onReload,
|
|
49422
49814
|
close,
|
|
49423
49815
|
id
|
|
49424
49816
|
}) {
|
|
49425
|
-
const { branchId } = (0,
|
|
49817
|
+
const { branchId } = (0, import_react_router_dom133.useParams)();
|
|
49426
49818
|
const { currencies } = useWarqadConfig();
|
|
49427
49819
|
const { stock } = currencies;
|
|
49428
49820
|
const isEdit = !!id;
|
|
@@ -49483,29 +49875,29 @@ function AccountForm3({
|
|
|
49483
49875
|
close?.();
|
|
49484
49876
|
}
|
|
49485
49877
|
};
|
|
49486
|
-
(0,
|
|
49878
|
+
(0, import_react167.useEffect)(() => {
|
|
49487
49879
|
if (isEdit) {
|
|
49488
49880
|
fetches();
|
|
49489
49881
|
}
|
|
49490
49882
|
}, [id]);
|
|
49491
|
-
return /* @__PURE__ */ (0,
|
|
49883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
|
|
49492
49884
|
Card,
|
|
49493
49885
|
{
|
|
49494
49886
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49495
49887
|
isLoading: isLoadingGet,
|
|
49496
49888
|
loadingText: "Processing...",
|
|
49497
49889
|
children: [
|
|
49498
|
-
/* @__PURE__ */ (0,
|
|
49499
|
-
/* @__PURE__ */ (0,
|
|
49500
|
-
/* @__PURE__ */ (0,
|
|
49890
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(Card.Header, { children: [
|
|
49891
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49892
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49501
49893
|
] }),
|
|
49502
|
-
/* @__PURE__ */ (0,
|
|
49894
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
|
|
49503
49895
|
"form",
|
|
49504
49896
|
{
|
|
49505
49897
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49506
49898
|
children: [
|
|
49507
|
-
/* @__PURE__ */ (0,
|
|
49508
|
-
/* @__PURE__ */ (0,
|
|
49899
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49900
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49509
49901
|
Fields_default.Input,
|
|
49510
49902
|
{
|
|
49511
49903
|
label: "Name",
|
|
@@ -49516,7 +49908,7 @@ function AccountForm3({
|
|
|
49516
49908
|
required: true
|
|
49517
49909
|
}
|
|
49518
49910
|
),
|
|
49519
|
-
/* @__PURE__ */ (0,
|
|
49911
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49520
49912
|
Fields_default.PhoneInput,
|
|
49521
49913
|
{
|
|
49522
49914
|
label: "Phone Number",
|
|
@@ -49525,7 +49917,7 @@ function AccountForm3({
|
|
|
49525
49917
|
placeholder: "Enter phone number"
|
|
49526
49918
|
}
|
|
49527
49919
|
),
|
|
49528
|
-
/* @__PURE__ */ (0,
|
|
49920
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49529
49921
|
Fields_default.Select,
|
|
49530
49922
|
{
|
|
49531
49923
|
label: "Currency",
|
|
@@ -49536,7 +49928,7 @@ function AccountForm3({
|
|
|
49536
49928
|
}
|
|
49537
49929
|
)
|
|
49538
49930
|
] }),
|
|
49539
|
-
/* @__PURE__ */ (0,
|
|
49931
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49540
49932
|
Button,
|
|
49541
49933
|
{
|
|
49542
49934
|
isLoading,
|
|
@@ -49557,31 +49949,31 @@ function AccountForm3({
|
|
|
49557
49949
|
var AccountForm_default3 = AccountForm3;
|
|
49558
49950
|
|
|
49559
49951
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49560
|
-
var
|
|
49952
|
+
var import_react168 = require("react");
|
|
49561
49953
|
var import_react_hook_form78 = require("react-hook-form");
|
|
49562
49954
|
var import_zod132 = require("@hookform/resolvers/zod");
|
|
49563
|
-
var
|
|
49955
|
+
var import_react_router_dom134 = require("react-router-dom");
|
|
49564
49956
|
var import_antd101 = require("antd");
|
|
49565
|
-
var
|
|
49957
|
+
var import_lucide_react128 = require("lucide-react");
|
|
49566
49958
|
var import_dayjs13 = __toESM(require("dayjs"));
|
|
49567
|
-
var
|
|
49959
|
+
var import_jsx_runtime274 = require("react/jsx-runtime");
|
|
49568
49960
|
function InvoiceForm2({
|
|
49569
49961
|
onReload,
|
|
49570
49962
|
close,
|
|
49571
49963
|
accountData,
|
|
49572
49964
|
id
|
|
49573
49965
|
}) {
|
|
49574
|
-
const { branchId } = (0,
|
|
49575
|
-
const [ref2, setRef] = (0,
|
|
49966
|
+
const { branchId } = (0, import_react_router_dom134.useParams)();
|
|
49967
|
+
const [ref2, setRef] = (0, import_react168.useState)(void 0);
|
|
49576
49968
|
const { post, isLoading } = useApis_default();
|
|
49577
49969
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49578
49970
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49579
49971
|
const isEdit = !!id;
|
|
49580
49972
|
const { currencies } = useWarqadConfig();
|
|
49581
49973
|
const { stock: defaultCurrency } = currencies;
|
|
49582
|
-
const [itemName, setItemName] = (0,
|
|
49583
|
-
const [itemQuantity, setItemQuantity] = (0,
|
|
49584
|
-
const [itemPrice, setItemPrice] = (0,
|
|
49974
|
+
const [itemName, setItemName] = (0, import_react168.useState)("");
|
|
49975
|
+
const [itemQuantity, setItemQuantity] = (0, import_react168.useState)("");
|
|
49976
|
+
const [itemPrice, setItemPrice] = (0, import_react168.useState)("");
|
|
49585
49977
|
const methods = (0, import_react_hook_form78.useForm)({
|
|
49586
49978
|
resolver: (0, import_zod132.zodResolver)(createInvoiceManagerValidation2),
|
|
49587
49979
|
defaultValues: {
|
|
@@ -49610,7 +50002,7 @@ function InvoiceForm2({
|
|
|
49610
50002
|
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49611
50003
|
}
|
|
49612
50004
|
};
|
|
49613
|
-
(0,
|
|
50005
|
+
(0, import_react168.useEffect)(() => {
|
|
49614
50006
|
if (isEdit) {
|
|
49615
50007
|
fetches();
|
|
49616
50008
|
}
|
|
@@ -49685,25 +50077,25 @@ function InvoiceForm2({
|
|
|
49685
50077
|
e.preventDefault();
|
|
49686
50078
|
}
|
|
49687
50079
|
};
|
|
49688
|
-
return /* @__PURE__ */ (0,
|
|
50080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49689
50081
|
Card,
|
|
49690
50082
|
{
|
|
49691
50083
|
isLoading: getLoading,
|
|
49692
50084
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49693
|
-
children: /* @__PURE__ */ (0,
|
|
49694
|
-
/* @__PURE__ */ (0,
|
|
49695
|
-
/* @__PURE__ */ (0,
|
|
50085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(Card.Content, { children: [
|
|
50086
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("input", { type: "hidden", ...register("currency") }),
|
|
50087
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(
|
|
49696
50088
|
"form",
|
|
49697
50089
|
{
|
|
49698
50090
|
onSubmit: handleSubmit(onSubmit),
|
|
49699
50091
|
onKeyDown: handleKeyDown,
|
|
49700
50092
|
className: "space-y-6",
|
|
49701
50093
|
children: [
|
|
49702
|
-
/* @__PURE__ */ (0,
|
|
49703
|
-
/* @__PURE__ */ (0,
|
|
49704
|
-
/* @__PURE__ */ (0,
|
|
49705
|
-
/* @__PURE__ */ (0,
|
|
49706
|
-
/* @__PURE__ */ (0,
|
|
50094
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
50095
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
50096
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
50097
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
50098
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49707
50099
|
Fields_default.Input,
|
|
49708
50100
|
{
|
|
49709
50101
|
label: "Container No",
|
|
@@ -49712,7 +50104,7 @@ function InvoiceForm2({
|
|
|
49712
50104
|
onChange: (val) => setItemName(val)
|
|
49713
50105
|
}
|
|
49714
50106
|
),
|
|
49715
|
-
/* @__PURE__ */ (0,
|
|
50107
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49716
50108
|
Fields_default.Input,
|
|
49717
50109
|
{
|
|
49718
50110
|
label: "Cbm",
|
|
@@ -49722,7 +50114,7 @@ function InvoiceForm2({
|
|
|
49722
50114
|
onChange: (val) => setItemQuantity(val)
|
|
49723
50115
|
}
|
|
49724
50116
|
),
|
|
49725
|
-
/* @__PURE__ */ (0,
|
|
50117
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49726
50118
|
Fields_default.Input,
|
|
49727
50119
|
{
|
|
49728
50120
|
label: "Price (KES)",
|
|
@@ -49733,7 +50125,7 @@ function InvoiceForm2({
|
|
|
49733
50125
|
}
|
|
49734
50126
|
)
|
|
49735
50127
|
] }),
|
|
49736
|
-
/* @__PURE__ */ (0,
|
|
50128
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(
|
|
49737
50129
|
Button,
|
|
49738
50130
|
{
|
|
49739
50131
|
type: "button",
|
|
@@ -49741,23 +50133,23 @@ function InvoiceForm2({
|
|
|
49741
50133
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49742
50134
|
variant: "outline",
|
|
49743
50135
|
children: [
|
|
49744
|
-
/* @__PURE__ */ (0,
|
|
50136
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.Plus, { size: 16 }),
|
|
49745
50137
|
" Add Item"
|
|
49746
50138
|
]
|
|
49747
50139
|
}
|
|
49748
50140
|
)
|
|
49749
50141
|
] })
|
|
49750
50142
|
] }),
|
|
49751
|
-
/* @__PURE__ */ (0,
|
|
49752
|
-
/* @__PURE__ */ (0,
|
|
49753
|
-
/* @__PURE__ */ (0,
|
|
49754
|
-
/* @__PURE__ */ (0,
|
|
49755
|
-
/* @__PURE__ */ (0,
|
|
49756
|
-
/* @__PURE__ */ (0,
|
|
49757
|
-
/* @__PURE__ */ (0,
|
|
49758
|
-
/* @__PURE__ */ (0,
|
|
50143
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { children: [
|
|
50144
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
50145
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("table", { className: "w-full text-left border-collapse", children: [
|
|
50146
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("tr", { children: [
|
|
50147
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
|
|
50148
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
|
|
50149
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
|
|
50150
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
|
|
49759
50151
|
] }) }),
|
|
49760
|
-
/* @__PURE__ */ (0,
|
|
50152
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49761
50153
|
"td",
|
|
49762
50154
|
{
|
|
49763
50155
|
colSpan: 4,
|
|
@@ -49766,30 +50158,30 @@ function InvoiceForm2({
|
|
|
49766
50158
|
}
|
|
49767
50159
|
) }) : fields.map((item, index) => {
|
|
49768
50160
|
const total = item.quantity * item.amount;
|
|
49769
|
-
return /* @__PURE__ */ (0,
|
|
50161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(
|
|
49770
50162
|
"tr",
|
|
49771
50163
|
{
|
|
49772
50164
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49773
50165
|
children: [
|
|
49774
|
-
/* @__PURE__ */ (0,
|
|
49775
|
-
/* @__PURE__ */ (0,
|
|
49776
|
-
/* @__PURE__ */ (0,
|
|
49777
|
-
/* @__PURE__ */ (0,
|
|
50166
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
|
|
50167
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
50168
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
50169
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49778
50170
|
item.quantity,
|
|
49779
50171
|
" Cbm @",
|
|
49780
50172
|
" ",
|
|
49781
50173
|
Formats_default.Price(item.amount, "KES")
|
|
49782
50174
|
] })
|
|
49783
50175
|
] }),
|
|
49784
|
-
/* @__PURE__ */ (0,
|
|
49785
|
-
/* @__PURE__ */ (0,
|
|
50176
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
|
|
50177
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49786
50178
|
"button",
|
|
49787
50179
|
{
|
|
49788
50180
|
type: "button",
|
|
49789
50181
|
onClick: () => remove(index),
|
|
49790
50182
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49791
|
-
children: /* @__PURE__ */ (0,
|
|
49792
|
-
|
|
50183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50184
|
+
import_lucide_react128.Trash2,
|
|
49793
50185
|
{
|
|
49794
50186
|
size: 13,
|
|
49795
50187
|
className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
|
|
@@ -49802,8 +50194,8 @@ function InvoiceForm2({
|
|
|
49802
50194
|
item.id
|
|
49803
50195
|
);
|
|
49804
50196
|
}) }),
|
|
49805
|
-
fields.length > 0 && /* @__PURE__ */ (0,
|
|
49806
|
-
/* @__PURE__ */ (0,
|
|
50197
|
+
fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("tr", { children: [
|
|
50198
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49807
50199
|
"td",
|
|
49808
50200
|
{
|
|
49809
50201
|
colSpan: 2,
|
|
@@ -49811,20 +50203,20 @@ function InvoiceForm2({
|
|
|
49811
50203
|
children: "Total"
|
|
49812
50204
|
}
|
|
49813
50205
|
),
|
|
49814
|
-
/* @__PURE__ */ (0,
|
|
50206
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
|
|
49815
50207
|
fields.reduce(
|
|
49816
50208
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49817
50209
|
0
|
|
49818
50210
|
),
|
|
49819
50211
|
"KES"
|
|
49820
50212
|
) }),
|
|
49821
|
-
/* @__PURE__ */ (0,
|
|
50213
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", {})
|
|
49822
50214
|
] }) })
|
|
49823
50215
|
] }) }) })
|
|
49824
50216
|
] }),
|
|
49825
|
-
/* @__PURE__ */ (0,
|
|
49826
|
-
/* @__PURE__ */ (0,
|
|
49827
|
-
/* @__PURE__ */ (0,
|
|
50217
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
50218
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50219
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49828
50220
|
Fields_default.DateInput,
|
|
49829
50221
|
{
|
|
49830
50222
|
label: "Date",
|
|
@@ -49833,20 +50225,20 @@ function InvoiceForm2({
|
|
|
49833
50225
|
required: true
|
|
49834
50226
|
}
|
|
49835
50227
|
),
|
|
49836
|
-
/* @__PURE__ */ (0,
|
|
50228
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49837
50229
|
] }),
|
|
49838
|
-
/* @__PURE__ */ (0,
|
|
49839
|
-
/* @__PURE__ */ (0,
|
|
50230
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
|
|
50231
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49840
50232
|
ConfirmModal,
|
|
49841
50233
|
{
|
|
49842
50234
|
title: "Reverse Transaction",
|
|
49843
|
-
description: /* @__PURE__ */ (0,
|
|
49844
|
-
/* @__PURE__ */ (0,
|
|
49845
|
-
/* @__PURE__ */ (0,
|
|
50235
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "space-y-3 text-left", children: [
|
|
50236
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50237
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
49846
50238
|
] }),
|
|
49847
50239
|
confirmationWord: "delete",
|
|
49848
50240
|
onSubmit: onReverse,
|
|
49849
|
-
children: /* @__PURE__ */ (0,
|
|
50241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49850
50242
|
Button,
|
|
49851
50243
|
{
|
|
49852
50244
|
type: "button",
|
|
@@ -49859,8 +50251,8 @@ function InvoiceForm2({
|
|
|
49859
50251
|
)
|
|
49860
50252
|
}
|
|
49861
50253
|
) }),
|
|
49862
|
-
/* @__PURE__ */ (0,
|
|
49863
|
-
close && /* @__PURE__ */ (0,
|
|
50254
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex justify-end gap-3", children: [
|
|
50255
|
+
close && /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49864
50256
|
Button,
|
|
49865
50257
|
{
|
|
49866
50258
|
type: "button",
|
|
@@ -49870,7 +50262,7 @@ function InvoiceForm2({
|
|
|
49870
50262
|
children: "Cancel"
|
|
49871
50263
|
}
|
|
49872
50264
|
),
|
|
49873
|
-
/* @__PURE__ */ (0,
|
|
50265
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49874
50266
|
Button,
|
|
49875
50267
|
{
|
|
49876
50268
|
isLoading,
|
|
@@ -49894,13 +50286,13 @@ function InvoiceForm2({
|
|
|
49894
50286
|
var InvoiceForm_default2 = InvoiceForm2;
|
|
49895
50287
|
|
|
49896
50288
|
// src/components/Transactions/cargoIM/journalForm.tsx
|
|
49897
|
-
var
|
|
50289
|
+
var import_react169 = __toESM(require("react"));
|
|
49898
50290
|
var import_react_hook_form79 = require("react-hook-form");
|
|
49899
50291
|
var import_zod133 = require("@hookform/resolvers/zod");
|
|
49900
|
-
var
|
|
50292
|
+
var import_react_router_dom135 = require("react-router-dom");
|
|
49901
50293
|
var import_antd102 = require("antd");
|
|
49902
50294
|
var import_dayjs14 = __toESM(require("dayjs"));
|
|
49903
|
-
var
|
|
50295
|
+
var import_jsx_runtime275 = require("react/jsx-runtime");
|
|
49904
50296
|
function JournalForm5({
|
|
49905
50297
|
onReload,
|
|
49906
50298
|
close,
|
|
@@ -49908,10 +50300,10 @@ function JournalForm5({
|
|
|
49908
50300
|
action = "debit",
|
|
49909
50301
|
id
|
|
49910
50302
|
}) {
|
|
49911
|
-
const { branchId } = (0,
|
|
50303
|
+
const { branchId } = (0, import_react_router_dom135.useParams)();
|
|
49912
50304
|
const { currencies } = useWarqadConfig();
|
|
49913
50305
|
const { stock: defaultCurrency } = currencies;
|
|
49914
|
-
const [ref2, setRef] =
|
|
50306
|
+
const [ref2, setRef] = import_react169.default.useState(void 0);
|
|
49915
50307
|
const { post, isLoading } = useApis_default();
|
|
49916
50308
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49917
50309
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
@@ -49942,7 +50334,7 @@ function JournalForm5({
|
|
|
49942
50334
|
import_antd102.message.error(error?.message || "Something went wrong");
|
|
49943
50335
|
}
|
|
49944
50336
|
};
|
|
49945
|
-
|
|
50337
|
+
import_react169.default.useEffect(() => {
|
|
49946
50338
|
if (isEdit) {
|
|
49947
50339
|
fetches();
|
|
49948
50340
|
}
|
|
@@ -49991,19 +50383,19 @@ function JournalForm5({
|
|
|
49991
50383
|
e.preventDefault();
|
|
49992
50384
|
}
|
|
49993
50385
|
};
|
|
49994
|
-
return /* @__PURE__ */ (0,
|
|
50386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
49995
50387
|
Card,
|
|
49996
50388
|
{
|
|
49997
50389
|
isLoading: getLoading,
|
|
49998
50390
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49999
|
-
children: /* @__PURE__ */ (0,
|
|
50391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
50000
50392
|
"form",
|
|
50001
50393
|
{
|
|
50002
50394
|
onSubmit: handleSubmit(onSubmit),
|
|
50003
50395
|
onKeyDown: handleKeyDown,
|
|
50004
50396
|
className: "space-y-4",
|
|
50005
50397
|
children: [
|
|
50006
|
-
/* @__PURE__ */ (0,
|
|
50398
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50007
50399
|
Fields_default.Input,
|
|
50008
50400
|
{
|
|
50009
50401
|
label: "Description",
|
|
@@ -50014,8 +50406,8 @@ function JournalForm5({
|
|
|
50014
50406
|
placeholder: "Enter description"
|
|
50015
50407
|
}
|
|
50016
50408
|
),
|
|
50017
|
-
/* @__PURE__ */ (0,
|
|
50018
|
-
/* @__PURE__ */ (0,
|
|
50409
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50410
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50019
50411
|
Fields_default.DateInput,
|
|
50020
50412
|
{
|
|
50021
50413
|
label: "Date",
|
|
@@ -50024,7 +50416,7 @@ function JournalForm5({
|
|
|
50024
50416
|
required: true
|
|
50025
50417
|
}
|
|
50026
50418
|
),
|
|
50027
|
-
/* @__PURE__ */ (0,
|
|
50419
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50028
50420
|
Fields_default.Input,
|
|
50029
50421
|
{
|
|
50030
50422
|
label: "Currency",
|
|
@@ -50034,8 +50426,8 @@ function JournalForm5({
|
|
|
50034
50426
|
}
|
|
50035
50427
|
)
|
|
50036
50428
|
] }),
|
|
50037
|
-
/* @__PURE__ */ (0,
|
|
50038
|
-
/* @__PURE__ */ (0,
|
|
50429
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50430
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50039
50431
|
Fields_default.Input,
|
|
50040
50432
|
{
|
|
50041
50433
|
label: "Amount",
|
|
@@ -50046,7 +50438,7 @@ function JournalForm5({
|
|
|
50046
50438
|
placeholder: "0.00"
|
|
50047
50439
|
}
|
|
50048
50440
|
),
|
|
50049
|
-
/* @__PURE__ */ (0,
|
|
50441
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50050
50442
|
Fields_default.Select,
|
|
50051
50443
|
{
|
|
50052
50444
|
label: "Action",
|
|
@@ -50060,7 +50452,7 @@ function JournalForm5({
|
|
|
50060
50452
|
}
|
|
50061
50453
|
)
|
|
50062
50454
|
] }),
|
|
50063
|
-
/* @__PURE__ */ (0,
|
|
50455
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50064
50456
|
Fields_default.Textarea,
|
|
50065
50457
|
{
|
|
50066
50458
|
label: "Note",
|
|
@@ -50070,18 +50462,18 @@ function JournalForm5({
|
|
|
50070
50462
|
rows: 3
|
|
50071
50463
|
}
|
|
50072
50464
|
),
|
|
50073
|
-
/* @__PURE__ */ (0,
|
|
50074
|
-
/* @__PURE__ */ (0,
|
|
50465
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
50466
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50075
50467
|
ConfirmModal,
|
|
50076
50468
|
{
|
|
50077
50469
|
title: "Reverse Transaction",
|
|
50078
|
-
description: /* @__PURE__ */ (0,
|
|
50079
|
-
/* @__PURE__ */ (0,
|
|
50080
|
-
/* @__PURE__ */ (0,
|
|
50470
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "space-y-3 text-left", children: [
|
|
50471
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50472
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
50081
50473
|
] }),
|
|
50082
50474
|
confirmationWord: "delete",
|
|
50083
50475
|
onSubmit: onReverse,
|
|
50084
|
-
children: /* @__PURE__ */ (0,
|
|
50476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50085
50477
|
Button,
|
|
50086
50478
|
{
|
|
50087
50479
|
type: "button",
|
|
@@ -50094,8 +50486,8 @@ function JournalForm5({
|
|
|
50094
50486
|
)
|
|
50095
50487
|
}
|
|
50096
50488
|
) }),
|
|
50097
|
-
/* @__PURE__ */ (0,
|
|
50098
|
-
close && /* @__PURE__ */ (0,
|
|
50489
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex justify-end gap-3", children: [
|
|
50490
|
+
close && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50099
50491
|
Button,
|
|
50100
50492
|
{
|
|
50101
50493
|
type: "button",
|
|
@@ -50105,7 +50497,7 @@ function JournalForm5({
|
|
|
50105
50497
|
children: "Cancel"
|
|
50106
50498
|
}
|
|
50107
50499
|
),
|
|
50108
|
-
/* @__PURE__ */ (0,
|
|
50500
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50109
50501
|
Button,
|
|
50110
50502
|
{
|
|
50111
50503
|
isLoading,
|
|
@@ -50127,15 +50519,15 @@ function JournalForm5({
|
|
|
50127
50519
|
var journalForm_default2 = JournalForm5;
|
|
50128
50520
|
|
|
50129
50521
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
50130
|
-
var
|
|
50522
|
+
var import_jsx_runtime276 = require("react/jsx-runtime");
|
|
50131
50523
|
function CargoIM({ v, url }) {
|
|
50132
|
-
const { branchId } = (0,
|
|
50524
|
+
const { branchId } = (0, import_react_router_dom136.useParams)();
|
|
50133
50525
|
const { apiConfig } = useWarqadConfig();
|
|
50134
50526
|
const { width } = useMediaSize();
|
|
50135
50527
|
const isLargeScreen = width > 768;
|
|
50136
|
-
const navigate = (0,
|
|
50528
|
+
const navigate = (0, import_react_router_dom136.useNavigate)();
|
|
50137
50529
|
const type = "supplier";
|
|
50138
|
-
const [deleteAccount, setDeleteAccount] = (0,
|
|
50530
|
+
const [deleteAccount, setDeleteAccount] = (0, import_react170.useState)(null);
|
|
50139
50531
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50140
50532
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50141
50533
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -50146,17 +50538,17 @@ function CargoIM({ v, url }) {
|
|
|
50146
50538
|
const items = (data2) => [
|
|
50147
50539
|
{
|
|
50148
50540
|
label: `Edit ${type}`,
|
|
50149
|
-
icon: /* @__PURE__ */ (0,
|
|
50541
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
|
|
50150
50542
|
onClick: () => openState({
|
|
50151
50543
|
type: "Account",
|
|
50152
|
-
content: /* @__PURE__ */ (0,
|
|
50544
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
50153
50545
|
title: "Account Form",
|
|
50154
50546
|
width: 800
|
|
50155
50547
|
})
|
|
50156
50548
|
},
|
|
50157
50549
|
{
|
|
50158
50550
|
label: `Delete ${type}`,
|
|
50159
|
-
icon: /* @__PURE__ */ (0,
|
|
50551
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
|
|
50160
50552
|
onClick: () => setDeleteAccount(data2)
|
|
50161
50553
|
}
|
|
50162
50554
|
].filter(Boolean);
|
|
@@ -50167,7 +50559,7 @@ function CargoIM({ v, url }) {
|
|
|
50167
50559
|
className: "w-full",
|
|
50168
50560
|
cell: ({ row }) => {
|
|
50169
50561
|
const account = row.original;
|
|
50170
|
-
return /* @__PURE__ */ (0,
|
|
50562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50171
50563
|
"span",
|
|
50172
50564
|
{
|
|
50173
50565
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -50196,8 +50588,8 @@ function CargoIM({ v, url }) {
|
|
|
50196
50588
|
className: "w-px whitespace-nowrap",
|
|
50197
50589
|
cell: ({ row }) => {
|
|
50198
50590
|
const data2 = row.original;
|
|
50199
|
-
return /* @__PURE__ */ (0,
|
|
50200
|
-
/* @__PURE__ */ (0,
|
|
50591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)("div", { className: "flex gap-4 items-center", children: [
|
|
50592
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50201
50593
|
"button",
|
|
50202
50594
|
{
|
|
50203
50595
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50205,7 +50597,7 @@ function CargoIM({ v, url }) {
|
|
|
50205
50597
|
openState({
|
|
50206
50598
|
type: "credit",
|
|
50207
50599
|
closeOnOverlayClick: false,
|
|
50208
|
-
content: /* @__PURE__ */ (0,
|
|
50600
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50209
50601
|
InvoiceForm_default2,
|
|
50210
50602
|
{
|
|
50211
50603
|
onReload: reload,
|
|
@@ -50220,7 +50612,7 @@ function CargoIM({ v, url }) {
|
|
|
50220
50612
|
children: "Inv"
|
|
50221
50613
|
}
|
|
50222
50614
|
),
|
|
50223
|
-
/* @__PURE__ */ (0,
|
|
50615
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50224
50616
|
"button",
|
|
50225
50617
|
{
|
|
50226
50618
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50228,7 +50620,7 @@ function CargoIM({ v, url }) {
|
|
|
50228
50620
|
openState({
|
|
50229
50621
|
type: "debit",
|
|
50230
50622
|
closeOnOverlayClick: false,
|
|
50231
|
-
content: /* @__PURE__ */ (0,
|
|
50623
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50232
50624
|
journalForm_default2,
|
|
50233
50625
|
{
|
|
50234
50626
|
onReload: reload,
|
|
@@ -50244,14 +50636,14 @@ function CargoIM({ v, url }) {
|
|
|
50244
50636
|
children: "Pay"
|
|
50245
50637
|
}
|
|
50246
50638
|
),
|
|
50247
|
-
/* @__PURE__ */ (0,
|
|
50639
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50248
50640
|
Dropdown,
|
|
50249
50641
|
{
|
|
50250
50642
|
className: "cursor-pointer",
|
|
50251
50643
|
width: "w-[150px]",
|
|
50252
50644
|
items: items(data2),
|
|
50253
50645
|
triggerMode: "hover",
|
|
50254
|
-
children: /* @__PURE__ */ (0,
|
|
50646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.EllipsisVertical, {})
|
|
50255
50647
|
}
|
|
50256
50648
|
)
|
|
50257
50649
|
] });
|
|
@@ -50275,9 +50667,9 @@ function CargoIM({ v, url }) {
|
|
|
50275
50667
|
return error;
|
|
50276
50668
|
}
|
|
50277
50669
|
};
|
|
50278
|
-
return /* @__PURE__ */ (0,
|
|
50279
|
-
/* @__PURE__ */ (0,
|
|
50280
|
-
/* @__PURE__ */ (0,
|
|
50670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
|
|
50671
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(Modal2, {}),
|
|
50672
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50281
50673
|
ConfirmModal,
|
|
50282
50674
|
{
|
|
50283
50675
|
isOpen: !!deleteAccount,
|
|
@@ -50290,7 +50682,7 @@ function CargoIM({ v, url }) {
|
|
|
50290
50682
|
children: null
|
|
50291
50683
|
}
|
|
50292
50684
|
),
|
|
50293
|
-
/* @__PURE__ */ (0,
|
|
50685
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50294
50686
|
TransactionViewComponent,
|
|
50295
50687
|
{
|
|
50296
50688
|
columns,
|
|
@@ -50301,7 +50693,7 @@ function CargoIM({ v, url }) {
|
|
|
50301
50693
|
onCreate: () => {
|
|
50302
50694
|
openState({
|
|
50303
50695
|
type: "account",
|
|
50304
|
-
content: /* @__PURE__ */ (0,
|
|
50696
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(AccountForm_default3, { onReload: reload, close }),
|
|
50305
50697
|
title: "Account Form",
|
|
50306
50698
|
width: 800
|
|
50307
50699
|
});
|
|
@@ -50313,9 +50705,9 @@ function CargoIM({ v, url }) {
|
|
|
50313
50705
|
var CargoIM_default = CargoIM;
|
|
50314
50706
|
|
|
50315
50707
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
50316
|
-
var
|
|
50317
|
-
var
|
|
50318
|
-
var
|
|
50708
|
+
var import_react_router_dom137 = require("react-router-dom");
|
|
50709
|
+
var import_react171 = require("react");
|
|
50710
|
+
var import_jsx_runtime277 = require("react/jsx-runtime");
|
|
50319
50711
|
var CargoIMReport = () => {
|
|
50320
50712
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
50321
50713
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -50328,10 +50720,10 @@ var CargoIMReport = () => {
|
|
|
50328
50720
|
value: currency2
|
|
50329
50721
|
};
|
|
50330
50722
|
});
|
|
50331
|
-
const [searchParams, setSearchParams] = (0,
|
|
50723
|
+
const [searchParams, setSearchParams] = (0, import_react_router_dom137.useSearchParams)();
|
|
50332
50724
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
50333
50725
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
50334
|
-
const [currencyFilter, setCurrencyFilter] = (0,
|
|
50726
|
+
const [currencyFilter, setCurrencyFilter] = (0, import_react171.useState)(initialCurrency);
|
|
50335
50727
|
const handleCurrencyChange = (value) => {
|
|
50336
50728
|
setCurrencyFilter(value);
|
|
50337
50729
|
setSearchParams((prev) => {
|
|
@@ -50339,7 +50731,7 @@ var CargoIMReport = () => {
|
|
|
50339
50731
|
return prev;
|
|
50340
50732
|
});
|
|
50341
50733
|
};
|
|
50342
|
-
(0,
|
|
50734
|
+
(0, import_react171.useEffect)(() => {
|
|
50343
50735
|
if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
|
|
50344
50736
|
setCurrencyFilter(urlCurrency);
|
|
50345
50737
|
}
|
|
@@ -50359,9 +50751,9 @@ var CargoIMReport = () => {
|
|
|
50359
50751
|
header: "Date",
|
|
50360
50752
|
key: "date",
|
|
50361
50753
|
className: "text-xs whitespace-nowrap",
|
|
50362
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50363
|
-
/* @__PURE__ */ (0,
|
|
50364
|
-
/* @__PURE__ */ (0,
|
|
50754
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)("div", { className: "", children: [
|
|
50755
|
+
/* @__PURE__ */ (0, import_jsx_runtime277.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50756
|
+
/* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50365
50757
|
"span",
|
|
50366
50758
|
{
|
|
50367
50759
|
onClick: () => {
|
|
@@ -50380,13 +50772,13 @@ var CargoIMReport = () => {
|
|
|
50380
50772
|
header: "Container No",
|
|
50381
50773
|
key: "description",
|
|
50382
50774
|
className: "text-xs w-full break-words",
|
|
50383
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50775
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50384
50776
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50385
50777
|
/[^a-zA-Z0-9]/g,
|
|
50386
50778
|
""
|
|
50387
50779
|
);
|
|
50388
50780
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50389
|
-
return /* @__PURE__ */ (0,
|
|
50781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50390
50782
|
"div",
|
|
50391
50783
|
{
|
|
50392
50784
|
className: `${lineClass} min-h-[24px] py-1 flex items-center font-bold capitalize text-black dark:text-white print:text-black whitespace-normal break-words`,
|
|
@@ -50400,13 +50792,13 @@ var CargoIMReport = () => {
|
|
|
50400
50792
|
header: "Cbm",
|
|
50401
50793
|
key: "cbm",
|
|
50402
50794
|
className: "text-xs whitespace-nowrap text-right",
|
|
50403
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50795
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50404
50796
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50405
50797
|
/[^a-zA-Z0-9]/g,
|
|
50406
50798
|
""
|
|
50407
50799
|
);
|
|
50408
50800
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50409
|
-
return /* @__PURE__ */ (0,
|
|
50801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50410
50802
|
"div",
|
|
50411
50803
|
{
|
|
50412
50804
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50423,20 +50815,20 @@ var CargoIMReport = () => {
|
|
|
50423
50815
|
),
|
|
50424
50816
|
0
|
|
50425
50817
|
);
|
|
50426
|
-
return totalCbm > 0 ? /* @__PURE__ */ (0,
|
|
50818
|
+
return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50427
50819
|
}
|
|
50428
50820
|
},
|
|
50429
50821
|
{
|
|
50430
50822
|
header: "Price",
|
|
50431
50823
|
key: "price",
|
|
50432
50824
|
className: "text-xs whitespace-nowrap text-right",
|
|
50433
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50825
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50434
50826
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50435
50827
|
/[^a-zA-Z0-9]/g,
|
|
50436
50828
|
""
|
|
50437
50829
|
);
|
|
50438
50830
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50439
|
-
return /* @__PURE__ */ (0,
|
|
50831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50440
50832
|
"div",
|
|
50441
50833
|
{
|
|
50442
50834
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50450,13 +50842,13 @@ var CargoIMReport = () => {
|
|
|
50450
50842
|
header: "Credit",
|
|
50451
50843
|
key: "credit",
|
|
50452
50844
|
className: "text-xs whitespace-nowrap text-right",
|
|
50453
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50845
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50454
50846
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50455
50847
|
/[^a-zA-Z0-9]/g,
|
|
50456
50848
|
""
|
|
50457
50849
|
);
|
|
50458
50850
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50459
|
-
return /* @__PURE__ */ (0,
|
|
50851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50460
50852
|
"div",
|
|
50461
50853
|
{
|
|
50462
50854
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-green-500 dark:text-green-500 print:text-green-500 whitespace-nowrap`,
|
|
@@ -50465,7 +50857,7 @@ var CargoIMReport = () => {
|
|
|
50465
50857
|
idx
|
|
50466
50858
|
);
|
|
50467
50859
|
}) }),
|
|
50468
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50860
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50469
50861
|
data2.reduce(
|
|
50470
50862
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50471
50863
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50479,13 +50871,13 @@ var CargoIMReport = () => {
|
|
|
50479
50871
|
header: "Debit",
|
|
50480
50872
|
key: "debit",
|
|
50481
50873
|
className: "text-xs whitespace-nowrap text-right",
|
|
50482
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50874
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50483
50875
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50484
50876
|
/[^a-zA-Z0-9]/g,
|
|
50485
50877
|
""
|
|
50486
50878
|
);
|
|
50487
50879
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50488
|
-
return /* @__PURE__ */ (0,
|
|
50880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50489
50881
|
"div",
|
|
50490
50882
|
{
|
|
50491
50883
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-red-500 dark:text-red-500 print:text-red-500 whitespace-nowrap`,
|
|
@@ -50494,7 +50886,7 @@ var CargoIMReport = () => {
|
|
|
50494
50886
|
idx
|
|
50495
50887
|
);
|
|
50496
50888
|
}) }),
|
|
50497
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50889
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50498
50890
|
data2.reduce(
|
|
50499
50891
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50500
50892
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50508,14 +50900,14 @@ var CargoIMReport = () => {
|
|
|
50508
50900
|
header: "Balance",
|
|
50509
50901
|
key: "runningBalance",
|
|
50510
50902
|
className: "text-xs whitespace-nowrap text-right",
|
|
50511
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50512
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50903
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50904
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50513
50905
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50514
50906
|
currency
|
|
50515
50907
|
) })
|
|
50516
50908
|
}
|
|
50517
50909
|
];
|
|
50518
|
-
const datas = (0,
|
|
50910
|
+
const datas = (0, import_react171.useMemo)(() => {
|
|
50519
50911
|
let runningBalance = 0;
|
|
50520
50912
|
const transactions = data?.data?.transactions;
|
|
50521
50913
|
const res = (transactions || []).map((item) => {
|
|
@@ -50552,10 +50944,10 @@ var CargoIMReport = () => {
|
|
|
50552
50944
|
{ label: "Account Type", value: data?.data?.type },
|
|
50553
50945
|
{ label: "Currency", value: currencyFilter }
|
|
50554
50946
|
];
|
|
50555
|
-
return /* @__PURE__ */ (0,
|
|
50556
|
-
/* @__PURE__ */ (0,
|
|
50557
|
-
/* @__PURE__ */ (0,
|
|
50558
|
-
/* @__PURE__ */ (0,
|
|
50947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)(import_jsx_runtime277.Fragment, { children: [
|
|
50948
|
+
/* @__PURE__ */ (0, import_jsx_runtime277.jsx)(Modal2, {}),
|
|
50949
|
+
/* @__PURE__ */ (0, import_jsx_runtime277.jsx)(TransactionView, {}),
|
|
50950
|
+
/* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50559
50951
|
A4DataView,
|
|
50560
50952
|
{
|
|
50561
50953
|
columns,
|
|
@@ -50570,7 +50962,7 @@ var CargoIMReport = () => {
|
|
|
50570
50962
|
openState({
|
|
50571
50963
|
type: "debit",
|
|
50572
50964
|
closeOnOverlayClick: false,
|
|
50573
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */ (0,
|
|
50965
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50574
50966
|
InvoiceForm_default2,
|
|
50575
50967
|
{
|
|
50576
50968
|
close: closeTransaction,
|
|
@@ -50578,7 +50970,7 @@ var CargoIMReport = () => {
|
|
|
50578
50970
|
onReload: reload,
|
|
50579
50971
|
id: row._id
|
|
50580
50972
|
}
|
|
50581
|
-
) : /* @__PURE__ */ (0,
|
|
50973
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50582
50974
|
journalForm_default2,
|
|
50583
50975
|
{
|
|
50584
50976
|
close: closeTransaction,
|
|
@@ -50591,7 +50983,7 @@ var CargoIMReport = () => {
|
|
|
50591
50983
|
width: 800
|
|
50592
50984
|
});
|
|
50593
50985
|
},
|
|
50594
|
-
headers: /* @__PURE__ */ (0,
|
|
50986
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
|
|
50595
50987
|
Fields_default.Select,
|
|
50596
50988
|
{
|
|
50597
50989
|
options: currencies,
|
|
@@ -50607,16 +50999,16 @@ var CargoIMReport = () => {
|
|
|
50607
50999
|
var cargoIMReport_default = CargoIMReport;
|
|
50608
51000
|
|
|
50609
51001
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50610
|
-
var
|
|
50611
|
-
var
|
|
50612
|
-
var
|
|
51002
|
+
var import_react_router_dom138 = require("react-router-dom");
|
|
51003
|
+
var import_lucide_react130 = require("lucide-react");
|
|
51004
|
+
var import_react172 = require("react");
|
|
50613
51005
|
var import_antd104 = require("antd");
|
|
50614
|
-
var
|
|
51006
|
+
var import_jsx_runtime278 = require("react/jsx-runtime");
|
|
50615
51007
|
function Forex2Accounts({ v, url }) {
|
|
50616
|
-
const { branchId } = (0,
|
|
50617
|
-
const navigate = (0,
|
|
51008
|
+
const { branchId } = (0, import_react_router_dom138.useParams)();
|
|
51009
|
+
const navigate = (0, import_react_router_dom138.useNavigate)();
|
|
50618
51010
|
const type = "account";
|
|
50619
|
-
const [deleteAccount, setDeleteAccount] = (0,
|
|
51011
|
+
const [deleteAccount, setDeleteAccount] = (0, import_react172.useState)(null);
|
|
50620
51012
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50621
51013
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50622
51014
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50627,22 +51019,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50627
51019
|
const items = (data2) => [
|
|
50628
51020
|
{
|
|
50629
51021
|
label: `Currency Report`,
|
|
50630
|
-
icon: /* @__PURE__ */ (0,
|
|
51022
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.FileChartLine, { size: 16 }),
|
|
50631
51023
|
onClick: () => navigate(data2?._id)
|
|
50632
51024
|
},
|
|
50633
51025
|
{
|
|
50634
51026
|
label: `Edit ${type}`,
|
|
50635
|
-
icon: /* @__PURE__ */ (0,
|
|
51027
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.FilePenLine, { size: 16 }),
|
|
50636
51028
|
onClick: () => openState({
|
|
50637
51029
|
type: "forex account",
|
|
50638
|
-
content: /* @__PURE__ */ (0,
|
|
51030
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50639
51031
|
title: "Forex Account Form",
|
|
50640
51032
|
width: 800
|
|
50641
51033
|
})
|
|
50642
51034
|
},
|
|
50643
51035
|
{
|
|
50644
51036
|
label: `Delete ${type}`,
|
|
50645
|
-
icon: /* @__PURE__ */ (0,
|
|
51037
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.Trash2, { className: "text-red-500", size: 16 }),
|
|
50646
51038
|
onClick: () => setDeleteAccount(data2)
|
|
50647
51039
|
}
|
|
50648
51040
|
].filter(Boolean);
|
|
@@ -50652,7 +51044,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50652
51044
|
header: "Name",
|
|
50653
51045
|
cell: ({ row }) => {
|
|
50654
51046
|
const account = row.original;
|
|
50655
|
-
return /* @__PURE__ */ (0,
|
|
51047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50656
51048
|
"span",
|
|
50657
51049
|
{
|
|
50658
51050
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50667,7 +51059,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50667
51059
|
header: "Phone",
|
|
50668
51060
|
cell: ({ row }) => {
|
|
50669
51061
|
const account = row.original;
|
|
50670
|
-
return /* @__PURE__ */ (0,
|
|
51062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)("span", { children: account?.phoneNumber || "N/A" });
|
|
50671
51063
|
}
|
|
50672
51064
|
},
|
|
50673
51065
|
{
|
|
@@ -50675,14 +51067,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50675
51067
|
header: "Balances",
|
|
50676
51068
|
cell: ({ row }) => {
|
|
50677
51069
|
const account = row.original;
|
|
50678
|
-
return /* @__PURE__ */ (0,
|
|
50679
|
-
([currency, data2]) => /* @__PURE__ */ (0,
|
|
51070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
51071
|
+
([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(
|
|
50680
51072
|
"div",
|
|
50681
51073
|
{
|
|
50682
51074
|
className: "flex items-center gap-1.5 px-2 py-0.5 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-100 dark:border-gray-700",
|
|
50683
51075
|
children: [
|
|
50684
|
-
/* @__PURE__ */ (0,
|
|
50685
|
-
/* @__PURE__ */ (0,
|
|
51076
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
51077
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50686
51078
|
"span",
|
|
50687
51079
|
{
|
|
50688
51080
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50701,8 +51093,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50701
51093
|
header: "Actions",
|
|
50702
51094
|
cell: ({ row }) => {
|
|
50703
51095
|
const data2 = row.original;
|
|
50704
|
-
return /* @__PURE__ */ (0,
|
|
50705
|
-
/* @__PURE__ */ (0,
|
|
51096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)("div", { className: "flex gap-4 items-center", children: [
|
|
51097
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50706
51098
|
"button",
|
|
50707
51099
|
{
|
|
50708
51100
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50710,7 +51102,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50710
51102
|
openState({
|
|
50711
51103
|
type: "credit",
|
|
50712
51104
|
closeOnOverlayClick: false,
|
|
50713
|
-
content: /* @__PURE__ */ (0,
|
|
51105
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50714
51106
|
Forex2FormTransaction_default,
|
|
50715
51107
|
{
|
|
50716
51108
|
close,
|
|
@@ -50726,7 +51118,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50726
51118
|
children: "Out"
|
|
50727
51119
|
}
|
|
50728
51120
|
),
|
|
50729
|
-
/* @__PURE__ */ (0,
|
|
51121
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50730
51122
|
"button",
|
|
50731
51123
|
{
|
|
50732
51124
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50734,7 +51126,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50734
51126
|
openState({
|
|
50735
51127
|
type: "debit",
|
|
50736
51128
|
closeOnOverlayClick: false,
|
|
50737
|
-
content: /* @__PURE__ */ (0,
|
|
51129
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50738
51130
|
Forex2FormTransaction_default,
|
|
50739
51131
|
{
|
|
50740
51132
|
close,
|
|
@@ -50750,13 +51142,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50750
51142
|
children: "In"
|
|
50751
51143
|
}
|
|
50752
51144
|
),
|
|
50753
|
-
/* @__PURE__ */ (0,
|
|
51145
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50754
51146
|
Dropdown,
|
|
50755
51147
|
{
|
|
50756
51148
|
className: "cursor-pointer w-[150px]",
|
|
50757
51149
|
items: items(data2),
|
|
50758
51150
|
triggerMode: "hover",
|
|
50759
|
-
children: /* @__PURE__ */ (0,
|
|
51151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.EllipsisVertical, {})
|
|
50760
51152
|
}
|
|
50761
51153
|
)
|
|
50762
51154
|
] });
|
|
@@ -50795,9 +51187,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50795
51187
|
};
|
|
50796
51188
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50797
51189
|
console.log(currencies);
|
|
50798
|
-
return /* @__PURE__ */ (0,
|
|
50799
|
-
/* @__PURE__ */ (0,
|
|
50800
|
-
/* @__PURE__ */ (0,
|
|
51190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(import_jsx_runtime278.Fragment, { children: [
|
|
51191
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(Modal2, {}),
|
|
51192
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50801
51193
|
ConfirmModal,
|
|
50802
51194
|
{
|
|
50803
51195
|
isOpen: !!deleteAccount,
|
|
@@ -50810,9 +51202,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50810
51202
|
children: null
|
|
50811
51203
|
}
|
|
50812
51204
|
),
|
|
50813
|
-
/* @__PURE__ */ (0,
|
|
50814
|
-
/* @__PURE__ */ (0,
|
|
50815
|
-
/* @__PURE__ */ (0,
|
|
51205
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsxs)("div", { children: [
|
|
51206
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
|
|
51207
|
+
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
50816
51208
|
TransactionViewComponent,
|
|
50817
51209
|
{
|
|
50818
51210
|
columns,
|
|
@@ -50824,7 +51216,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50824
51216
|
onCreate: () => {
|
|
50825
51217
|
openState({
|
|
50826
51218
|
type: "forex account",
|
|
50827
|
-
content: /* @__PURE__ */ (0,
|
|
51219
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ForexAccountForm_default, { close, reloads: reload }),
|
|
50828
51220
|
title: "Forex Account Form",
|
|
50829
51221
|
width: 800
|
|
50830
51222
|
});
|
|
@@ -50837,14 +51229,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50837
51229
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50838
51230
|
|
|
50839
51231
|
// src/components/reports/ProductList.tsx
|
|
50840
|
-
var
|
|
50841
|
-
var
|
|
50842
|
-
var
|
|
51232
|
+
var import_react_router_dom139 = require("react-router-dom");
|
|
51233
|
+
var import_jsx_runtime279 = require("react/jsx-runtime");
|
|
51234
|
+
var options10 = [
|
|
50843
51235
|
{ label: "Product", value: "product" },
|
|
50844
51236
|
{ label: "Pack", value: "pack" }
|
|
50845
51237
|
];
|
|
50846
51238
|
var ProductList2 = ({ value = false }) => {
|
|
50847
|
-
const { branchId } = (0,
|
|
51239
|
+
const { branchId } = (0, import_react_router_dom139.useParams)();
|
|
50848
51240
|
const { branches } = useAuth_default();
|
|
50849
51241
|
const { TransactionView } = useTransactionView_default();
|
|
50850
51242
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50866,7 +51258,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50866
51258
|
key: "name",
|
|
50867
51259
|
className: "text-xs whitespace-nowrap",
|
|
50868
51260
|
render: (row) => {
|
|
50869
|
-
return /* @__PURE__ */ (0,
|
|
51261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
|
|
50870
51262
|
}
|
|
50871
51263
|
},
|
|
50872
51264
|
...value ? [
|
|
@@ -50874,14 +51266,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50874
51266
|
header: "Cost",
|
|
50875
51267
|
key: "cost",
|
|
50876
51268
|
className: "text-xs whitespace-nowrap text-right",
|
|
50877
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
51269
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime279.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50878
51270
|
}
|
|
50879
51271
|
] : []
|
|
50880
51272
|
];
|
|
50881
51273
|
const datas = data?.data || [];
|
|
50882
|
-
return /* @__PURE__ */ (0,
|
|
50883
|
-
/* @__PURE__ */ (0,
|
|
50884
|
-
/* @__PURE__ */ (0,
|
|
51274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(import_jsx_runtime279.Fragment, { children: [
|
|
51275
|
+
/* @__PURE__ */ (0, import_jsx_runtime279.jsx)(TransactionView, {}),
|
|
51276
|
+
/* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
|
|
50885
51277
|
A4DataView,
|
|
50886
51278
|
{
|
|
50887
51279
|
columns,
|
|
@@ -50891,10 +51283,10 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50891
51283
|
subtitle: branchId ? currentBranch?.name : "All Branches",
|
|
50892
51284
|
tableTitle: "Stock List",
|
|
50893
51285
|
fixed: false,
|
|
50894
|
-
headers: /* @__PURE__ */ (0,
|
|
51286
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
|
|
50895
51287
|
Select,
|
|
50896
51288
|
{
|
|
50897
|
-
options:
|
|
51289
|
+
options: options10,
|
|
50898
51290
|
value: stockType,
|
|
50899
51291
|
className: "w-32! print:hidden",
|
|
50900
51292
|
onChange: (e) => {
|