warqadui 0.0.287 → 0.0.289
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1043 -659
- package/dist/index.mjs +895 -503
- package/dist/styles.js +21 -0
- package/dist/styles.mjs +21 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -133,7 +133,8 @@ var Enums = {
|
|
|
133
133
|
expenseAccount: ["branch", "account"],
|
|
134
134
|
integrationTypes: ["twilio-whatsapp"],
|
|
135
135
|
postTypes: ["umrah", "hajj", "visa", "hotel"],
|
|
136
|
-
postStatus: ["draft", "published", "archived"]
|
|
136
|
+
postStatus: ["draft", "published", "archived"],
|
|
137
|
+
collectionTypes: ["collected", "pending"]
|
|
137
138
|
};
|
|
138
139
|
var Enums_default = Enums;
|
|
139
140
|
|
|
@@ -2139,7 +2140,7 @@ var Select = forwardRef3((props, ref2) => {
|
|
|
2139
2140
|
enumName,
|
|
2140
2141
|
...rest
|
|
2141
2142
|
} = props;
|
|
2142
|
-
const
|
|
2143
|
+
const options11 = useMemo4(() => {
|
|
2143
2144
|
if (initialOptions.length > 0) return initialOptions;
|
|
2144
2145
|
const targetEnum = enumData || (enumName ? enums[enumName] : void 0);
|
|
2145
2146
|
if (targetEnum) {
|
|
@@ -2175,7 +2176,7 @@ var Select = forwardRef3((props, ref2) => {
|
|
|
2175
2176
|
SelectRoot,
|
|
2176
2177
|
{
|
|
2177
2178
|
...rest,
|
|
2178
|
-
options:
|
|
2179
|
+
options: options11,
|
|
2179
2180
|
currentValue: formValue,
|
|
2180
2181
|
onChangeHandler: (val) => {
|
|
2181
2182
|
formOnChange(val);
|
|
@@ -2192,7 +2193,7 @@ var Select = forwardRef3((props, ref2) => {
|
|
|
2192
2193
|
SelectRoot,
|
|
2193
2194
|
{
|
|
2194
2195
|
...rest,
|
|
2195
|
-
options:
|
|
2196
|
+
options: options11,
|
|
2196
2197
|
currentValue: value,
|
|
2197
2198
|
onChangeHandler: onChange || (() => {
|
|
2198
2199
|
}),
|
|
@@ -2378,12 +2379,12 @@ var SelectTrigger = forwardRef3(
|
|
|
2378
2379
|
dropdownContentRef,
|
|
2379
2380
|
containerRef,
|
|
2380
2381
|
selectedValue,
|
|
2381
|
-
options:
|
|
2382
|
+
options: options11,
|
|
2382
2383
|
fieldInternalProps,
|
|
2383
2384
|
disabled
|
|
2384
2385
|
} = useSelectContext();
|
|
2385
2386
|
const lastFocusTime = useRef3(0);
|
|
2386
|
-
const displayOption =
|
|
2387
|
+
const displayOption = options11.find((o) => o.value === selectedValue);
|
|
2387
2388
|
const displayValue = displayOption ? displayOption.label : selectedValue != null && selectedValue !== "" ? String(selectedValue) : placeholder;
|
|
2388
2389
|
return /* @__PURE__ */ jsx21("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ jsx21(
|
|
2389
2390
|
"div",
|
|
@@ -2826,7 +2827,7 @@ var SearchApiRoot = ({
|
|
|
2826
2827
|
const [searchTerm, setSearchTerm] = useState15("");
|
|
2827
2828
|
const { theme } = useWarqadConfig();
|
|
2828
2829
|
const primaryColor = theme?.primaryColor;
|
|
2829
|
-
const [
|
|
2830
|
+
const [options11, setOptions] = useState15([]);
|
|
2830
2831
|
const [isOpen, setIsOpen] = useState15(false);
|
|
2831
2832
|
const [isFocused, setIsFocused] = useState15(false);
|
|
2832
2833
|
const [activeIndex, setActiveIndex] = useState15(-1);
|
|
@@ -2878,7 +2879,7 @@ var SearchApiRoot = ({
|
|
|
2878
2879
|
return () => clearTimeout(timer);
|
|
2879
2880
|
}, [searchTerm, api, isOpen]);
|
|
2880
2881
|
useEffect11(() => {
|
|
2881
|
-
if (isOpen &&
|
|
2882
|
+
if (isOpen && options11.length === 0) {
|
|
2882
2883
|
fetchOptions("");
|
|
2883
2884
|
}
|
|
2884
2885
|
}, [isOpen]);
|
|
@@ -2909,8 +2910,8 @@ var SearchApiRoot = ({
|
|
|
2909
2910
|
return option[valueKey];
|
|
2910
2911
|
};
|
|
2911
2912
|
useEffect11(() => {
|
|
2912
|
-
if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject &&
|
|
2913
|
-
const found =
|
|
2913
|
+
if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject && options11.length > 0) {
|
|
2914
|
+
const found = options11.find((o) => getOptionValue(o) === currentValue);
|
|
2914
2915
|
if (found) {
|
|
2915
2916
|
setSelectedObject(found);
|
|
2916
2917
|
if (form && obj) {
|
|
@@ -2921,7 +2922,7 @@ var SearchApiRoot = ({
|
|
|
2921
2922
|
}
|
|
2922
2923
|
}
|
|
2923
2924
|
}
|
|
2924
|
-
}, [currentValue,
|
|
2925
|
+
}, [currentValue, options11, obj]);
|
|
2925
2926
|
useEffect11(() => {
|
|
2926
2927
|
if (prevApiRef.current !== api) {
|
|
2927
2928
|
prevApiRef.current = api;
|
|
@@ -2966,8 +2967,8 @@ var SearchApiRoot = ({
|
|
|
2966
2967
|
}, [fieldInternalProps]);
|
|
2967
2968
|
const getDisplayValue = () => {
|
|
2968
2969
|
if (selectedObject) return selectedObject[labelKey];
|
|
2969
|
-
if (
|
|
2970
|
-
const found =
|
|
2970
|
+
if (options11.length > 0 && currentValue !== void 0 && currentValue !== null && currentValue !== "") {
|
|
2971
|
+
const found = options11.find((o) => getOptionValue(o) === currentValue);
|
|
2971
2972
|
if (found) return found[labelKey];
|
|
2972
2973
|
}
|
|
2973
2974
|
if (isLoading || currentValue !== void 0 && currentValue !== null && currentValue !== "" && !hasAttemptedHydration)
|
|
@@ -3011,7 +3012,7 @@ var SearchApiRoot = ({
|
|
|
3011
3012
|
setSearchTerm("");
|
|
3012
3013
|
if (onClear) onClear();
|
|
3013
3014
|
};
|
|
3014
|
-
const filteredOptions =
|
|
3015
|
+
const filteredOptions = options11.filter(
|
|
3015
3016
|
(option) => !filter.includes(getOptionValue(option))
|
|
3016
3017
|
);
|
|
3017
3018
|
let message92 = error || errorMessage;
|
|
@@ -3176,7 +3177,7 @@ var SearchApiInput = forwardRef5(
|
|
|
3176
3177
|
variant,
|
|
3177
3178
|
activeIndex,
|
|
3178
3179
|
setActiveIndex,
|
|
3179
|
-
options:
|
|
3180
|
+
options: options11,
|
|
3180
3181
|
handleSelect,
|
|
3181
3182
|
clearSelection,
|
|
3182
3183
|
inputRef,
|
|
@@ -3208,7 +3209,7 @@ var SearchApiInput = forwardRef5(
|
|
|
3208
3209
|
e.preventDefault();
|
|
3209
3210
|
e.stopPropagation();
|
|
3210
3211
|
setActiveIndex(
|
|
3211
|
-
activeIndex <
|
|
3212
|
+
activeIndex < options11.length - 1 ? activeIndex + 1 : activeIndex
|
|
3212
3213
|
);
|
|
3213
3214
|
break;
|
|
3214
3215
|
case "ArrowUp":
|
|
@@ -3219,8 +3220,8 @@ var SearchApiInput = forwardRef5(
|
|
|
3219
3220
|
case "Enter":
|
|
3220
3221
|
e.preventDefault();
|
|
3221
3222
|
e.stopPropagation();
|
|
3222
|
-
if (activeIndex >= 0 && activeIndex <
|
|
3223
|
-
handleSelect(
|
|
3223
|
+
if (activeIndex >= 0 && activeIndex < options11.length)
|
|
3224
|
+
handleSelect(options11[activeIndex]);
|
|
3224
3225
|
break;
|
|
3225
3226
|
case "Escape":
|
|
3226
3227
|
e.preventDefault();
|
|
@@ -3296,7 +3297,7 @@ var SearchApiContent = forwardRef5(
|
|
|
3296
3297
|
dropdownContentRef,
|
|
3297
3298
|
isLoading,
|
|
3298
3299
|
searchTerm,
|
|
3299
|
-
options:
|
|
3300
|
+
options: options11,
|
|
3300
3301
|
error
|
|
3301
3302
|
} = useSearchApiContext();
|
|
3302
3303
|
const [dropdownStyle, setDropdownStyle] = useState15({});
|
|
@@ -3336,7 +3337,7 @@ var SearchApiContent = forwardRef5(
|
|
|
3336
3337
|
...props,
|
|
3337
3338
|
children: [
|
|
3338
3339
|
error && /* @__PURE__ */ jsx23("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 }),
|
|
3339
|
-
isLoading &&
|
|
3340
|
+
isLoading && options11.length === 0 ? /* @__PURE__ */ jsxs18("div", { className: "p-4 text-center text-sm text-gray-500", children: [
|
|
3340
3341
|
/* @__PURE__ */ jsx23(Loader22, { className: "h-5 w-5 animate-spin mx-auto mb-2" }),
|
|
3341
3342
|
"Loading options..."
|
|
3342
3343
|
] }) : children ? /* @__PURE__ */ jsx23("div", { className: "py-1", children }) : /* @__PURE__ */ jsx23("div", { className: "p-4 text-center text-sm text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
@@ -7437,13 +7438,13 @@ import moment from "moment";
|
|
|
7437
7438
|
import { useReactToPrint as useReactToPrint3 } from "react-to-print";
|
|
7438
7439
|
|
|
7439
7440
|
// src/utils/Formats.tsx
|
|
7440
|
-
function Price(price, currency = "USD", round2 = true,
|
|
7441
|
+
function Price(price, currency = "USD", round2 = true, options11) {
|
|
7441
7442
|
const num = Number(price);
|
|
7442
7443
|
const decimalPlaces = round2 ? 0 : Math.min(num.toString().split(".")[1]?.length ?? 0, 2);
|
|
7443
7444
|
const formatted = new Intl.NumberFormat("en-US", {
|
|
7444
7445
|
minimumFractionDigits: decimalPlaces,
|
|
7445
7446
|
maximumFractionDigits: decimalPlaces,
|
|
7446
|
-
...
|
|
7447
|
+
...options11
|
|
7447
7448
|
}).format(num);
|
|
7448
7449
|
return `${formatted} ${currency}`;
|
|
7449
7450
|
}
|
|
@@ -7949,7 +7950,7 @@ var useTransaction_default = useTransaction;
|
|
|
7949
7950
|
// src/utils/pdf.ts
|
|
7950
7951
|
import html2canvas from "html2canvas-pro";
|
|
7951
7952
|
import { jsPDF } from "jspdf";
|
|
7952
|
-
var generatePdf = async (elementId,
|
|
7953
|
+
var generatePdf = async (elementId, options11 = {}) => {
|
|
7953
7954
|
const {
|
|
7954
7955
|
orientation = "landscape",
|
|
7955
7956
|
unit = "mm",
|
|
@@ -7959,7 +7960,7 @@ var generatePdf = async (elementId, options10 = {}) => {
|
|
|
7959
7960
|
windowWidth = 1200,
|
|
7960
7961
|
scale = 1,
|
|
7961
7962
|
showPageNumbers = true
|
|
7962
|
-
} =
|
|
7963
|
+
} = options11;
|
|
7963
7964
|
const element = document.getElementById(elementId);
|
|
7964
7965
|
if (!element) {
|
|
7965
7966
|
console.error(
|
|
@@ -29848,7 +29849,7 @@ var StatusFilter = ({
|
|
|
29848
29849
|
value,
|
|
29849
29850
|
onChange
|
|
29850
29851
|
}) => {
|
|
29851
|
-
const
|
|
29852
|
+
const options11 = type === "rent" ? [
|
|
29852
29853
|
{ label: "All", value: "all", dotColor: "bg-slate-400" },
|
|
29853
29854
|
{ label: "Vacant", value: "vacant", dotColor: "bg-[#22c55e]" },
|
|
29854
29855
|
{ label: "Occupied", value: "occupied", dotColor: "bg-[#ef4444]" }
|
|
@@ -29858,7 +29859,7 @@ var StatusFilter = ({
|
|
|
29858
29859
|
{ label: "Booked", value: "booked", dotColor: "bg-[#3b82f6]" },
|
|
29859
29860
|
{ label: "Sold", value: "sold", dotColor: "bg-[#ef4444]" }
|
|
29860
29861
|
];
|
|
29861
|
-
return /* @__PURE__ */ jsx168("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:
|
|
29862
|
+
return /* @__PURE__ */ jsx168("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) => {
|
|
29862
29863
|
const isActive = value === opt.value;
|
|
29863
29864
|
return /* @__PURE__ */ jsxs143(
|
|
29864
29865
|
"button",
|
|
@@ -46508,7 +46509,8 @@ var AdjustmentStockSchema5 = z46.object({
|
|
|
46508
46509
|
cash: z46.coerce.number(),
|
|
46509
46510
|
credit: z46.coerce.number(),
|
|
46510
46511
|
discount: z46.coerce.number(),
|
|
46511
|
-
currency: z46.enum(Enums_default.currencies)
|
|
46512
|
+
currency: z46.enum(Enums_default.currencies),
|
|
46513
|
+
collection: z46.enum(Enums_default.collectionTypes)
|
|
46512
46514
|
});
|
|
46513
46515
|
var schema_default7 = AdjustmentStockSchema5;
|
|
46514
46516
|
|
|
@@ -46591,13 +46593,13 @@ var CompleteSaleModal2 = ({
|
|
|
46591
46593
|
] }),
|
|
46592
46594
|
/* @__PURE__ */ jsxs225("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: [
|
|
46593
46595
|
/* @__PURE__ */ jsxs225("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
46594
|
-
/* @__PURE__ */ jsx256("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount &
|
|
46596
|
+
/* @__PURE__ */ jsx256("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount, Rate & Collection" }),
|
|
46595
46597
|
(discount > 0 || isRate) && /* @__PURE__ */ jsx256("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" })
|
|
46596
46598
|
] }),
|
|
46597
46599
|
/* @__PURE__ */ jsxs225(
|
|
46598
46600
|
"div",
|
|
46599
46601
|
{
|
|
46600
|
-
className: isRate ? "grid grid-cols-1 md:grid-cols-
|
|
46602
|
+
className: isRate ? "grid grid-cols-1 md:grid-cols-3 gap-4" : "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
46601
46603
|
children: [
|
|
46602
46604
|
/* @__PURE__ */ jsx256(
|
|
46603
46605
|
Fields_default.Input,
|
|
@@ -46620,6 +46622,17 @@ var CompleteSaleModal2 = ({
|
|
|
46620
46622
|
type: "number",
|
|
46621
46623
|
className: "h-[40px]!"
|
|
46622
46624
|
}
|
|
46625
|
+
),
|
|
46626
|
+
/* @__PURE__ */ jsx256(
|
|
46627
|
+
Fields_default.Select,
|
|
46628
|
+
{
|
|
46629
|
+
label: "Collection",
|
|
46630
|
+
name: "collection",
|
|
46631
|
+
form,
|
|
46632
|
+
enumName: "collectionTypes",
|
|
46633
|
+
required: true,
|
|
46634
|
+
className: "h-[40px]!"
|
|
46635
|
+
}
|
|
46623
46636
|
)
|
|
46624
46637
|
]
|
|
46625
46638
|
}
|
|
@@ -46658,7 +46671,7 @@ var CompleteSaleModal2 = ({
|
|
|
46658
46671
|
] }),
|
|
46659
46672
|
/* @__PURE__ */ jsxs225("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: [
|
|
46660
46673
|
/* @__PURE__ */ jsxs225("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
46661
|
-
/* @__PURE__ */ jsx256("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "
|
|
46674
|
+
/* @__PURE__ */ jsx256("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "3. Credit Payment" }),
|
|
46662
46675
|
credit > 0 && /* @__PURE__ */ jsx256("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" })
|
|
46663
46676
|
] }),
|
|
46664
46677
|
/* @__PURE__ */ jsxs225("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
@@ -46782,7 +46795,8 @@ var Sale2Form2 = ({
|
|
|
46782
46795
|
cash: 0,
|
|
46783
46796
|
credit: 0,
|
|
46784
46797
|
discount: 0,
|
|
46785
|
-
invoiceNumber: ""
|
|
46798
|
+
invoiceNumber: "",
|
|
46799
|
+
collection: "collected"
|
|
46786
46800
|
}
|
|
46787
46801
|
});
|
|
46788
46802
|
const { handleSubmit, watch, setValue } = methods;
|
|
@@ -46859,7 +46873,8 @@ var Sale2Form2 = ({
|
|
|
46859
46873
|
cash: cashVal,
|
|
46860
46874
|
credit: creditVal,
|
|
46861
46875
|
discount: discountVal,
|
|
46862
|
-
invoiceNumber: data.invoiceNumber || void 0
|
|
46876
|
+
invoiceNumber: data.invoiceNumber || void 0,
|
|
46877
|
+
collection: data.collection
|
|
46863
46878
|
};
|
|
46864
46879
|
try {
|
|
46865
46880
|
await post({
|
|
@@ -46927,6 +46942,7 @@ var Sale2Form2 = ({
|
|
|
46927
46942
|
setValue("discount", datas.discount || 0);
|
|
46928
46943
|
setValue("invoiceNumber", datas.invoiceNumber || "");
|
|
46929
46944
|
setValue("currency", datas?.currency);
|
|
46945
|
+
setValue("collection", datas?.collection);
|
|
46930
46946
|
setTimeout(() => {
|
|
46931
46947
|
setValue("rate", datas?.rate);
|
|
46932
46948
|
setValue("wallet", datas?.toWalletData?._id);
|
|
@@ -47067,49 +47083,48 @@ function getStorageType5(type, branch) {
|
|
|
47067
47083
|
}
|
|
47068
47084
|
var pos_default5 = Sale2Form2;
|
|
47069
47085
|
|
|
47070
|
-
// src/components/Transactions/3/sale2/
|
|
47071
|
-
|
|
47072
|
-
List: List_default6,
|
|
47073
|
-
Form: pos_default5
|
|
47074
|
-
};
|
|
47075
|
-
var sale2_default2 = Sale22;
|
|
47076
|
-
|
|
47077
|
-
// src/components/Transactions/3/purchase3/List.tsx
|
|
47086
|
+
// src/components/Transactions/3/sale2/Collection.tsx
|
|
47087
|
+
import { useMemo as useMemo50 } from "react";
|
|
47078
47088
|
import { useNavigate as useNavigate62, useParams as useParams101 } from "react-router-dom";
|
|
47079
47089
|
import {
|
|
47090
|
+
CircleDollarSign,
|
|
47091
|
+
Clock as Clock27,
|
|
47080
47092
|
EllipsisVertical as EllipsisVertical45,
|
|
47081
47093
|
Eye as Eye26,
|
|
47082
47094
|
FilePenLine as FilePenLine41,
|
|
47083
|
-
Trash2 as Trash251
|
|
47095
|
+
Trash2 as Trash251,
|
|
47096
|
+
Wallet as Wallet17
|
|
47084
47097
|
} from "lucide-react";
|
|
47085
47098
|
import { Fragment as Fragment128, jsx as jsx258, jsxs as jsxs227 } from "react/jsx-runtime";
|
|
47086
|
-
function
|
|
47099
|
+
function Collection3({
|
|
47087
47100
|
url,
|
|
47088
47101
|
type = "product"
|
|
47089
47102
|
}) {
|
|
47090
47103
|
const { branchId } = useParams101();
|
|
47091
47104
|
const navigate = useNavigate62();
|
|
47105
|
+
const { currencies } = useWarqadConfig();
|
|
47106
|
+
const { defaultCurrency } = currencies;
|
|
47092
47107
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
47093
47108
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
47094
|
-
url: url || `/transactions/get?type=stock&stock=
|
|
47095
|
-
dateFilter:
|
|
47109
|
+
url: url || `/transactions/get?type=stock&stock=sale-3&stockType=${type}&collection=pending${branchId ? `&fromBranch=${branchId}` : ""}`,
|
|
47110
|
+
dateFilter: false
|
|
47096
47111
|
});
|
|
47097
47112
|
const { Modal: Modal2 } = useModal();
|
|
47098
47113
|
const { PosPrinter } = usePosPrinter_default();
|
|
47099
47114
|
const items = (data2) => [
|
|
47100
47115
|
{
|
|
47101
|
-
label: `View Stock
|
|
47116
|
+
label: `View Stock Sale`,
|
|
47102
47117
|
icon: /* @__PURE__ */ jsx258(Eye26, { size: 16 }),
|
|
47103
47118
|
className: "w-[200px]",
|
|
47104
47119
|
onClick: () => openTransaction({ id: data2?._id, type: "stock" })
|
|
47105
47120
|
},
|
|
47106
47121
|
{
|
|
47107
|
-
label: `Edit Stock
|
|
47122
|
+
label: `Edit Stock Sale`,
|
|
47108
47123
|
icon: /* @__PURE__ */ jsx258(FilePenLine41, { size: 16 }),
|
|
47109
47124
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
47110
47125
|
},
|
|
47111
47126
|
{
|
|
47112
|
-
label: `Delete Stock
|
|
47127
|
+
label: `Delete Stock Sale`,
|
|
47113
47128
|
icon: /* @__PURE__ */ jsx258(Trash251, { className: "text-red-500", size: 16 }),
|
|
47114
47129
|
onClick: () => {
|
|
47115
47130
|
openTransaction({
|
|
@@ -47149,11 +47164,11 @@ function purchase3List({
|
|
|
47149
47164
|
}
|
|
47150
47165
|
},
|
|
47151
47166
|
{
|
|
47152
|
-
accessorKey: "
|
|
47153
|
-
header: "
|
|
47167
|
+
accessorKey: "customer/wallet",
|
|
47168
|
+
header: "Customer/Wallet",
|
|
47154
47169
|
cell: ({ row }) => {
|
|
47155
47170
|
const stock = row.original;
|
|
47156
|
-
const walletName = stock?.
|
|
47171
|
+
const walletName = stock?.toWalletData?.name;
|
|
47157
47172
|
const accountName = stock?.accountData?.name || stock?.accountName;
|
|
47158
47173
|
return /* @__PURE__ */ jsxs227("div", { className: "flex flex-col gap-0.5", children: [
|
|
47159
47174
|
stock?.cash > 0 && walletName && /* @__PURE__ */ jsxs227("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
@@ -47162,11 +47177,11 @@ function purchase3List({
|
|
|
47162
47177
|
/* @__PURE__ */ jsx258("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: walletName })
|
|
47163
47178
|
] }),
|
|
47164
47179
|
stock?.credit > 0 && accountName && /* @__PURE__ */ jsxs227("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47165
|
-
"
|
|
47180
|
+
"Customer:",
|
|
47166
47181
|
" ",
|
|
47167
47182
|
/* @__PURE__ */ jsx258("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: accountName })
|
|
47168
47183
|
] }),
|
|
47169
|
-
!(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ jsx258("span", { children: stock?.
|
|
47184
|
+
!(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ jsx258("span", { children: stock?.sale === "cash" ? walletName || "Cash Wallet" : accountName || "Customer" })
|
|
47170
47185
|
] });
|
|
47171
47186
|
}
|
|
47172
47187
|
},
|
|
@@ -47183,25 +47198,33 @@ function purchase3List({
|
|
|
47183
47198
|
header: "Action",
|
|
47184
47199
|
cell: ({ row }) => {
|
|
47185
47200
|
const stock = row.original;
|
|
47186
|
-
const
|
|
47201
|
+
const saleType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.sale;
|
|
47187
47202
|
return /* @__PURE__ */ jsxs227("div", { className: "flex flex-col", children: [
|
|
47188
|
-
/* @__PURE__ */ jsx258("span", { className: `capitalize text-red-600`, children: "Stock
|
|
47189
|
-
/* @__PURE__ */ jsx258("span", { className: "capitalize", children:
|
|
47203
|
+
/* @__PURE__ */ jsx258("span", { className: `capitalize text-red-600`, children: "Stock Sold" }),
|
|
47204
|
+
/* @__PURE__ */ jsx258("span", { className: "capitalize", children: saleType })
|
|
47190
47205
|
] });
|
|
47191
47206
|
}
|
|
47192
47207
|
},
|
|
47193
47208
|
{
|
|
47194
47209
|
accessorKey: "amount",
|
|
47195
|
-
header: "Amount",
|
|
47210
|
+
header: "Amount (USD)",
|
|
47196
47211
|
cell: ({ row }) => {
|
|
47197
47212
|
const stock = row.original;
|
|
47198
|
-
const
|
|
47213
|
+
const isUSD = (stock?.currency || "").toUpperCase() === "USD";
|
|
47214
|
+
const netAmount = (Number(stock?.amount) || 0) - (Number(stock?.discount) || 0);
|
|
47215
|
+
const usdAmount = !isUSD && stock?.exchange?.amount !== void 0 ? Number(stock.exchange.amount) : netAmount;
|
|
47199
47216
|
return /* @__PURE__ */ jsxs227("div", { className: "flex flex-col", children: [
|
|
47200
|
-
/* @__PURE__ */ jsx258("span", { className: "font-semibold", children: Formats_default.Price(
|
|
47201
|
-
|
|
47217
|
+
/* @__PURE__ */ jsx258("span", { className: "font-semibold", children: Formats_default.Price(usdAmount, "USD", false) }),
|
|
47218
|
+
!isUSD && /* @__PURE__ */ jsxs227("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47219
|
+
"Original: ",
|
|
47220
|
+
Formats_default.Price(netAmount, stock?.currency, false),
|
|
47221
|
+
stock?.exchange?.rate ? ` @ ${stock.exchange.rate}` : ""
|
|
47222
|
+
] }),
|
|
47223
|
+
isUSD && stock?.discount > 0 && /* @__PURE__ */ jsxs227("span", { className: "text-xs text-red-600", children: [
|
|
47202
47224
|
"Original:",
|
|
47225
|
+
" ",
|
|
47203
47226
|
/* @__PURE__ */ jsx258("del", { children: Formats_default.Price(stock?.amount, stock?.currency, false) })
|
|
47204
|
-
] })
|
|
47227
|
+
] })
|
|
47205
47228
|
] });
|
|
47206
47229
|
}
|
|
47207
47230
|
},
|
|
@@ -47223,11 +47246,379 @@ function purchase3List({
|
|
|
47223
47246
|
}
|
|
47224
47247
|
];
|
|
47225
47248
|
const stocks = data?.data || [];
|
|
47249
|
+
const stats = useMemo50(() => {
|
|
47250
|
+
const totalInvoices = stocks.length;
|
|
47251
|
+
let totalPendingUSD = 0;
|
|
47252
|
+
let totalCashUSD = 0;
|
|
47253
|
+
let totalCreditUSD = 0;
|
|
47254
|
+
stocks.forEach((item) => {
|
|
47255
|
+
const isUSD = (item?.currency || "").toUpperCase() === "USD";
|
|
47256
|
+
const netAmount = (Number(item?.amount) || 0) - (Number(item?.discount) || 0);
|
|
47257
|
+
let itemUsdAmount = netAmount;
|
|
47258
|
+
if (!isUSD && item?.exchange?.amount !== void 0) {
|
|
47259
|
+
itemUsdAmount = Number(item.exchange.amount) || 0;
|
|
47260
|
+
}
|
|
47261
|
+
totalPendingUSD += itemUsdAmount;
|
|
47262
|
+
if (isUSD) {
|
|
47263
|
+
totalCashUSD += Number(item?.cash) || 0;
|
|
47264
|
+
totalCreditUSD += Number(item?.credit) || 0;
|
|
47265
|
+
} else {
|
|
47266
|
+
const cashRatio = netAmount > 0 ? (Number(item?.cash) || 0) / netAmount : 0;
|
|
47267
|
+
const creditRatio = netAmount > 0 ? (Number(item?.credit) || 0) / netAmount : 0;
|
|
47268
|
+
totalCashUSD += itemUsdAmount * cashRatio;
|
|
47269
|
+
totalCreditUSD += itemUsdAmount * creditRatio;
|
|
47270
|
+
}
|
|
47271
|
+
});
|
|
47272
|
+
return {
|
|
47273
|
+
totalInvoices,
|
|
47274
|
+
totalPendingUSD,
|
|
47275
|
+
totalCashUSD,
|
|
47276
|
+
totalCreditUSD
|
|
47277
|
+
};
|
|
47278
|
+
}, [stocks]);
|
|
47226
47279
|
return /* @__PURE__ */ jsxs227(Fragment128, { children: [
|
|
47227
47280
|
/* @__PURE__ */ jsx258(TransactionView, {}),
|
|
47228
47281
|
/* @__PURE__ */ jsx258(Modal2, {}),
|
|
47229
47282
|
/* @__PURE__ */ jsx258(PosPrinter, {}),
|
|
47283
|
+
/* @__PURE__ */ jsxs227("header", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-6", children: [
|
|
47284
|
+
/* @__PURE__ */ jsxs227("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: [
|
|
47285
|
+
/* @__PURE__ */ jsxs227("div", { className: "space-y-1", children: [
|
|
47286
|
+
/* @__PURE__ */ jsxs227("div", { className: "flex items-center gap-2", children: [
|
|
47287
|
+
/* @__PURE__ */ jsx258("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "Pending Invoices" }),
|
|
47288
|
+
/* @__PURE__ */ jsx258("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" })
|
|
47289
|
+
] }),
|
|
47290
|
+
/* @__PURE__ */ jsx258("h3", { className: "text-3xl font-black text-zinc-900 dark:text-white", children: stats.totalInvoices }),
|
|
47291
|
+
/* @__PURE__ */ jsxs227("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: [
|
|
47292
|
+
stats.totalInvoices === 1 ? "1 invoice" : `${stats.totalInvoices} invoices`,
|
|
47293
|
+
" ",
|
|
47294
|
+
"awaiting collection"
|
|
47295
|
+
] })
|
|
47296
|
+
] }),
|
|
47297
|
+
/* @__PURE__ */ jsx258("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__ */ jsx258(Clock27, { size: 24 }) })
|
|
47298
|
+
] }),
|
|
47299
|
+
/* @__PURE__ */ jsxs227("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: [
|
|
47300
|
+
/* @__PURE__ */ jsxs227("div", { className: "space-y-1", children: [
|
|
47301
|
+
/* @__PURE__ */ jsxs227("div", { className: "flex items-center gap-2", children: [
|
|
47302
|
+
/* @__PURE__ */ jsx258("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "To Be Collected (USD)" }),
|
|
47303
|
+
/* @__PURE__ */ jsx258("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" })
|
|
47304
|
+
] }),
|
|
47305
|
+
/* @__PURE__ */ jsx258("h3", { className: "text-3xl font-black text-emerald-600 dark:text-emerald-400", children: Formats_default.Price(stats.totalPendingUSD, "USD", false) }),
|
|
47306
|
+
/* @__PURE__ */ jsx258("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: "Total sales waiting for collection (USD)" })
|
|
47307
|
+
] }),
|
|
47308
|
+
/* @__PURE__ */ jsx258("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__ */ jsx258(CircleDollarSign, { size: 24 }) })
|
|
47309
|
+
] }),
|
|
47310
|
+
/* @__PURE__ */ jsxs227("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: [
|
|
47311
|
+
/* @__PURE__ */ jsxs227("div", { className: "space-y-2 w-full pr-3", children: [
|
|
47312
|
+
/* @__PURE__ */ jsx258("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "Payment Breakdown (USD)" }),
|
|
47313
|
+
/* @__PURE__ */ jsxs227("div", { className: "flex items-center justify-between text-sm", children: [
|
|
47314
|
+
/* @__PURE__ */ jsxs227("span", { className: "text-zinc-500 dark:text-zinc-400 flex items-center gap-1.5", children: [
|
|
47315
|
+
/* @__PURE__ */ jsx258("span", { className: "h-2 w-2 rounded-full bg-blue-500" }),
|
|
47316
|
+
"Cash:"
|
|
47317
|
+
] }),
|
|
47318
|
+
/* @__PURE__ */ jsx258("span", { className: "font-bold text-blue-600 dark:text-blue-400", children: Formats_default.Price(stats.totalCashUSD, "USD", false) })
|
|
47319
|
+
] }),
|
|
47320
|
+
/* @__PURE__ */ jsxs227("div", { className: "flex items-center justify-between text-sm", children: [
|
|
47321
|
+
/* @__PURE__ */ jsxs227("span", { className: "text-zinc-500 dark:text-zinc-400 flex items-center gap-1.5", children: [
|
|
47322
|
+
/* @__PURE__ */ jsx258("span", { className: "h-2 w-2 rounded-full bg-red-500" }),
|
|
47323
|
+
"Credit:"
|
|
47324
|
+
] }),
|
|
47325
|
+
/* @__PURE__ */ jsx258("span", { className: "font-bold text-red-500 dark:text-red-400", children: Formats_default.Price(stats.totalCreditUSD, "USD", false) })
|
|
47326
|
+
] })
|
|
47327
|
+
] }),
|
|
47328
|
+
/* @__PURE__ */ jsx258("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__ */ jsx258(Wallet17, { size: 24 }) })
|
|
47329
|
+
] })
|
|
47330
|
+
] }),
|
|
47230
47331
|
/* @__PURE__ */ jsx258(
|
|
47332
|
+
TransactionViewComponent,
|
|
47333
|
+
{
|
|
47334
|
+
columns,
|
|
47335
|
+
data: stocks,
|
|
47336
|
+
title: `${type} Sales (Pending Collection)`,
|
|
47337
|
+
description: `Manage ${type} sales waiting for collection`,
|
|
47338
|
+
index: true
|
|
47339
|
+
},
|
|
47340
|
+
type
|
|
47341
|
+
)
|
|
47342
|
+
] });
|
|
47343
|
+
}
|
|
47344
|
+
var Collection_default = Collection3;
|
|
47345
|
+
|
|
47346
|
+
// src/components/Transactions/3/sale2/CollectionLevel.tsx
|
|
47347
|
+
import { useParams as useParams102 } from "react-router-dom";
|
|
47348
|
+
import { Fragment as Fragment129, jsx as jsx259, jsxs as jsxs228 } from "react/jsx-runtime";
|
|
47349
|
+
var options9 = [
|
|
47350
|
+
{ label: "Product", value: "product" },
|
|
47351
|
+
{ label: "Pack", value: "pack" }
|
|
47352
|
+
];
|
|
47353
|
+
var CollectionLevel = ({
|
|
47354
|
+
value = false,
|
|
47355
|
+
showYard = false
|
|
47356
|
+
}) => {
|
|
47357
|
+
const { apiConfig, currencies } = useWarqadConfig();
|
|
47358
|
+
const { stock } = currencies;
|
|
47359
|
+
const { branchId } = useParams102();
|
|
47360
|
+
const { branches } = useAuth_default();
|
|
47361
|
+
const { TransactionView } = useTransactionView_default();
|
|
47362
|
+
const { getQuery, setQuery } = useApp_default();
|
|
47363
|
+
const stockType = getQuery("stockType") || "product";
|
|
47364
|
+
const { A4DataView, data } = useA4DataView_default({
|
|
47365
|
+
url: `${apiConfig.stockLevelReportApi}?stockType=${stockType}&collection=pending${branchId ? `&branch=${branchId}` : ""}`,
|
|
47366
|
+
v: 1,
|
|
47367
|
+
// No prefix
|
|
47368
|
+
params: {}
|
|
47369
|
+
});
|
|
47370
|
+
let branchesData = branches || [];
|
|
47371
|
+
if (branchId) {
|
|
47372
|
+
branchesData = branchesData.filter((b) => b._id === branchId);
|
|
47373
|
+
}
|
|
47374
|
+
const branchNames = branchesData.map((b) => b.name);
|
|
47375
|
+
const currency = stock;
|
|
47376
|
+
const currentBranch = branchesData.find((b) => b._id === branchId);
|
|
47377
|
+
const columns = [
|
|
47378
|
+
{
|
|
47379
|
+
header: "Name",
|
|
47380
|
+
key: "name",
|
|
47381
|
+
className: "text-xs whitespace-nowrap",
|
|
47382
|
+
render: (row) => {
|
|
47383
|
+
const yard = row?.yard || 0;
|
|
47384
|
+
return /* @__PURE__ */ jsx259("div", { className: "", children: /* @__PURE__ */ jsx259("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
|
|
47385
|
+
}
|
|
47386
|
+
},
|
|
47387
|
+
...!value ? branchNames.map((branchName) => ({
|
|
47388
|
+
header: branchName,
|
|
47389
|
+
key: branchName,
|
|
47390
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
47391
|
+
render: (row) => {
|
|
47392
|
+
const qty = row[branchName];
|
|
47393
|
+
return /* @__PURE__ */ jsx259(
|
|
47394
|
+
"div",
|
|
47395
|
+
{
|
|
47396
|
+
className: qty > 0 ? "text-green-500 font-bold" : qty < 0 ? "text-red-500 font-bold" : "",
|
|
47397
|
+
children: Formats_default.Amount(qty, false)
|
|
47398
|
+
}
|
|
47399
|
+
);
|
|
47400
|
+
}
|
|
47401
|
+
})) : [],
|
|
47402
|
+
{
|
|
47403
|
+
header: "Total Qty",
|
|
47404
|
+
key: "total",
|
|
47405
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
47406
|
+
render: (row) => {
|
|
47407
|
+
const total = row.total;
|
|
47408
|
+
return /* @__PURE__ */ jsx259(
|
|
47409
|
+
"span",
|
|
47410
|
+
{
|
|
47411
|
+
className: total > 0 ? "text-green-500 font-bold" : total < 0 ? "text-red-500 font-bold" : "",
|
|
47412
|
+
children: Formats_default.Amount(total, false)
|
|
47413
|
+
}
|
|
47414
|
+
);
|
|
47415
|
+
},
|
|
47416
|
+
renderFooter: (data2) => {
|
|
47417
|
+
const total = data2.reduce((acc, row) => acc + row.total, 0);
|
|
47418
|
+
return /* @__PURE__ */ jsx259("span", { className: " font-bold", children: Formats_default.Amount(total, false) });
|
|
47419
|
+
}
|
|
47420
|
+
}
|
|
47421
|
+
];
|
|
47422
|
+
let runningBalance = 0;
|
|
47423
|
+
const datas = (data?.data || []).map((item) => {
|
|
47424
|
+
runningBalance += item.calculatedAmount;
|
|
47425
|
+
return {
|
|
47426
|
+
...item,
|
|
47427
|
+
runningBalance
|
|
47428
|
+
};
|
|
47429
|
+
});
|
|
47430
|
+
return /* @__PURE__ */ jsxs228(Fragment129, { children: [
|
|
47431
|
+
/* @__PURE__ */ jsx259(TransactionView, {}),
|
|
47432
|
+
/* @__PURE__ */ jsx259(
|
|
47433
|
+
A4DataView,
|
|
47434
|
+
{
|
|
47435
|
+
columns,
|
|
47436
|
+
data: datas || [],
|
|
47437
|
+
index: true,
|
|
47438
|
+
title: `Pending Collections`,
|
|
47439
|
+
subtitle: branchId ? currentBranch?.name : "All Branches",
|
|
47440
|
+
tableTitle: value ? "Current Stock Value" : "Current Stock Level",
|
|
47441
|
+
fixed: false,
|
|
47442
|
+
headers: /* @__PURE__ */ jsx259(
|
|
47443
|
+
Select,
|
|
47444
|
+
{
|
|
47445
|
+
options: options9,
|
|
47446
|
+
value: stockType,
|
|
47447
|
+
className: "w-32! print:hidden",
|
|
47448
|
+
onChange: (e) => {
|
|
47449
|
+
setQuery({ stockType: e });
|
|
47450
|
+
}
|
|
47451
|
+
}
|
|
47452
|
+
)
|
|
47453
|
+
}
|
|
47454
|
+
)
|
|
47455
|
+
] });
|
|
47456
|
+
};
|
|
47457
|
+
var CollectionLevel_default = CollectionLevel;
|
|
47458
|
+
|
|
47459
|
+
// src/components/Transactions/3/sale2/index.ts
|
|
47460
|
+
var Sale22 = {
|
|
47461
|
+
List: List_default6,
|
|
47462
|
+
Form: pos_default5,
|
|
47463
|
+
Collection: Collection_default,
|
|
47464
|
+
CollectionLevel: CollectionLevel_default
|
|
47465
|
+
};
|
|
47466
|
+
var sale2_default2 = Sale22;
|
|
47467
|
+
|
|
47468
|
+
// src/components/Transactions/3/purchase3/List.tsx
|
|
47469
|
+
import { useNavigate as useNavigate63, useParams as useParams103 } from "react-router-dom";
|
|
47470
|
+
import {
|
|
47471
|
+
EllipsisVertical as EllipsisVertical46,
|
|
47472
|
+
Eye as Eye27,
|
|
47473
|
+
FilePenLine as FilePenLine42,
|
|
47474
|
+
Trash2 as Trash252
|
|
47475
|
+
} from "lucide-react";
|
|
47476
|
+
import { Fragment as Fragment130, jsx as jsx260, jsxs as jsxs229 } from "react/jsx-runtime";
|
|
47477
|
+
function purchase3List({
|
|
47478
|
+
url,
|
|
47479
|
+
type = "product"
|
|
47480
|
+
}) {
|
|
47481
|
+
const { branchId } = useParams103();
|
|
47482
|
+
const navigate = useNavigate63();
|
|
47483
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
47484
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
47485
|
+
url: url || `/transactions/get?type=stock&stock=purchase-3&stockType=${type}${branchId ? `&fromBranch=${branchId}` : ""}`,
|
|
47486
|
+
dateFilter: true
|
|
47487
|
+
});
|
|
47488
|
+
const { Modal: Modal2 } = useModal();
|
|
47489
|
+
const { PosPrinter } = usePosPrinter_default();
|
|
47490
|
+
const items = (data2) => [
|
|
47491
|
+
{
|
|
47492
|
+
label: `View Stock Purchase`,
|
|
47493
|
+
icon: /* @__PURE__ */ jsx260(Eye27, { size: 16 }),
|
|
47494
|
+
className: "w-[200px]",
|
|
47495
|
+
onClick: () => openTransaction({ id: data2?._id, type: "stock" })
|
|
47496
|
+
},
|
|
47497
|
+
{
|
|
47498
|
+
label: `Edit Stock Purchase`,
|
|
47499
|
+
icon: /* @__PURE__ */ jsx260(FilePenLine42, { size: 16 }),
|
|
47500
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
47501
|
+
},
|
|
47502
|
+
{
|
|
47503
|
+
label: `Delete Stock Purchase`,
|
|
47504
|
+
icon: /* @__PURE__ */ jsx260(Trash252, { className: "text-red-500", size: 16 }),
|
|
47505
|
+
onClick: () => {
|
|
47506
|
+
openTransaction({
|
|
47507
|
+
id: data2?._id,
|
|
47508
|
+
type: "stock",
|
|
47509
|
+
reverseable: { reload }
|
|
47510
|
+
});
|
|
47511
|
+
}
|
|
47512
|
+
}
|
|
47513
|
+
].filter(Boolean);
|
|
47514
|
+
const columns = [
|
|
47515
|
+
{
|
|
47516
|
+
accessorKey: "date",
|
|
47517
|
+
header: "Date",
|
|
47518
|
+
cell: ({ row }) => {
|
|
47519
|
+
const stock = row.original;
|
|
47520
|
+
return /* @__PURE__ */ jsxs229("div", { className: "flex flex-col", children: [
|
|
47521
|
+
/* @__PURE__ */ jsx260("span", { children: stock?.date }),
|
|
47522
|
+
/* @__PURE__ */ jsx260(
|
|
47523
|
+
"span",
|
|
47524
|
+
{
|
|
47525
|
+
onClick: () => openTransaction({ id: stock?._id, type: "stock" }),
|
|
47526
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
47527
|
+
children: stock.ref
|
|
47528
|
+
}
|
|
47529
|
+
)
|
|
47530
|
+
] });
|
|
47531
|
+
}
|
|
47532
|
+
},
|
|
47533
|
+
{
|
|
47534
|
+
accessorKey: "branch",
|
|
47535
|
+
header: "Branch",
|
|
47536
|
+
cell: ({ row }) => {
|
|
47537
|
+
const stock = row.original;
|
|
47538
|
+
const branch = stock?.fromBranchData?.name;
|
|
47539
|
+
return /* @__PURE__ */ jsx260("span", { children: branch });
|
|
47540
|
+
}
|
|
47541
|
+
},
|
|
47542
|
+
{
|
|
47543
|
+
accessorKey: "supplier/wallet",
|
|
47544
|
+
header: "Supplier/Wallet",
|
|
47545
|
+
cell: ({ row }) => {
|
|
47546
|
+
const stock = row.original;
|
|
47547
|
+
const walletName = stock?.fromWalletData?.name;
|
|
47548
|
+
const accountName = stock?.accountData?.name || stock?.accountName;
|
|
47549
|
+
return /* @__PURE__ */ jsxs229("div", { className: "flex flex-col gap-0.5", children: [
|
|
47550
|
+
stock?.cash > 0 && walletName && /* @__PURE__ */ jsxs229("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47551
|
+
"Wallet:",
|
|
47552
|
+
" ",
|
|
47553
|
+
/* @__PURE__ */ jsx260("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: walletName })
|
|
47554
|
+
] }),
|
|
47555
|
+
stock?.credit > 0 && accountName && /* @__PURE__ */ jsxs229("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47556
|
+
"Supplier:",
|
|
47557
|
+
" ",
|
|
47558
|
+
/* @__PURE__ */ jsx260("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: accountName })
|
|
47559
|
+
] }),
|
|
47560
|
+
!(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ jsx260("span", { children: stock?.purchase === "cash" ? walletName || "Cash Wallet" : accountName || "Supplier" })
|
|
47561
|
+
] });
|
|
47562
|
+
}
|
|
47563
|
+
},
|
|
47564
|
+
{
|
|
47565
|
+
accessorKey: "stockType",
|
|
47566
|
+
header: "Stock Type",
|
|
47567
|
+
cell: ({ row }) => {
|
|
47568
|
+
const stock = row.original;
|
|
47569
|
+
return /* @__PURE__ */ jsx260("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx260("span", { children: stock?.stockType }) });
|
|
47570
|
+
}
|
|
47571
|
+
},
|
|
47572
|
+
{
|
|
47573
|
+
accessorKey: "action",
|
|
47574
|
+
header: "Action",
|
|
47575
|
+
cell: ({ row }) => {
|
|
47576
|
+
const stock = row.original;
|
|
47577
|
+
const purchaseType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.purchase;
|
|
47578
|
+
return /* @__PURE__ */ jsxs229("div", { className: "flex flex-col", children: [
|
|
47579
|
+
/* @__PURE__ */ jsx260("span", { className: `capitalize text-red-600`, children: "Stock Purchased" }),
|
|
47580
|
+
/* @__PURE__ */ jsx260("span", { className: "capitalize", children: purchaseType })
|
|
47581
|
+
] });
|
|
47582
|
+
}
|
|
47583
|
+
},
|
|
47584
|
+
{
|
|
47585
|
+
accessorKey: "amount",
|
|
47586
|
+
header: "Amount",
|
|
47587
|
+
cell: ({ row }) => {
|
|
47588
|
+
const stock = row.original;
|
|
47589
|
+
const amount = stock?.amount - (stock?.discount || 0);
|
|
47590
|
+
return /* @__PURE__ */ jsxs229("div", { className: "flex flex-col", children: [
|
|
47591
|
+
/* @__PURE__ */ jsx260("span", { className: "font-semibold", children: Formats_default.Price(amount, stock?.currency, false) }),
|
|
47592
|
+
stock?.discount ? /* @__PURE__ */ jsxs229("span", { className: "text-xs text-red-600 ", children: [
|
|
47593
|
+
"Original:",
|
|
47594
|
+
/* @__PURE__ */ jsx260("del", { children: Formats_default.Price(stock?.amount, stock?.currency, false) })
|
|
47595
|
+
] }) : null
|
|
47596
|
+
] });
|
|
47597
|
+
}
|
|
47598
|
+
},
|
|
47599
|
+
{
|
|
47600
|
+
accessorKey: "actions",
|
|
47601
|
+
header: "Actions",
|
|
47602
|
+
cell: ({ row }) => {
|
|
47603
|
+
const data2 = row.original;
|
|
47604
|
+
return /* @__PURE__ */ jsx260(
|
|
47605
|
+
Dropdown,
|
|
47606
|
+
{
|
|
47607
|
+
className: "cursor-pointer",
|
|
47608
|
+
items: items(data2),
|
|
47609
|
+
triggerMode: "hover",
|
|
47610
|
+
children: /* @__PURE__ */ jsx260(EllipsisVertical46, {})
|
|
47611
|
+
}
|
|
47612
|
+
);
|
|
47613
|
+
}
|
|
47614
|
+
}
|
|
47615
|
+
];
|
|
47616
|
+
const stocks = data?.data || [];
|
|
47617
|
+
return /* @__PURE__ */ jsxs229(Fragment130, { children: [
|
|
47618
|
+
/* @__PURE__ */ jsx260(TransactionView, {}),
|
|
47619
|
+
/* @__PURE__ */ jsx260(Modal2, {}),
|
|
47620
|
+
/* @__PURE__ */ jsx260(PosPrinter, {}),
|
|
47621
|
+
/* @__PURE__ */ jsx260(
|
|
47231
47622
|
TransactionViewComponent,
|
|
47232
47623
|
{
|
|
47233
47624
|
columns,
|
|
@@ -47251,19 +47642,19 @@ import { useEffect as useEffect112, useLayoutEffect as useLayoutEffect8, useStat
|
|
|
47251
47642
|
|
|
47252
47643
|
// src/components/Transactions/3/purchase3/header.tsx
|
|
47253
47644
|
import { useFormContext as useFormContext10 } from "react-hook-form";
|
|
47254
|
-
import { useParams as
|
|
47645
|
+
import { useParams as useParams104 } from "react-router-dom";
|
|
47255
47646
|
import { useEffect as useEffect110 } from "react";
|
|
47256
|
-
import { jsx as
|
|
47647
|
+
import { jsx as jsx261, jsxs as jsxs230 } from "react/jsx-runtime";
|
|
47257
47648
|
function SaleHeader4({ stockType }) {
|
|
47258
47649
|
const form = useFormContext10();
|
|
47259
|
-
const { branchId } =
|
|
47650
|
+
const { branchId } = useParams104();
|
|
47260
47651
|
useEffect110(() => {
|
|
47261
47652
|
if (branchId) {
|
|
47262
47653
|
form.setValue("branch", branchId);
|
|
47263
47654
|
}
|
|
47264
47655
|
}, [branchId]);
|
|
47265
|
-
return /* @__PURE__ */
|
|
47266
|
-
/* @__PURE__ */
|
|
47656
|
+
return /* @__PURE__ */ jsxs230("section", { className: "grid grid-cols-1 md:grid-cols-4 lg:grid-cols-5 border-b-2 pb-4 pt-2 gap-4", children: [
|
|
47657
|
+
/* @__PURE__ */ jsx261(
|
|
47267
47658
|
Fields_default.DateInput,
|
|
47268
47659
|
{
|
|
47269
47660
|
label: "Date",
|
|
@@ -47273,7 +47664,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47273
47664
|
required: true
|
|
47274
47665
|
}
|
|
47275
47666
|
),
|
|
47276
|
-
/* @__PURE__ */
|
|
47667
|
+
/* @__PURE__ */ jsx261(
|
|
47277
47668
|
Feilds_default.Branches,
|
|
47278
47669
|
{
|
|
47279
47670
|
name: "branch",
|
|
@@ -47284,7 +47675,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47284
47675
|
className: "h-[30px]!"
|
|
47285
47676
|
}
|
|
47286
47677
|
),
|
|
47287
|
-
/* @__PURE__ */
|
|
47678
|
+
/* @__PURE__ */ jsx261(
|
|
47288
47679
|
Fields_default.Select,
|
|
47289
47680
|
{
|
|
47290
47681
|
label: "Stock Type",
|
|
@@ -47299,7 +47690,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47299
47690
|
className: "rounded-md! min-w-[100px]! h-[30px]!"
|
|
47300
47691
|
}
|
|
47301
47692
|
),
|
|
47302
|
-
/* @__PURE__ */
|
|
47693
|
+
/* @__PURE__ */ jsx261(
|
|
47303
47694
|
Fields_default.Select,
|
|
47304
47695
|
{
|
|
47305
47696
|
label: "Currency",
|
|
@@ -47314,7 +47705,7 @@ function SaleHeader4({ stockType }) {
|
|
|
47314
47705
|
className: "rounded-md! min-w-[100px]! h-[30px]!"
|
|
47315
47706
|
}
|
|
47316
47707
|
),
|
|
47317
|
-
/* @__PURE__ */
|
|
47708
|
+
/* @__PURE__ */ jsx261(
|
|
47318
47709
|
Fields_default.Input,
|
|
47319
47710
|
{
|
|
47320
47711
|
label: "Invoice Number",
|
|
@@ -47363,7 +47754,7 @@ var FetchBalance_default6 = useFetchBalance6;
|
|
|
47363
47754
|
|
|
47364
47755
|
// src/components/Transactions/3/purchase3/table.tsx
|
|
47365
47756
|
import { useEffect as useEffect111 } from "react";
|
|
47366
|
-
import { Fragment as
|
|
47757
|
+
import { Fragment as Fragment131, jsx as jsx262, jsxs as jsxs231 } from "react/jsx-runtime";
|
|
47367
47758
|
function PurchaseStockTable({
|
|
47368
47759
|
data,
|
|
47369
47760
|
methods,
|
|
@@ -47454,7 +47845,7 @@ function PurchaseStockTable({
|
|
|
47454
47845
|
methods.setValue("lineObj", rowData.lineObj);
|
|
47455
47846
|
}
|
|
47456
47847
|
}, [rowData?.lineObj]);
|
|
47457
|
-
return /* @__PURE__ */
|
|
47848
|
+
return /* @__PURE__ */ jsx262("div", { className: "flex items-center gap-2 w-full ", children: /* @__PURE__ */ jsx262(
|
|
47458
47849
|
Fields_default.SearchApi,
|
|
47459
47850
|
{
|
|
47460
47851
|
id: "pti-lineId",
|
|
@@ -47503,8 +47894,8 @@ function PurchaseStockTable({
|
|
|
47503
47894
|
cell: ({ row }) => {
|
|
47504
47895
|
const lineObj2 = row.original?.lineObj;
|
|
47505
47896
|
const lineName = lineObj2?.name;
|
|
47506
|
-
return /* @__PURE__ */
|
|
47507
|
-
stockType === "product" && /* @__PURE__ */
|
|
47897
|
+
return /* @__PURE__ */ jsxs231("div", { className: "flex items-center gap-2 w-full ", children: [
|
|
47898
|
+
stockType === "product" && /* @__PURE__ */ jsx262("div", { className: "h-[20px] w-[20px] rounded-md overflow-hidden", children: /* @__PURE__ */ jsx262(
|
|
47508
47899
|
ProductImage_default,
|
|
47509
47900
|
{
|
|
47510
47901
|
src: lineObj2?.imgUrl || lineObj2?.image || null,
|
|
@@ -47512,7 +47903,7 @@ function PurchaseStockTable({
|
|
|
47512
47903
|
width: 20
|
|
47513
47904
|
}
|
|
47514
47905
|
) }),
|
|
47515
|
-
/* @__PURE__ */
|
|
47906
|
+
/* @__PURE__ */ jsx262("h1", { children: lineName })
|
|
47516
47907
|
] });
|
|
47517
47908
|
}
|
|
47518
47909
|
},
|
|
@@ -47521,7 +47912,7 @@ function PurchaseStockTable({
|
|
|
47521
47912
|
header: "Available",
|
|
47522
47913
|
maxSize: 90,
|
|
47523
47914
|
meta: {
|
|
47524
|
-
field: ({ value, onChange }) => /* @__PURE__ */
|
|
47915
|
+
field: ({ value, onChange }) => /* @__PURE__ */ jsx262(Fragment131, { children: balanceLoading ? /* @__PURE__ */ jsx262(LoadingSpin, { size: "sm", className: "text-blue-600" }) : /* @__PURE__ */ jsx262(
|
|
47525
47916
|
Fields_default.Input,
|
|
47526
47917
|
{
|
|
47527
47918
|
id: "pti-lineBalance",
|
|
@@ -47539,7 +47930,7 @@ function PurchaseStockTable({
|
|
|
47539
47930
|
) })
|
|
47540
47931
|
},
|
|
47541
47932
|
cell: () => {
|
|
47542
|
-
return /* @__PURE__ */
|
|
47933
|
+
return /* @__PURE__ */ jsx262("h2", { children: "-" });
|
|
47543
47934
|
}
|
|
47544
47935
|
},
|
|
47545
47936
|
...!isRate ? [
|
|
@@ -47548,7 +47939,7 @@ function PurchaseStockTable({
|
|
|
47548
47939
|
header: "Cost",
|
|
47549
47940
|
maxSize: 140,
|
|
47550
47941
|
meta: {
|
|
47551
|
-
field: ({ value, onChange }) => /* @__PURE__ */
|
|
47942
|
+
field: ({ value, onChange }) => /* @__PURE__ */ jsx262(
|
|
47552
47943
|
Fields_default.Input,
|
|
47553
47944
|
{
|
|
47554
47945
|
id: "pti-lineCost",
|
|
@@ -47566,7 +47957,7 @@ function PurchaseStockTable({
|
|
|
47566
47957
|
)
|
|
47567
47958
|
},
|
|
47568
47959
|
cell: ({ row }) => {
|
|
47569
|
-
return /* @__PURE__ */
|
|
47960
|
+
return /* @__PURE__ */ jsx262("h2", { children: Formats_default.Amount(row.original?.lineCost || 0) });
|
|
47570
47961
|
}
|
|
47571
47962
|
}
|
|
47572
47963
|
] : [],
|
|
@@ -47575,7 +47966,7 @@ function PurchaseStockTable({
|
|
|
47575
47966
|
header: "Qty",
|
|
47576
47967
|
maxSize: 90,
|
|
47577
47968
|
meta: {
|
|
47578
|
-
field: ({ value, onChange }) => /* @__PURE__ */
|
|
47969
|
+
field: ({ value, onChange }) => /* @__PURE__ */ jsx262(
|
|
47579
47970
|
Fields_default.Input,
|
|
47580
47971
|
{
|
|
47581
47972
|
id: "pti-lineQuantity",
|
|
@@ -47592,7 +47983,7 @@ function PurchaseStockTable({
|
|
|
47592
47983
|
)
|
|
47593
47984
|
},
|
|
47594
47985
|
cell: ({ row }) => {
|
|
47595
|
-
return /* @__PURE__ */
|
|
47986
|
+
return /* @__PURE__ */ jsx262("h2", { children: Formats_default.XQty(row.original?.lineQuantity || 0) });
|
|
47596
47987
|
}
|
|
47597
47988
|
},
|
|
47598
47989
|
{
|
|
@@ -47600,7 +47991,7 @@ function PurchaseStockTable({
|
|
|
47600
47991
|
header: "Price",
|
|
47601
47992
|
maxSize: 90,
|
|
47602
47993
|
meta: {
|
|
47603
|
-
field: ({ value, onChange }) => /* @__PURE__ */
|
|
47994
|
+
field: ({ value, onChange }) => /* @__PURE__ */ jsx262(
|
|
47604
47995
|
Fields_default.Input,
|
|
47605
47996
|
{
|
|
47606
47997
|
id: "pti-lineCost",
|
|
@@ -47617,7 +48008,7 @@ function PurchaseStockTable({
|
|
|
47617
48008
|
)
|
|
47618
48009
|
},
|
|
47619
48010
|
cell: ({ row }) => {
|
|
47620
|
-
return /* @__PURE__ */
|
|
48011
|
+
return /* @__PURE__ */ jsx262("h2", { children: Formats_default.XQty(row.original?.lineSell || 0) });
|
|
47621
48012
|
}
|
|
47622
48013
|
},
|
|
47623
48014
|
{
|
|
@@ -47625,7 +48016,7 @@ function PurchaseStockTable({
|
|
|
47625
48016
|
header: "Total",
|
|
47626
48017
|
maxSize: 150,
|
|
47627
48018
|
meta: {
|
|
47628
|
-
field: ({ value, onChange }) => /* @__PURE__ */
|
|
48019
|
+
field: ({ value, onChange }) => /* @__PURE__ */ jsx262(
|
|
47629
48020
|
Fields_default.Input,
|
|
47630
48021
|
{
|
|
47631
48022
|
id: "pti-lineTotal",
|
|
@@ -47643,11 +48034,11 @@ function PurchaseStockTable({
|
|
|
47643
48034
|
)
|
|
47644
48035
|
},
|
|
47645
48036
|
cell: ({ row }) => {
|
|
47646
|
-
return /* @__PURE__ */
|
|
48037
|
+
return /* @__PURE__ */ jsx262("h2", { children: Formats_default.Amount(row.original?.lineTotal || 0) });
|
|
47647
48038
|
},
|
|
47648
48039
|
footer: ({ row }) => {
|
|
47649
48040
|
const total = data?.reduce((acc, row2) => acc + row2.lineTotal, 0);
|
|
47650
|
-
return /* @__PURE__ */
|
|
48041
|
+
return /* @__PURE__ */ jsx262("h2", { children: Formats_default.Price(total || 0, currency, false) });
|
|
47651
48042
|
}
|
|
47652
48043
|
}
|
|
47653
48044
|
];
|
|
@@ -47658,7 +48049,7 @@ function PurchaseStockTable({
|
|
|
47658
48049
|
methods.setValue("lineBalance", 0);
|
|
47659
48050
|
}
|
|
47660
48051
|
}, [lineId, branch]);
|
|
47661
|
-
return /* @__PURE__ */
|
|
48052
|
+
return /* @__PURE__ */ jsx262(Fragment131, { children: /* @__PURE__ */ jsx262(
|
|
47662
48053
|
PostTable,
|
|
47663
48054
|
{
|
|
47664
48055
|
data: data || [],
|
|
@@ -47672,7 +48063,7 @@ function PurchaseStockTable({
|
|
|
47672
48063
|
isLoading: getLoading,
|
|
47673
48064
|
defaultExpanded: true,
|
|
47674
48065
|
hasSubComponent: () => stockType !== "product",
|
|
47675
|
-
renderSubComponent: ({ row }) => /* @__PURE__ */
|
|
48066
|
+
renderSubComponent: ({ row }) => /* @__PURE__ */ jsx262(PackView_default, { type: stockType, data: row?.lineObj?.products })
|
|
47676
48067
|
},
|
|
47677
48068
|
data?.length
|
|
47678
48069
|
) });
|
|
@@ -47716,12 +48107,12 @@ var schema_default8 = AdjustmentStockSchema6;
|
|
|
47716
48107
|
|
|
47717
48108
|
// src/components/Transactions/3/purchase3/pos.tsx
|
|
47718
48109
|
import { ArrowLeft as ArrowLeft12 } from "lucide-react";
|
|
47719
|
-
import { useParams as
|
|
48110
|
+
import { useParams as useParams105 } from "react-router-dom";
|
|
47720
48111
|
|
|
47721
48112
|
// src/components/Transactions/3/purchase3/Submit.tsx
|
|
47722
48113
|
import { useFormContext as useFormContext11 } from "react-hook-form";
|
|
47723
|
-
import { useMemo as
|
|
47724
|
-
import { jsx as
|
|
48114
|
+
import { useMemo as useMemo51 } from "react";
|
|
48115
|
+
import { jsx as jsx263, jsxs as jsxs232 } from "react/jsx-runtime";
|
|
47725
48116
|
var CompletePurchaseModal = ({
|
|
47726
48117
|
totalAmount,
|
|
47727
48118
|
onSubmit,
|
|
@@ -47770,7 +48161,7 @@ var CompletePurchaseModal = ({
|
|
|
47770
48161
|
}
|
|
47771
48162
|
};
|
|
47772
48163
|
const isRate = defaultCurrency !== currency;
|
|
47773
|
-
const exchangedNet =
|
|
48164
|
+
const exchangedNet = useMemo51(() => {
|
|
47774
48165
|
const total = forex_default.exchangedAmount({
|
|
47775
48166
|
accountCurrency: defaultCurrency,
|
|
47776
48167
|
transactionCurrency: currency,
|
|
@@ -47781,27 +48172,27 @@ var CompletePurchaseModal = ({
|
|
|
47781
48172
|
return Formats_default.Price(total, defaultCurrency, false);
|
|
47782
48173
|
}, [netAmount, currency, defaultCurrency, cash, credit, discount]);
|
|
47783
48174
|
const { isSubmitting } = form.formState;
|
|
47784
|
-
return /* @__PURE__ */
|
|
47785
|
-
/* @__PURE__ */
|
|
47786
|
-
/* @__PURE__ */
|
|
47787
|
-
/* @__PURE__ */
|
|
47788
|
-
discount > 0 && /* @__PURE__ */
|
|
48175
|
+
return /* @__PURE__ */ jsx263(Card, { isLoading: isSubmitting, children: /* @__PURE__ */ jsxs232("div", { className: "space-y-5", children: [
|
|
48176
|
+
/* @__PURE__ */ jsxs232("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: [
|
|
48177
|
+
/* @__PURE__ */ jsx263("span", { className: "text-xs uppercase tracking-wider text-emerald-600 dark:text-emerald-400 font-bold", children: "Net Total Amount" }),
|
|
48178
|
+
/* @__PURE__ */ jsx263("h2", { className: "text-3xl font-black text-emerald-700 dark:text-emerald-300", children: Formats_default.Price(netAmount, currency, false) }),
|
|
48179
|
+
discount > 0 && /* @__PURE__ */ jsxs232("p", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
|
|
47789
48180
|
"Original:",
|
|
47790
48181
|
" ",
|
|
47791
|
-
/* @__PURE__ */
|
|
48182
|
+
/* @__PURE__ */ jsx263("span", { className: "line-through", children: Formats_default.Price(totalAmount, currency, false) })
|
|
47792
48183
|
] })
|
|
47793
48184
|
] }),
|
|
47794
|
-
/* @__PURE__ */
|
|
47795
|
-
/* @__PURE__ */
|
|
47796
|
-
/* @__PURE__ */
|
|
47797
|
-
(discount > 0 || isRate) && /* @__PURE__ */
|
|
48185
|
+
/* @__PURE__ */ jsxs232("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: [
|
|
48186
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
48187
|
+
/* @__PURE__ */ jsx263("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount & Rate" }),
|
|
48188
|
+
(discount > 0 || isRate) && /* @__PURE__ */ jsx263("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" })
|
|
47798
48189
|
] }),
|
|
47799
|
-
/* @__PURE__ */
|
|
48190
|
+
/* @__PURE__ */ jsxs232(
|
|
47800
48191
|
"div",
|
|
47801
48192
|
{
|
|
47802
48193
|
className: isRate ? "grid grid-cols-1 md:grid-cols-2 gap-4" : "grid grid-cols-1 gap-4",
|
|
47803
48194
|
children: [
|
|
47804
|
-
/* @__PURE__ */
|
|
48195
|
+
/* @__PURE__ */ jsx263(
|
|
47805
48196
|
Fields_default.Input,
|
|
47806
48197
|
{
|
|
47807
48198
|
label: "Discount Amount",
|
|
@@ -47812,7 +48203,7 @@ var CompletePurchaseModal = ({
|
|
|
47812
48203
|
className: "h-[40px]!"
|
|
47813
48204
|
}
|
|
47814
48205
|
),
|
|
47815
|
-
isRate && /* @__PURE__ */
|
|
48206
|
+
isRate && /* @__PURE__ */ jsx263(
|
|
47816
48207
|
Fields_default.Input,
|
|
47817
48208
|
{
|
|
47818
48209
|
label: "Rate",
|
|
@@ -47827,13 +48218,13 @@ var CompletePurchaseModal = ({
|
|
|
47827
48218
|
}
|
|
47828
48219
|
)
|
|
47829
48220
|
] }),
|
|
47830
|
-
/* @__PURE__ */
|
|
47831
|
-
/* @__PURE__ */
|
|
47832
|
-
/* @__PURE__ */
|
|
47833
|
-
cash > 0 && /* @__PURE__ */
|
|
48221
|
+
/* @__PURE__ */ jsxs232("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: [
|
|
48222
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
48223
|
+
/* @__PURE__ */ jsx263("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Cash Payment" }),
|
|
48224
|
+
cash > 0 && /* @__PURE__ */ jsx263("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" })
|
|
47834
48225
|
] }),
|
|
47835
|
-
/* @__PURE__ */
|
|
47836
|
-
/* @__PURE__ */
|
|
48226
|
+
/* @__PURE__ */ jsxs232("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
48227
|
+
/* @__PURE__ */ jsx263(
|
|
47837
48228
|
Fields_default.Input,
|
|
47838
48229
|
{
|
|
47839
48230
|
label: "Cash Amount",
|
|
@@ -47844,7 +48235,7 @@ var CompletePurchaseModal = ({
|
|
|
47844
48235
|
className: "h-[40px]!"
|
|
47845
48236
|
}
|
|
47846
48237
|
),
|
|
47847
|
-
/* @__PURE__ */
|
|
48238
|
+
/* @__PURE__ */ jsx263(
|
|
47848
48239
|
Feilds_default2.Wallet,
|
|
47849
48240
|
{
|
|
47850
48241
|
name: "wallet",
|
|
@@ -47858,13 +48249,13 @@ var CompletePurchaseModal = ({
|
|
|
47858
48249
|
)
|
|
47859
48250
|
] })
|
|
47860
48251
|
] }),
|
|
47861
|
-
/* @__PURE__ */
|
|
47862
|
-
/* @__PURE__ */
|
|
47863
|
-
/* @__PURE__ */
|
|
47864
|
-
credit > 0 && /* @__PURE__ */
|
|
48252
|
+
/* @__PURE__ */ jsxs232("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: [
|
|
48253
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
|
|
48254
|
+
/* @__PURE__ */ jsx263("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Credit Payment" }),
|
|
48255
|
+
credit > 0 && /* @__PURE__ */ jsx263("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" })
|
|
47865
48256
|
] }),
|
|
47866
|
-
/* @__PURE__ */
|
|
47867
|
-
/* @__PURE__ */
|
|
48257
|
+
/* @__PURE__ */ jsxs232("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
48258
|
+
/* @__PURE__ */ jsx263(
|
|
47868
48259
|
Fields_default.Input,
|
|
47869
48260
|
{
|
|
47870
48261
|
label: "Credit Amount",
|
|
@@ -47875,7 +48266,7 @@ var CompletePurchaseModal = ({
|
|
|
47875
48266
|
className: "h-[40px]!"
|
|
47876
48267
|
}
|
|
47877
48268
|
),
|
|
47878
|
-
/* @__PURE__ */
|
|
48269
|
+
/* @__PURE__ */ jsx263(
|
|
47879
48270
|
Feilds_default.Customer,
|
|
47880
48271
|
{
|
|
47881
48272
|
name: "supplier",
|
|
@@ -47889,37 +48280,37 @@ var CompletePurchaseModal = ({
|
|
|
47889
48280
|
)
|
|
47890
48281
|
] })
|
|
47891
48282
|
] }),
|
|
47892
|
-
/* @__PURE__ */
|
|
47893
|
-
/* @__PURE__ */
|
|
47894
|
-
/* @__PURE__ */
|
|
47895
|
-
/* @__PURE__ */
|
|
48283
|
+
/* @__PURE__ */ jsxs232("div", { className: "pt-2 space-y-2.5", children: [
|
|
48284
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex justify-between items-center text-sm px-2", children: [
|
|
48285
|
+
/* @__PURE__ */ jsx263("span", { className: "text-gray-500 dark:text-zinc-400", children: "Total Before Discount:" }),
|
|
48286
|
+
/* @__PURE__ */ jsx263("span", { className: "font-semibold text-gray-900 dark:text-white", children: Formats_default.Price(totalAmount, currency, false) })
|
|
47896
48287
|
] }),
|
|
47897
|
-
discount > 0 && /* @__PURE__ */
|
|
47898
|
-
/* @__PURE__ */
|
|
47899
|
-
/* @__PURE__ */
|
|
48288
|
+
discount > 0 && /* @__PURE__ */ jsxs232("div", { className: "flex justify-between items-center text-sm px-2 text-amber-600 dark:text-amber-400", children: [
|
|
48289
|
+
/* @__PURE__ */ jsx263("span", { children: "Discount Applied:" }),
|
|
48290
|
+
/* @__PURE__ */ jsxs232("span", { children: [
|
|
47900
48291
|
"-",
|
|
47901
48292
|
Formats_default.Price(discount, currency, false)
|
|
47902
48293
|
] })
|
|
47903
48294
|
] }),
|
|
47904
|
-
/* @__PURE__ */
|
|
47905
|
-
/* @__PURE__ */
|
|
47906
|
-
/* @__PURE__ */
|
|
48295
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex justify-between items-center text-sm px-2 text-blue-600 dark:text-blue-400", children: [
|
|
48296
|
+
/* @__PURE__ */ jsx263("span", { children: "Cash Paid:" }),
|
|
48297
|
+
/* @__PURE__ */ jsx263("span", { children: Formats_default.Price(cash, currency, false) })
|
|
47907
48298
|
] }),
|
|
47908
|
-
/* @__PURE__ */
|
|
47909
|
-
/* @__PURE__ */
|
|
47910
|
-
/* @__PURE__ */
|
|
48299
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex justify-between items-center text-sm px-2 text-red-500 dark:text-red-400", children: [
|
|
48300
|
+
/* @__PURE__ */ jsx263("span", { children: "Credit Amount:" }),
|
|
48301
|
+
/* @__PURE__ */ jsx263("span", { children: Formats_default.Price(credit, currency, false) })
|
|
47911
48302
|
] }),
|
|
47912
|
-
/* @__PURE__ */
|
|
47913
|
-
/* @__PURE__ */
|
|
47914
|
-
/* @__PURE__ */
|
|
48303
|
+
/* @__PURE__ */ jsxs232("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: [
|
|
48304
|
+
/* @__PURE__ */ jsx263("span", { children: "Net Total:" }),
|
|
48305
|
+
/* @__PURE__ */ jsx263("span", { children: Formats_default.Price(netAmount, currency, false) })
|
|
47915
48306
|
] }),
|
|
47916
|
-
isRate && /* @__PURE__ */
|
|
47917
|
-
/* @__PURE__ */
|
|
47918
|
-
/* @__PURE__ */
|
|
48307
|
+
isRate && /* @__PURE__ */ jsxs232("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: [
|
|
48308
|
+
/* @__PURE__ */ jsx263("span", { children: "Exchanged Net Total:" }),
|
|
48309
|
+
/* @__PURE__ */ jsx263("span", { children: exchangedNet })
|
|
47919
48310
|
] })
|
|
47920
48311
|
] }),
|
|
47921
|
-
/* @__PURE__ */
|
|
47922
|
-
/* @__PURE__ */
|
|
48312
|
+
/* @__PURE__ */ jsxs232("div", { className: "flex justify-end gap-3 pt-3 border-t dark:border-zinc-800", children: [
|
|
48313
|
+
/* @__PURE__ */ jsx263(
|
|
47923
48314
|
Button,
|
|
47924
48315
|
{
|
|
47925
48316
|
onClick: closeModal,
|
|
@@ -47931,7 +48322,7 @@ var CompletePurchaseModal = ({
|
|
|
47931
48322
|
children: "Cancel"
|
|
47932
48323
|
}
|
|
47933
48324
|
),
|
|
47934
|
-
/* @__PURE__ */
|
|
48325
|
+
/* @__PURE__ */ jsx263(
|
|
47935
48326
|
Button,
|
|
47936
48327
|
{
|
|
47937
48328
|
onClick: onSubmit,
|
|
@@ -47949,11 +48340,11 @@ var CompletePurchaseModal = ({
|
|
|
47949
48340
|
var Submit_default3 = CompletePurchaseModal;
|
|
47950
48341
|
|
|
47951
48342
|
// src/components/Transactions/3/purchase3/pos.tsx
|
|
47952
|
-
import { Fragment as
|
|
48343
|
+
import { Fragment as Fragment132, jsx as jsx264, jsxs as jsxs233 } from "react/jsx-runtime";
|
|
47953
48344
|
var Purchase3Form = ({ type }) => {
|
|
47954
48345
|
const { getQuery, navigate } = useApp_default();
|
|
47955
48346
|
const stockType = type;
|
|
47956
|
-
const { branchId } =
|
|
48347
|
+
const { branchId } = useParams105();
|
|
47957
48348
|
const purchaseId = getQuery("id");
|
|
47958
48349
|
const { currencies } = useWarqadConfig();
|
|
47959
48350
|
const { defaultCurrency } = currencies;
|
|
@@ -48095,7 +48486,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
48095
48486
|
type: "complete_purchase2",
|
|
48096
48487
|
title: "Complete purchase",
|
|
48097
48488
|
width: 650,
|
|
48098
|
-
content: /* @__PURE__ */
|
|
48489
|
+
content: /* @__PURE__ */ jsx264(
|
|
48099
48490
|
Submit_default3,
|
|
48100
48491
|
{
|
|
48101
48492
|
totalAmount,
|
|
@@ -48160,25 +48551,25 @@ var Purchase3Form = ({ type }) => {
|
|
|
48160
48551
|
fetchData();
|
|
48161
48552
|
}
|
|
48162
48553
|
}, [purchaseId]);
|
|
48163
|
-
return /* @__PURE__ */
|
|
48164
|
-
/* @__PURE__ */
|
|
48165
|
-
/* @__PURE__ */
|
|
48166
|
-
/* @__PURE__ */
|
|
48167
|
-
/* @__PURE__ */
|
|
48168
|
-
/* @__PURE__ */
|
|
48169
|
-
/* @__PURE__ */
|
|
48554
|
+
return /* @__PURE__ */ jsxs233(FormProvider6, { ...methods, children: [
|
|
48555
|
+
/* @__PURE__ */ jsx264(Modal2, {}),
|
|
48556
|
+
/* @__PURE__ */ jsx264("div", { className: "space-y-6 ", children: /* @__PURE__ */ jsx264("div", { className: "grid grid-cols-1 gap-6", children: /* @__PURE__ */ jsxs233(Card, { children: [
|
|
48557
|
+
/* @__PURE__ */ jsxs233(Card.Header, { children: [
|
|
48558
|
+
/* @__PURE__ */ jsxs233("div", { className: "flex justify-between gap-2 items-center", children: [
|
|
48559
|
+
/* @__PURE__ */ jsxs233("section", { children: [
|
|
48560
|
+
/* @__PURE__ */ jsxs233(Card.Title, { children: [
|
|
48170
48561
|
stockType,
|
|
48171
48562
|
" Stock purchase Table"
|
|
48172
48563
|
] }),
|
|
48173
|
-
/* @__PURE__ */
|
|
48564
|
+
/* @__PURE__ */ jsx264(Card.Description, { children: !purchaseId ? "Add items to the table and process the purchase" : "Edit items in the table and update the purchase" })
|
|
48174
48565
|
] }),
|
|
48175
|
-
/* @__PURE__ */
|
|
48566
|
+
/* @__PURE__ */ jsx264(
|
|
48176
48567
|
Button,
|
|
48177
48568
|
{
|
|
48178
48569
|
onClick: () => {
|
|
48179
48570
|
navigate(-1);
|
|
48180
48571
|
},
|
|
48181
|
-
icon: /* @__PURE__ */
|
|
48572
|
+
icon: /* @__PURE__ */ jsx264(ArrowLeft12, {}),
|
|
48182
48573
|
size: "sm",
|
|
48183
48574
|
type: "button",
|
|
48184
48575
|
variant: "warning",
|
|
@@ -48187,9 +48578,9 @@ var Purchase3Form = ({ type }) => {
|
|
|
48187
48578
|
}
|
|
48188
48579
|
)
|
|
48189
48580
|
] }),
|
|
48190
|
-
/* @__PURE__ */
|
|
48581
|
+
/* @__PURE__ */ jsx264(header_default6, { stockType })
|
|
48191
48582
|
] }),
|
|
48192
|
-
/* @__PURE__ */
|
|
48583
|
+
/* @__PURE__ */ jsx264(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx264(
|
|
48193
48584
|
table_default6,
|
|
48194
48585
|
{
|
|
48195
48586
|
data: postData,
|
|
@@ -48200,8 +48591,8 @@ var Purchase3Form = ({ type }) => {
|
|
|
48200
48591
|
adjustmentId: purchaseId
|
|
48201
48592
|
}
|
|
48202
48593
|
) }),
|
|
48203
|
-
/* @__PURE__ */
|
|
48204
|
-
!purchaseId ? /* @__PURE__ */
|
|
48594
|
+
/* @__PURE__ */ jsx264(Card.Footer, { className: "flex justify-end space-y-2", children: /* @__PURE__ */ jsxs233("div", { className: "flex items-center gap-3", children: [
|
|
48595
|
+
!purchaseId ? /* @__PURE__ */ jsx264(Fragment132, { children: storage.has(getStorageType6(stockType)) && postData?.length > 0 && /* @__PURE__ */ jsx264(
|
|
48205
48596
|
Popconfirm7,
|
|
48206
48597
|
{
|
|
48207
48598
|
title: "Are you sure you want to clear the draft?",
|
|
@@ -48210,7 +48601,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
48210
48601
|
storage.remove(getStorageType6(stockType));
|
|
48211
48602
|
setPostData([]);
|
|
48212
48603
|
},
|
|
48213
|
-
children: /* @__PURE__ */
|
|
48604
|
+
children: /* @__PURE__ */ jsx264(
|
|
48214
48605
|
Button,
|
|
48215
48606
|
{
|
|
48216
48607
|
size: "md",
|
|
@@ -48221,7 +48612,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
48221
48612
|
}
|
|
48222
48613
|
)
|
|
48223
48614
|
}
|
|
48224
|
-
) }) : /* @__PURE__ */
|
|
48615
|
+
) }) : /* @__PURE__ */ jsx264(
|
|
48225
48616
|
Button,
|
|
48226
48617
|
{
|
|
48227
48618
|
onClick: () => {
|
|
@@ -48235,7 +48626,7 @@ var Purchase3Form = ({ type }) => {
|
|
|
48235
48626
|
children: "Cancel"
|
|
48236
48627
|
}
|
|
48237
48628
|
),
|
|
48238
|
-
/* @__PURE__ */
|
|
48629
|
+
/* @__PURE__ */ jsx264(
|
|
48239
48630
|
Button,
|
|
48240
48631
|
{
|
|
48241
48632
|
onClick: handleSubmit(onMainFormSubmit, (e) => {
|
|
@@ -48273,12 +48664,12 @@ var purchase3 = {
|
|
|
48273
48664
|
var purchase3_default = purchase3;
|
|
48274
48665
|
|
|
48275
48666
|
// src/components/Transactions/3/expense/Expenses.tsx
|
|
48276
|
-
import { useNavigate as
|
|
48277
|
-
import { EllipsisVertical as
|
|
48278
|
-
import { Fragment as
|
|
48667
|
+
import { useNavigate as useNavigate64, useParams as useParams106 } from "react-router-dom";
|
|
48668
|
+
import { EllipsisVertical as EllipsisVertical47, FilePenLine as FilePenLine43, Trash2 as Trash253 } from "lucide-react";
|
|
48669
|
+
import { Fragment as Fragment133, jsx as jsx265, jsxs as jsxs234 } from "react/jsx-runtime";
|
|
48279
48670
|
function Expenses3({ url }) {
|
|
48280
|
-
const { branchId } =
|
|
48281
|
-
const navigate =
|
|
48671
|
+
const { branchId } = useParams106();
|
|
48672
|
+
const navigate = useNavigate64();
|
|
48282
48673
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48283
48674
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48284
48675
|
url: url || `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -48288,17 +48679,17 @@ function Expenses3({ url }) {
|
|
|
48288
48679
|
const items = (data2) => [
|
|
48289
48680
|
{
|
|
48290
48681
|
label: `View Expense`,
|
|
48291
|
-
icon: /* @__PURE__ */
|
|
48682
|
+
icon: /* @__PURE__ */ jsx265(FilePenLine43, { size: 16 }),
|
|
48292
48683
|
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48293
48684
|
},
|
|
48294
48685
|
{
|
|
48295
48686
|
label: `Edit Expense`,
|
|
48296
|
-
icon: /* @__PURE__ */
|
|
48687
|
+
icon: /* @__PURE__ */ jsx265(FilePenLine43, { size: 16 }),
|
|
48297
48688
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48298
48689
|
},
|
|
48299
48690
|
{
|
|
48300
48691
|
label: `Delete Expense`,
|
|
48301
|
-
icon: /* @__PURE__ */
|
|
48692
|
+
icon: /* @__PURE__ */ jsx265(Trash253, { className: "text-red-500", size: 16 }),
|
|
48302
48693
|
onClick: () => {
|
|
48303
48694
|
openTransaction({
|
|
48304
48695
|
id: data2?._id,
|
|
@@ -48314,9 +48705,9 @@ function Expenses3({ url }) {
|
|
|
48314
48705
|
header: "Date",
|
|
48315
48706
|
cell: ({ row }) => {
|
|
48316
48707
|
const expense = row.original;
|
|
48317
|
-
return /* @__PURE__ */
|
|
48318
|
-
/* @__PURE__ */
|
|
48319
|
-
/* @__PURE__ */
|
|
48708
|
+
return /* @__PURE__ */ jsxs234("div", { className: "flex flex-col", children: [
|
|
48709
|
+
/* @__PURE__ */ jsx265("span", { children: expense?.date }),
|
|
48710
|
+
/* @__PURE__ */ jsx265(
|
|
48320
48711
|
"span",
|
|
48321
48712
|
{
|
|
48322
48713
|
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
@@ -48332,9 +48723,9 @@ function Expenses3({ url }) {
|
|
|
48332
48723
|
header: "Description",
|
|
48333
48724
|
cell: ({ row }) => {
|
|
48334
48725
|
const expense = row.original;
|
|
48335
|
-
return /* @__PURE__ */
|
|
48336
|
-
/* @__PURE__ */
|
|
48337
|
-
expense?.note && /* @__PURE__ */
|
|
48726
|
+
return /* @__PURE__ */ jsxs234("div", { className: "flex flex-col", children: [
|
|
48727
|
+
/* @__PURE__ */ jsx265("span", { className: "capitalize", children: expense?.description }),
|
|
48728
|
+
expense?.note && /* @__PURE__ */ jsx265("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48338
48729
|
] });
|
|
48339
48730
|
}
|
|
48340
48731
|
},
|
|
@@ -48344,7 +48735,7 @@ function Expenses3({ url }) {
|
|
|
48344
48735
|
cell: ({ row }) => {
|
|
48345
48736
|
const expense = row.original;
|
|
48346
48737
|
const walletData = expense?.fromWalletData || expense?.toWalletData;
|
|
48347
|
-
return /* @__PURE__ */
|
|
48738
|
+
return /* @__PURE__ */ jsx265("span", { children: walletData?.name || "N/A" });
|
|
48348
48739
|
}
|
|
48349
48740
|
},
|
|
48350
48741
|
{
|
|
@@ -48352,7 +48743,7 @@ function Expenses3({ url }) {
|
|
|
48352
48743
|
header: "Amount",
|
|
48353
48744
|
cell: ({ row }) => {
|
|
48354
48745
|
const expense = row.original;
|
|
48355
|
-
return /* @__PURE__ */
|
|
48746
|
+
return /* @__PURE__ */ jsx265("div", { className: "", children: /* @__PURE__ */ jsx265("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }) });
|
|
48356
48747
|
}
|
|
48357
48748
|
},
|
|
48358
48749
|
{
|
|
@@ -48360,23 +48751,23 @@ function Expenses3({ url }) {
|
|
|
48360
48751
|
header: "Actions",
|
|
48361
48752
|
cell: ({ row }) => {
|
|
48362
48753
|
const data2 = row.original;
|
|
48363
|
-
return /* @__PURE__ */
|
|
48754
|
+
return /* @__PURE__ */ jsx265(
|
|
48364
48755
|
Dropdown,
|
|
48365
48756
|
{
|
|
48366
48757
|
className: "cursor-pointer w-[150px]",
|
|
48367
48758
|
items: items(data2),
|
|
48368
48759
|
triggerMode: "hover",
|
|
48369
|
-
children: /* @__PURE__ */
|
|
48760
|
+
children: /* @__PURE__ */ jsx265(EllipsisVertical47, {})
|
|
48370
48761
|
}
|
|
48371
48762
|
);
|
|
48372
48763
|
}
|
|
48373
48764
|
}
|
|
48374
48765
|
];
|
|
48375
48766
|
const expenses = data?.data || [];
|
|
48376
|
-
return /* @__PURE__ */
|
|
48377
|
-
/* @__PURE__ */
|
|
48378
|
-
/* @__PURE__ */
|
|
48379
|
-
/* @__PURE__ */
|
|
48767
|
+
return /* @__PURE__ */ jsxs234(Fragment133, { children: [
|
|
48768
|
+
/* @__PURE__ */ jsx265(TransactionView, {}),
|
|
48769
|
+
/* @__PURE__ */ jsx265(Modal2, {}),
|
|
48770
|
+
/* @__PURE__ */ jsx265(
|
|
48380
48771
|
TransactionViewComponent,
|
|
48381
48772
|
{
|
|
48382
48773
|
columns,
|
|
@@ -48395,8 +48786,8 @@ function Expenses3({ url }) {
|
|
|
48395
48786
|
var Expenses_default2 = Expenses3;
|
|
48396
48787
|
|
|
48397
48788
|
// src/components/Transactions/3/expense/ExpenseForm.tsx
|
|
48398
|
-
import { useEffect as useEffect113, useMemo as
|
|
48399
|
-
import { useParams as
|
|
48789
|
+
import { useEffect as useEffect113, useMemo as useMemo52, useState as useState112 } from "react";
|
|
48790
|
+
import { useParams as useParams107 } from "react-router-dom";
|
|
48400
48791
|
import { useForm as useForm57 } from "react-hook-form";
|
|
48401
48792
|
import { zodResolver as zodResolver56 } from "@hookform/resolvers/zod";
|
|
48402
48793
|
import { message as message84 } from "antd";
|
|
@@ -48416,9 +48807,9 @@ var expenseSchema4 = z48.object({
|
|
|
48416
48807
|
});
|
|
48417
48808
|
|
|
48418
48809
|
// src/components/Transactions/3/expense/ExpenseForm.tsx
|
|
48419
|
-
import { Fragment as
|
|
48810
|
+
import { Fragment as Fragment134, jsx as jsx266, jsxs as jsxs235 } from "react/jsx-runtime";
|
|
48420
48811
|
function ExpenseForm2() {
|
|
48421
|
-
const { branchId } =
|
|
48812
|
+
const { branchId } = useParams107();
|
|
48422
48813
|
const { getQuery, navigate } = useApp_default();
|
|
48423
48814
|
const id = getQuery("id");
|
|
48424
48815
|
const isEdit = !!id;
|
|
@@ -48443,7 +48834,7 @@ function ExpenseForm2() {
|
|
|
48443
48834
|
const isRate = currency && currency !== defaultCurrency;
|
|
48444
48835
|
const amount = watch("amount");
|
|
48445
48836
|
const rate = watch("rate");
|
|
48446
|
-
const exchangedAmount2 =
|
|
48837
|
+
const exchangedAmount2 = useMemo52(() => {
|
|
48447
48838
|
if (isRate) {
|
|
48448
48839
|
const am = forex_default.exchangedAmount({
|
|
48449
48840
|
accountCurrency: defaultCurrency,
|
|
@@ -48496,25 +48887,25 @@ function ExpenseForm2() {
|
|
|
48496
48887
|
fetches();
|
|
48497
48888
|
}
|
|
48498
48889
|
}, [id]);
|
|
48499
|
-
return /* @__PURE__ */
|
|
48890
|
+
return /* @__PURE__ */ jsxs235(
|
|
48500
48891
|
Card,
|
|
48501
48892
|
{
|
|
48502
48893
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
48503
48894
|
isLoading: isLoadingGet,
|
|
48504
48895
|
loadingText: "Processing...",
|
|
48505
48896
|
children: [
|
|
48506
|
-
/* @__PURE__ */
|
|
48507
|
-
/* @__PURE__ */
|
|
48508
|
-
/* @__PURE__ */
|
|
48897
|
+
/* @__PURE__ */ jsxs235(Card.Header, { children: [
|
|
48898
|
+
/* @__PURE__ */ jsx266(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
48899
|
+
/* @__PURE__ */ jsx266(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
48509
48900
|
] }),
|
|
48510
|
-
/* @__PURE__ */
|
|
48901
|
+
/* @__PURE__ */ jsx266(Card.Content, { children: /* @__PURE__ */ jsxs235(
|
|
48511
48902
|
"form",
|
|
48512
48903
|
{
|
|
48513
48904
|
className: "space-y-4",
|
|
48514
48905
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
48515
48906
|
children: [
|
|
48516
|
-
/* @__PURE__ */
|
|
48517
|
-
/* @__PURE__ */
|
|
48907
|
+
/* @__PURE__ */ jsxs235("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48908
|
+
/* @__PURE__ */ jsx266(
|
|
48518
48909
|
Fields_default.Input,
|
|
48519
48910
|
{
|
|
48520
48911
|
label: "Description",
|
|
@@ -48524,7 +48915,7 @@ function ExpenseForm2() {
|
|
|
48524
48915
|
required: true
|
|
48525
48916
|
}
|
|
48526
48917
|
),
|
|
48527
|
-
/* @__PURE__ */
|
|
48918
|
+
/* @__PURE__ */ jsx266(
|
|
48528
48919
|
Feilds_default2.Wallet,
|
|
48529
48920
|
{
|
|
48530
48921
|
label: "Wallet",
|
|
@@ -48537,8 +48928,8 @@ function ExpenseForm2() {
|
|
|
48537
48928
|
}
|
|
48538
48929
|
)
|
|
48539
48930
|
] }),
|
|
48540
|
-
/* @__PURE__ */
|
|
48541
|
-
/* @__PURE__ */
|
|
48931
|
+
/* @__PURE__ */ jsxs235("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48932
|
+
/* @__PURE__ */ jsx266(
|
|
48542
48933
|
Fields_default.DateInput,
|
|
48543
48934
|
{
|
|
48544
48935
|
label: "Date",
|
|
@@ -48547,7 +48938,7 @@ function ExpenseForm2() {
|
|
|
48547
48938
|
required: true
|
|
48548
48939
|
}
|
|
48549
48940
|
),
|
|
48550
|
-
/* @__PURE__ */
|
|
48941
|
+
/* @__PURE__ */ jsx266(
|
|
48551
48942
|
Fields_default.Input,
|
|
48552
48943
|
{
|
|
48553
48944
|
label: "Amount",
|
|
@@ -48558,8 +48949,8 @@ function ExpenseForm2() {
|
|
|
48558
48949
|
required: true
|
|
48559
48950
|
}
|
|
48560
48951
|
),
|
|
48561
|
-
isRate && /* @__PURE__ */
|
|
48562
|
-
/* @__PURE__ */
|
|
48952
|
+
isRate && /* @__PURE__ */ jsxs235(Fragment134, { children: [
|
|
48953
|
+
/* @__PURE__ */ jsx266(
|
|
48563
48954
|
Fields_default.Input,
|
|
48564
48955
|
{
|
|
48565
48956
|
label: "Rate",
|
|
@@ -48570,7 +48961,7 @@ function ExpenseForm2() {
|
|
|
48570
48961
|
required: true
|
|
48571
48962
|
}
|
|
48572
48963
|
),
|
|
48573
|
-
/* @__PURE__ */
|
|
48964
|
+
/* @__PURE__ */ jsx266(
|
|
48574
48965
|
Fields_default.Input,
|
|
48575
48966
|
{
|
|
48576
48967
|
label: "Exchanged Amount",
|
|
@@ -48582,7 +48973,7 @@ function ExpenseForm2() {
|
|
|
48582
48973
|
)
|
|
48583
48974
|
] })
|
|
48584
48975
|
] }),
|
|
48585
|
-
/* @__PURE__ */
|
|
48976
|
+
/* @__PURE__ */ jsx266(
|
|
48586
48977
|
Fields_default.Textarea,
|
|
48587
48978
|
{
|
|
48588
48979
|
label: "Note",
|
|
@@ -48591,7 +48982,7 @@ function ExpenseForm2() {
|
|
|
48591
48982
|
placeholder: "Add any additional details..."
|
|
48592
48983
|
}
|
|
48593
48984
|
),
|
|
48594
|
-
/* @__PURE__ */
|
|
48985
|
+
/* @__PURE__ */ jsx266("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx266(
|
|
48595
48986
|
Button,
|
|
48596
48987
|
{
|
|
48597
48988
|
isLoading,
|
|
@@ -48619,13 +49010,13 @@ var Expenses32 = {
|
|
|
48619
49010
|
var expense_default = Expenses32;
|
|
48620
49011
|
|
|
48621
49012
|
// src/components/Transactions/3/reports/Expenses3Reports.tsx
|
|
48622
|
-
import { useParams as
|
|
48623
|
-
import { useMemo as
|
|
49013
|
+
import { useParams as useParams108 } from "react-router-dom";
|
|
49014
|
+
import { useMemo as useMemo53, useState as useState113 } from "react";
|
|
48624
49015
|
import { DatePicker as DatePicker9 } from "antd";
|
|
48625
49016
|
import dayjs11 from "dayjs";
|
|
48626
|
-
import { Fragment as
|
|
49017
|
+
import { Fragment as Fragment135, jsx as jsx267, jsxs as jsxs236 } from "react/jsx-runtime";
|
|
48627
49018
|
var Expenses3Reports = () => {
|
|
48628
|
-
const { branchId } =
|
|
49019
|
+
const { branchId } = useParams108();
|
|
48629
49020
|
const [startDate, setStartDate] = useState113(null);
|
|
48630
49021
|
const [endDate, setEndDate] = useState113(null);
|
|
48631
49022
|
const { A4DataView, data } = useA4DataView_default({
|
|
@@ -48640,9 +49031,9 @@ var Expenses3Reports = () => {
|
|
|
48640
49031
|
header: "Date",
|
|
48641
49032
|
key: "date",
|
|
48642
49033
|
className: "text-xs whitespace-nowrap",
|
|
48643
|
-
render: (row) => /* @__PURE__ */
|
|
48644
|
-
/* @__PURE__ */
|
|
48645
|
-
/* @__PURE__ */
|
|
49034
|
+
render: (row) => /* @__PURE__ */ jsxs236("div", { className: "", children: [
|
|
49035
|
+
/* @__PURE__ */ jsx267("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49036
|
+
/* @__PURE__ */ jsx267(
|
|
48646
49037
|
"span",
|
|
48647
49038
|
{
|
|
48648
49039
|
onClick: () => {
|
|
@@ -48662,9 +49053,9 @@ var Expenses3Reports = () => {
|
|
|
48662
49053
|
key: "description",
|
|
48663
49054
|
className: "text-xs whitespace-nowrap ",
|
|
48664
49055
|
render: (row) => {
|
|
48665
|
-
return /* @__PURE__ */
|
|
48666
|
-
/* @__PURE__ */
|
|
48667
|
-
row.note && /* @__PURE__ */
|
|
49056
|
+
return /* @__PURE__ */ jsxs236("div", { className: "", children: [
|
|
49057
|
+
/* @__PURE__ */ jsx267("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
49058
|
+
row.note && /* @__PURE__ */ jsx267("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48668
49059
|
] });
|
|
48669
49060
|
}
|
|
48670
49061
|
},
|
|
@@ -48672,16 +49063,16 @@ var Expenses3Reports = () => {
|
|
|
48672
49063
|
header: "Amount",
|
|
48673
49064
|
key: "changedAmountString",
|
|
48674
49065
|
className: "text-xs whitespace-nowrap text-right",
|
|
48675
|
-
render: (row) => /* @__PURE__ */
|
|
49066
|
+
render: (row) => /* @__PURE__ */ jsx267("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48676
49067
|
renderFooter: (data2) => {
|
|
48677
|
-
return /* @__PURE__ */
|
|
49068
|
+
return /* @__PURE__ */ jsx267("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48678
49069
|
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48679
49070
|
defaultCurrency
|
|
48680
49071
|
) });
|
|
48681
49072
|
}
|
|
48682
49073
|
}
|
|
48683
49074
|
];
|
|
48684
|
-
const datas =
|
|
49075
|
+
const datas = useMemo53(() => {
|
|
48685
49076
|
let runningBalance = 0;
|
|
48686
49077
|
let filteredData = data?.data || [];
|
|
48687
49078
|
const mapped = filteredData.map((item) => {
|
|
@@ -48715,9 +49106,9 @@ var Expenses3Reports = () => {
|
|
|
48715
49106
|
}
|
|
48716
49107
|
return filtered;
|
|
48717
49108
|
}, [data, startDate, endDate]);
|
|
48718
|
-
return /* @__PURE__ */
|
|
48719
|
-
/* @__PURE__ */
|
|
48720
|
-
/* @__PURE__ */
|
|
49109
|
+
return /* @__PURE__ */ jsxs236(Fragment135, { children: [
|
|
49110
|
+
/* @__PURE__ */ jsx267(TransactionView, {}),
|
|
49111
|
+
/* @__PURE__ */ jsx267(
|
|
48721
49112
|
A4DataView,
|
|
48722
49113
|
{
|
|
48723
49114
|
columns,
|
|
@@ -48726,8 +49117,8 @@ var Expenses3Reports = () => {
|
|
|
48726
49117
|
title: `Expenses Report`,
|
|
48727
49118
|
subtitle: `All Expenses`,
|
|
48728
49119
|
fixed: false,
|
|
48729
|
-
headers: /* @__PURE__ */
|
|
48730
|
-
/* @__PURE__ */
|
|
49120
|
+
headers: /* @__PURE__ */ jsxs236("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
49121
|
+
/* @__PURE__ */ jsx267(
|
|
48731
49122
|
DatePicker9,
|
|
48732
49123
|
{
|
|
48733
49124
|
placeholder: "Start Date",
|
|
@@ -48737,7 +49128,7 @@ var Expenses3Reports = () => {
|
|
|
48737
49128
|
className: "min-w-[140px] max-w-[160px]"
|
|
48738
49129
|
}
|
|
48739
49130
|
),
|
|
48740
|
-
/* @__PURE__ */
|
|
49131
|
+
/* @__PURE__ */ jsx267(
|
|
48741
49132
|
DatePicker9,
|
|
48742
49133
|
{
|
|
48743
49134
|
placeholder: "End Date",
|
|
@@ -48755,13 +49146,13 @@ var Expenses3Reports = () => {
|
|
|
48755
49146
|
var Expenses3Reports_default = Expenses3Reports;
|
|
48756
49147
|
|
|
48757
49148
|
// src/components/Transactions/3/reports/ExpensesJournal3.tsx
|
|
48758
|
-
import { useParams as
|
|
48759
|
-
import { useMemo as
|
|
49149
|
+
import { useParams as useParams109 } from "react-router-dom";
|
|
49150
|
+
import { useMemo as useMemo54, useState as useState114 } from "react";
|
|
48760
49151
|
import { DatePicker as DatePicker10 } from "antd";
|
|
48761
49152
|
import dayjs12 from "dayjs";
|
|
48762
|
-
import { Fragment as
|
|
49153
|
+
import { Fragment as Fragment136, jsx as jsx268, jsxs as jsxs237 } from "react/jsx-runtime";
|
|
48763
49154
|
var Expenses3Reports2 = () => {
|
|
48764
|
-
const { branchId } =
|
|
49155
|
+
const { branchId } = useParams109();
|
|
48765
49156
|
const [startDate, setStartDate] = useState114(null);
|
|
48766
49157
|
const [endDate, setEndDate] = useState114(null);
|
|
48767
49158
|
const { A4DataView, data } = useA4DataView_default({
|
|
@@ -48776,9 +49167,9 @@ var Expenses3Reports2 = () => {
|
|
|
48776
49167
|
header: "Date",
|
|
48777
49168
|
key: "date",
|
|
48778
49169
|
className: "text-xs whitespace-nowrap",
|
|
48779
|
-
render: (row) => /* @__PURE__ */
|
|
48780
|
-
/* @__PURE__ */
|
|
48781
|
-
/* @__PURE__ */
|
|
49170
|
+
render: (row) => /* @__PURE__ */ jsxs237("div", { className: "", children: [
|
|
49171
|
+
/* @__PURE__ */ jsx268("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49172
|
+
/* @__PURE__ */ jsx268(
|
|
48782
49173
|
"span",
|
|
48783
49174
|
{
|
|
48784
49175
|
onClick: () => {
|
|
@@ -48798,9 +49189,9 @@ var Expenses3Reports2 = () => {
|
|
|
48798
49189
|
key: "description",
|
|
48799
49190
|
className: "text-xs whitespace-nowrap ",
|
|
48800
49191
|
render: (row) => {
|
|
48801
|
-
return /* @__PURE__ */
|
|
48802
|
-
/* @__PURE__ */
|
|
48803
|
-
row.note && /* @__PURE__ */
|
|
49192
|
+
return /* @__PURE__ */ jsxs237("div", { className: "", children: [
|
|
49193
|
+
/* @__PURE__ */ jsx268("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
49194
|
+
row.note && /* @__PURE__ */ jsx268("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48804
49195
|
] });
|
|
48805
49196
|
}
|
|
48806
49197
|
},
|
|
@@ -48808,16 +49199,16 @@ var Expenses3Reports2 = () => {
|
|
|
48808
49199
|
header: "Amount",
|
|
48809
49200
|
key: "changedAmountString",
|
|
48810
49201
|
className: "text-xs whitespace-nowrap text-right",
|
|
48811
|
-
render: (row) => /* @__PURE__ */
|
|
49202
|
+
render: (row) => /* @__PURE__ */ jsx268("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48812
49203
|
renderFooter: (data2) => {
|
|
48813
|
-
return /* @__PURE__ */
|
|
49204
|
+
return /* @__PURE__ */ jsx268("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48814
49205
|
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48815
49206
|
defaultCurrency
|
|
48816
49207
|
) });
|
|
48817
49208
|
}
|
|
48818
49209
|
}
|
|
48819
49210
|
];
|
|
48820
|
-
const datas =
|
|
49211
|
+
const datas = useMemo54(() => {
|
|
48821
49212
|
let runningBalance = 0;
|
|
48822
49213
|
let filteredData = data?.data || [];
|
|
48823
49214
|
const mapped = filteredData.map((item) => {
|
|
@@ -48851,9 +49242,9 @@ var Expenses3Reports2 = () => {
|
|
|
48851
49242
|
}
|
|
48852
49243
|
return filtered;
|
|
48853
49244
|
}, [data, startDate, endDate]);
|
|
48854
|
-
return /* @__PURE__ */
|
|
48855
|
-
/* @__PURE__ */
|
|
48856
|
-
/* @__PURE__ */
|
|
49245
|
+
return /* @__PURE__ */ jsxs237(Fragment136, { children: [
|
|
49246
|
+
/* @__PURE__ */ jsx268(TransactionView, {}),
|
|
49247
|
+
/* @__PURE__ */ jsx268(
|
|
48857
49248
|
A4DataView,
|
|
48858
49249
|
{
|
|
48859
49250
|
columns,
|
|
@@ -48862,8 +49253,8 @@ var Expenses3Reports2 = () => {
|
|
|
48862
49253
|
title: `Expenses Journal Report`,
|
|
48863
49254
|
subtitle: `All Expenses`,
|
|
48864
49255
|
fixed: false,
|
|
48865
|
-
headers: /* @__PURE__ */
|
|
48866
|
-
/* @__PURE__ */
|
|
49256
|
+
headers: /* @__PURE__ */ jsxs237("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
49257
|
+
/* @__PURE__ */ jsx268(
|
|
48867
49258
|
DatePicker10,
|
|
48868
49259
|
{
|
|
48869
49260
|
placeholder: "Start Date",
|
|
@@ -48873,7 +49264,7 @@ var Expenses3Reports2 = () => {
|
|
|
48873
49264
|
className: "min-w-[140px] max-w-[160px]"
|
|
48874
49265
|
}
|
|
48875
49266
|
),
|
|
48876
|
-
/* @__PURE__ */
|
|
49267
|
+
/* @__PURE__ */ jsx268(
|
|
48877
49268
|
DatePicker10,
|
|
48878
49269
|
{
|
|
48879
49270
|
placeholder: "End Date",
|
|
@@ -48898,12 +49289,12 @@ var Reports3 = {
|
|
|
48898
49289
|
var reports_default = Reports3;
|
|
48899
49290
|
|
|
48900
49291
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48901
|
-
import { useNavigate as
|
|
48902
|
-
import { EllipsisVertical as
|
|
48903
|
-
import { Fragment as
|
|
49292
|
+
import { useNavigate as useNavigate65, useParams as useParams110 } from "react-router-dom";
|
|
49293
|
+
import { EllipsisVertical as EllipsisVertical48, FilePenLine as FilePenLine44, Trash2 as Trash254 } from "lucide-react";
|
|
49294
|
+
import { Fragment as Fragment137, jsx as jsx269, jsxs as jsxs238 } from "react/jsx-runtime";
|
|
48904
49295
|
function ExpensesJournal3({ url }) {
|
|
48905
|
-
const { branchId } =
|
|
48906
|
-
const navigate =
|
|
49296
|
+
const { branchId } = useParams110();
|
|
49297
|
+
const navigate = useNavigate65();
|
|
48907
49298
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48908
49299
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48909
49300
|
url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -48913,17 +49304,17 @@ function ExpensesJournal3({ url }) {
|
|
|
48913
49304
|
const items = (data2) => [
|
|
48914
49305
|
{
|
|
48915
49306
|
label: `View Expense`,
|
|
48916
|
-
icon: /* @__PURE__ */
|
|
49307
|
+
icon: /* @__PURE__ */ jsx269(FilePenLine44, { size: 16 }),
|
|
48917
49308
|
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48918
49309
|
},
|
|
48919
49310
|
{
|
|
48920
49311
|
label: `Edit Expense`,
|
|
48921
|
-
icon: /* @__PURE__ */
|
|
49312
|
+
icon: /* @__PURE__ */ jsx269(FilePenLine44, { size: 16 }),
|
|
48922
49313
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48923
49314
|
},
|
|
48924
49315
|
{
|
|
48925
49316
|
label: `Delete Expense`,
|
|
48926
|
-
icon: /* @__PURE__ */
|
|
49317
|
+
icon: /* @__PURE__ */ jsx269(Trash254, { className: "text-red-500", size: 16 }),
|
|
48927
49318
|
onClick: () => {
|
|
48928
49319
|
openTransaction({
|
|
48929
49320
|
id: data2?._id,
|
|
@@ -48939,9 +49330,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48939
49330
|
header: "Date",
|
|
48940
49331
|
cell: ({ row }) => {
|
|
48941
49332
|
const expense = row.original;
|
|
48942
|
-
return /* @__PURE__ */
|
|
48943
|
-
/* @__PURE__ */
|
|
48944
|
-
/* @__PURE__ */
|
|
49333
|
+
return /* @__PURE__ */ jsxs238("div", { className: "flex flex-col", children: [
|
|
49334
|
+
/* @__PURE__ */ jsx269("span", { children: expense?.date }),
|
|
49335
|
+
/* @__PURE__ */ jsx269(
|
|
48945
49336
|
"span",
|
|
48946
49337
|
{
|
|
48947
49338
|
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
@@ -48957,9 +49348,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48957
49348
|
header: "Description",
|
|
48958
49349
|
cell: ({ row }) => {
|
|
48959
49350
|
const expense = row.original;
|
|
48960
|
-
return /* @__PURE__ */
|
|
48961
|
-
/* @__PURE__ */
|
|
48962
|
-
expense?.note && /* @__PURE__ */
|
|
49351
|
+
return /* @__PURE__ */ jsxs238("div", { className: "flex flex-col", children: [
|
|
49352
|
+
/* @__PURE__ */ jsx269("span", { className: "capitalize", children: expense?.description }),
|
|
49353
|
+
expense?.note && /* @__PURE__ */ jsx269("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48963
49354
|
] });
|
|
48964
49355
|
}
|
|
48965
49356
|
},
|
|
@@ -48968,9 +49359,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48968
49359
|
header: "Amount",
|
|
48969
49360
|
cell: ({ row }) => {
|
|
48970
49361
|
const expense = row.original;
|
|
48971
|
-
return /* @__PURE__ */
|
|
48972
|
-
/* @__PURE__ */
|
|
48973
|
-
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */
|
|
49362
|
+
return /* @__PURE__ */ jsxs238("div", { className: "", children: [
|
|
49363
|
+
/* @__PURE__ */ jsx269("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
49364
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ jsxs238("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48974
49365
|
"rate ",
|
|
48975
49366
|
expense?.exchange?.rate,
|
|
48976
49367
|
" ,",
|
|
@@ -48988,23 +49379,23 @@ function ExpensesJournal3({ url }) {
|
|
|
48988
49379
|
header: "Actions",
|
|
48989
49380
|
cell: ({ row }) => {
|
|
48990
49381
|
const data2 = row.original;
|
|
48991
|
-
return /* @__PURE__ */
|
|
49382
|
+
return /* @__PURE__ */ jsx269(
|
|
48992
49383
|
Dropdown,
|
|
48993
49384
|
{
|
|
48994
49385
|
className: "cursor-pointer w-[150px]",
|
|
48995
49386
|
items: items(data2),
|
|
48996
49387
|
triggerMode: "hover",
|
|
48997
|
-
children: /* @__PURE__ */
|
|
49388
|
+
children: /* @__PURE__ */ jsx269(EllipsisVertical48, {})
|
|
48998
49389
|
}
|
|
48999
49390
|
);
|
|
49000
49391
|
}
|
|
49001
49392
|
}
|
|
49002
49393
|
];
|
|
49003
49394
|
const expenses = data?.data || [];
|
|
49004
|
-
return /* @__PURE__ */
|
|
49005
|
-
/* @__PURE__ */
|
|
49006
|
-
/* @__PURE__ */
|
|
49007
|
-
/* @__PURE__ */
|
|
49395
|
+
return /* @__PURE__ */ jsxs238(Fragment137, { children: [
|
|
49396
|
+
/* @__PURE__ */ jsx269(TransactionView, {}),
|
|
49397
|
+
/* @__PURE__ */ jsx269(Modal2, {}),
|
|
49398
|
+
/* @__PURE__ */ jsx269(
|
|
49008
49399
|
TransactionViewComponent,
|
|
49009
49400
|
{
|
|
49010
49401
|
columns,
|
|
@@ -49023,8 +49414,8 @@ function ExpensesJournal3({ url }) {
|
|
|
49023
49414
|
var ExpensesJournal_default = ExpensesJournal3;
|
|
49024
49415
|
|
|
49025
49416
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
49026
|
-
import { useEffect as useEffect114, useMemo as
|
|
49027
|
-
import { useParams as
|
|
49417
|
+
import { useEffect as useEffect114, useMemo as useMemo55, useState as useState115 } from "react";
|
|
49418
|
+
import { useParams as useParams111 } from "react-router-dom";
|
|
49028
49419
|
import { useForm as useForm58 } from "react-hook-form";
|
|
49029
49420
|
import { zodResolver as zodResolver57 } from "@hookform/resolvers/zod";
|
|
49030
49421
|
import { message as message85 } from "antd";
|
|
@@ -49042,9 +49433,9 @@ var expenseSchema5 = z49.object({
|
|
|
49042
49433
|
});
|
|
49043
49434
|
|
|
49044
49435
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
49045
|
-
import { Fragment as
|
|
49436
|
+
import { Fragment as Fragment138, jsx as jsx270, jsxs as jsxs239 } from "react/jsx-runtime";
|
|
49046
49437
|
function ExpensesJournal3Form() {
|
|
49047
|
-
const { branchId } =
|
|
49438
|
+
const { branchId } = useParams111();
|
|
49048
49439
|
const { getQuery, navigate } = useApp_default();
|
|
49049
49440
|
const id = getQuery("id");
|
|
49050
49441
|
const isEdit = !!id;
|
|
@@ -49067,7 +49458,7 @@ function ExpensesJournal3Form() {
|
|
|
49067
49458
|
const isRate = currency && currency !== defaultCurrency;
|
|
49068
49459
|
const amount = watch("amount");
|
|
49069
49460
|
const rate = watch("rate");
|
|
49070
|
-
const exchangedAmount2 =
|
|
49461
|
+
const exchangedAmount2 = useMemo55(() => {
|
|
49071
49462
|
if (isRate) {
|
|
49072
49463
|
const am = forex_default.exchangedAmount({
|
|
49073
49464
|
accountCurrency: defaultCurrency,
|
|
@@ -49118,25 +49509,25 @@ function ExpensesJournal3Form() {
|
|
|
49118
49509
|
fetches();
|
|
49119
49510
|
}
|
|
49120
49511
|
}, [id]);
|
|
49121
|
-
return /* @__PURE__ */
|
|
49512
|
+
return /* @__PURE__ */ jsxs239(
|
|
49122
49513
|
Card,
|
|
49123
49514
|
{
|
|
49124
49515
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49125
49516
|
isLoading: isLoadingGet,
|
|
49126
49517
|
loadingText: "Processing...",
|
|
49127
49518
|
children: [
|
|
49128
|
-
/* @__PURE__ */
|
|
49129
|
-
/* @__PURE__ */
|
|
49130
|
-
/* @__PURE__ */
|
|
49519
|
+
/* @__PURE__ */ jsxs239(Card.Header, { children: [
|
|
49520
|
+
/* @__PURE__ */ jsx270(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
49521
|
+
/* @__PURE__ */ jsx270(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
49131
49522
|
] }),
|
|
49132
|
-
/* @__PURE__ */
|
|
49523
|
+
/* @__PURE__ */ jsx270(Card.Content, { children: /* @__PURE__ */ jsxs239(
|
|
49133
49524
|
"form",
|
|
49134
49525
|
{
|
|
49135
49526
|
className: "space-y-4",
|
|
49136
49527
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49137
49528
|
children: [
|
|
49138
|
-
/* @__PURE__ */
|
|
49139
|
-
/* @__PURE__ */
|
|
49529
|
+
/* @__PURE__ */ jsxs239("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49530
|
+
/* @__PURE__ */ jsx270(
|
|
49140
49531
|
Fields_default.Input,
|
|
49141
49532
|
{
|
|
49142
49533
|
label: "Description",
|
|
@@ -49146,7 +49537,7 @@ function ExpensesJournal3Form() {
|
|
|
49146
49537
|
required: true
|
|
49147
49538
|
}
|
|
49148
49539
|
),
|
|
49149
|
-
/* @__PURE__ */
|
|
49540
|
+
/* @__PURE__ */ jsx270(
|
|
49150
49541
|
Fields_default.Select,
|
|
49151
49542
|
{
|
|
49152
49543
|
label: "Currency",
|
|
@@ -49157,8 +49548,8 @@ function ExpensesJournal3Form() {
|
|
|
49157
49548
|
}
|
|
49158
49549
|
)
|
|
49159
49550
|
] }),
|
|
49160
|
-
/* @__PURE__ */
|
|
49161
|
-
/* @__PURE__ */
|
|
49551
|
+
/* @__PURE__ */ jsxs239("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49552
|
+
/* @__PURE__ */ jsx270(
|
|
49162
49553
|
Fields_default.DateInput,
|
|
49163
49554
|
{
|
|
49164
49555
|
label: "Date",
|
|
@@ -49167,7 +49558,7 @@ function ExpensesJournal3Form() {
|
|
|
49167
49558
|
required: true
|
|
49168
49559
|
}
|
|
49169
49560
|
),
|
|
49170
|
-
/* @__PURE__ */
|
|
49561
|
+
/* @__PURE__ */ jsx270(
|
|
49171
49562
|
Fields_default.Input,
|
|
49172
49563
|
{
|
|
49173
49564
|
label: "Amount",
|
|
@@ -49178,8 +49569,8 @@ function ExpensesJournal3Form() {
|
|
|
49178
49569
|
required: true
|
|
49179
49570
|
}
|
|
49180
49571
|
),
|
|
49181
|
-
isRate && /* @__PURE__ */
|
|
49182
|
-
/* @__PURE__ */
|
|
49572
|
+
isRate && /* @__PURE__ */ jsxs239(Fragment138, { children: [
|
|
49573
|
+
/* @__PURE__ */ jsx270(
|
|
49183
49574
|
Fields_default.Input,
|
|
49184
49575
|
{
|
|
49185
49576
|
label: "Rate",
|
|
@@ -49190,7 +49581,7 @@ function ExpensesJournal3Form() {
|
|
|
49190
49581
|
required: true
|
|
49191
49582
|
}
|
|
49192
49583
|
),
|
|
49193
|
-
/* @__PURE__ */
|
|
49584
|
+
/* @__PURE__ */ jsx270(
|
|
49194
49585
|
Fields_default.Input,
|
|
49195
49586
|
{
|
|
49196
49587
|
label: "Exchanged Amount",
|
|
@@ -49202,7 +49593,7 @@ function ExpensesJournal3Form() {
|
|
|
49202
49593
|
)
|
|
49203
49594
|
] })
|
|
49204
49595
|
] }),
|
|
49205
|
-
/* @__PURE__ */
|
|
49596
|
+
/* @__PURE__ */ jsx270(
|
|
49206
49597
|
Fields_default.Textarea,
|
|
49207
49598
|
{
|
|
49208
49599
|
label: "Note",
|
|
@@ -49211,7 +49602,7 @@ function ExpensesJournal3Form() {
|
|
|
49211
49602
|
placeholder: "Add any additional details..."
|
|
49212
49603
|
}
|
|
49213
49604
|
),
|
|
49214
|
-
/* @__PURE__ */
|
|
49605
|
+
/* @__PURE__ */ jsx270("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx270(
|
|
49215
49606
|
Button,
|
|
49216
49607
|
{
|
|
49217
49608
|
isLoading,
|
|
@@ -49246,29 +49637,31 @@ var Transaction3 = {
|
|
|
49246
49637
|
JournalsForm: JournalsForm_default,
|
|
49247
49638
|
Sale2: sale2_default2.List,
|
|
49248
49639
|
Sale2Form: sale2_default2.Form,
|
|
49640
|
+
Collection: sale2_default2.Collection,
|
|
49249
49641
|
Purchase3: purchase3_default.List,
|
|
49250
49642
|
Purchase3Form: purchase3_default.Form,
|
|
49251
49643
|
Expenses: expense_default.List,
|
|
49252
49644
|
ExpenseForm: expense_default.Form,
|
|
49253
49645
|
Reports: reports_default,
|
|
49254
|
-
ExpensesJournal3: expenseJournal_default
|
|
49646
|
+
ExpensesJournal3: expenseJournal_default,
|
|
49647
|
+
CollectionLevel: sale2_default2.CollectionLevel
|
|
49255
49648
|
};
|
|
49256
49649
|
var __default = Transaction3;
|
|
49257
49650
|
|
|
49258
49651
|
// src/components/reports/ItemReport.tsx
|
|
49259
|
-
import { useParams as
|
|
49652
|
+
import { useParams as useParams112 } from "react-router-dom";
|
|
49260
49653
|
import { z as z50 } from "zod";
|
|
49261
49654
|
import { useForm as useForm59 } from "react-hook-form";
|
|
49262
49655
|
import { zodResolver as zodResolver58 } from "@hookform/resolvers/zod";
|
|
49263
49656
|
import { useState as useState116 } from "react";
|
|
49264
49657
|
import { message as message86 } from "antd";
|
|
49265
|
-
import { Fragment as
|
|
49658
|
+
import { Fragment as Fragment139, jsx as jsx271, jsxs as jsxs240 } from "react/jsx-runtime";
|
|
49266
49659
|
var ItemReport = ({
|
|
49267
49660
|
value = false,
|
|
49268
49661
|
type
|
|
49269
49662
|
}) => {
|
|
49270
49663
|
const { apiConfig } = useWarqadConfig();
|
|
49271
|
-
const { branchId } =
|
|
49664
|
+
const { branchId } = useParams112();
|
|
49272
49665
|
const { branches } = useAuth_default();
|
|
49273
49666
|
const [params, setParams] = useState116({
|
|
49274
49667
|
id: "",
|
|
@@ -49295,9 +49688,9 @@ var ItemReport = ({
|
|
|
49295
49688
|
header: "Date",
|
|
49296
49689
|
key: "date",
|
|
49297
49690
|
className: "text-xs whitespace-nowrap",
|
|
49298
|
-
render: (row) => /* @__PURE__ */
|
|
49299
|
-
/* @__PURE__ */
|
|
49300
|
-
/* @__PURE__ */
|
|
49691
|
+
render: (row) => /* @__PURE__ */ jsxs240("div", { className: "", children: [
|
|
49692
|
+
/* @__PURE__ */ jsx271("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49693
|
+
/* @__PURE__ */ jsx271(
|
|
49301
49694
|
"span",
|
|
49302
49695
|
{
|
|
49303
49696
|
onClick: () => {
|
|
@@ -49316,7 +49709,7 @@ var ItemReport = ({
|
|
|
49316
49709
|
header: "Description",
|
|
49317
49710
|
key: "description",
|
|
49318
49711
|
className: "text-xs whitespace-nowrap",
|
|
49319
|
-
render: (row) => /* @__PURE__ */
|
|
49712
|
+
render: (row) => /* @__PURE__ */ jsx271("div", { className: "", children: /* @__PURE__ */ jsx271("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
49320
49713
|
},
|
|
49321
49714
|
{
|
|
49322
49715
|
header: "Quantity",
|
|
@@ -49324,7 +49717,7 @@ var ItemReport = ({
|
|
|
49324
49717
|
className: "text-xs whitespace-nowrap",
|
|
49325
49718
|
render: (row) => {
|
|
49326
49719
|
const Qty = row.quantity;
|
|
49327
|
-
return /* @__PURE__ */
|
|
49720
|
+
return /* @__PURE__ */ jsxs240(
|
|
49328
49721
|
"div",
|
|
49329
49722
|
{
|
|
49330
49723
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -49341,7 +49734,7 @@ var ItemReport = ({
|
|
|
49341
49734
|
header: "Balance",
|
|
49342
49735
|
key: "runningBalance",
|
|
49343
49736
|
className: "text-xs whitespace-nowrap",
|
|
49344
|
-
render: (row) => /* @__PURE__ */
|
|
49737
|
+
render: (row) => /* @__PURE__ */ jsx271("div", { className: "", children: /* @__PURE__ */ jsx271("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
49345
49738
|
}
|
|
49346
49739
|
];
|
|
49347
49740
|
let runningBalance = 0;
|
|
@@ -49353,10 +49746,10 @@ var ItemReport = ({
|
|
|
49353
49746
|
};
|
|
49354
49747
|
});
|
|
49355
49748
|
const itemName = datas[0]?.name;
|
|
49356
|
-
return /* @__PURE__ */
|
|
49357
|
-
/* @__PURE__ */
|
|
49358
|
-
/* @__PURE__ */
|
|
49359
|
-
/* @__PURE__ */
|
|
49749
|
+
return /* @__PURE__ */ jsxs240(Fragment139, { children: [
|
|
49750
|
+
/* @__PURE__ */ jsx271(Modal2, {}),
|
|
49751
|
+
/* @__PURE__ */ jsx271(TransactionView, {}),
|
|
49752
|
+
/* @__PURE__ */ jsx271(
|
|
49360
49753
|
A4DataView,
|
|
49361
49754
|
{
|
|
49362
49755
|
columns,
|
|
@@ -49367,14 +49760,14 @@ var ItemReport = ({
|
|
|
49367
49760
|
tableTitle: `${type} Movement Report`,
|
|
49368
49761
|
fixed: false,
|
|
49369
49762
|
error: !id ? "Please select an item" : void 0,
|
|
49370
|
-
headers: /* @__PURE__ */
|
|
49763
|
+
headers: /* @__PURE__ */ jsx271(
|
|
49371
49764
|
Button,
|
|
49372
49765
|
{
|
|
49373
49766
|
type: "button",
|
|
49374
49767
|
size: "sm",
|
|
49375
49768
|
onClick: () => openState({
|
|
49376
49769
|
title: "Item Transactions",
|
|
49377
|
-
content: /* @__PURE__ */
|
|
49770
|
+
content: /* @__PURE__ */ jsx271(
|
|
49378
49771
|
ItemReportHeader2,
|
|
49379
49772
|
{
|
|
49380
49773
|
type,
|
|
@@ -49417,7 +49810,7 @@ function ItemReportHeader2({
|
|
|
49417
49810
|
label: b.name,
|
|
49418
49811
|
value: b._id
|
|
49419
49812
|
}));
|
|
49420
|
-
return /* @__PURE__ */
|
|
49813
|
+
return /* @__PURE__ */ jsxs240(
|
|
49421
49814
|
"form",
|
|
49422
49815
|
{
|
|
49423
49816
|
className: "space-y-3",
|
|
@@ -49435,8 +49828,8 @@ function ItemReportHeader2({
|
|
|
49435
49828
|
close();
|
|
49436
49829
|
}),
|
|
49437
49830
|
children: [
|
|
49438
|
-
/* @__PURE__ */
|
|
49439
|
-
/* @__PURE__ */
|
|
49831
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49832
|
+
/* @__PURE__ */ jsx271(
|
|
49440
49833
|
Select,
|
|
49441
49834
|
{
|
|
49442
49835
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -49444,7 +49837,7 @@ function ItemReportHeader2({
|
|
|
49444
49837
|
name: "branch"
|
|
49445
49838
|
}
|
|
49446
49839
|
),
|
|
49447
|
-
type === "pack" ? /* @__PURE__ */
|
|
49840
|
+
type === "pack" ? /* @__PURE__ */ jsx271(
|
|
49448
49841
|
Pack_default.Pack,
|
|
49449
49842
|
{
|
|
49450
49843
|
api: "/packs/get",
|
|
@@ -49452,7 +49845,7 @@ function ItemReportHeader2({
|
|
|
49452
49845
|
form: methods,
|
|
49453
49846
|
name: "pack"
|
|
49454
49847
|
}
|
|
49455
|
-
) : /* @__PURE__ */
|
|
49848
|
+
) : /* @__PURE__ */ jsx271(
|
|
49456
49849
|
Feilds_default5.Product,
|
|
49457
49850
|
{
|
|
49458
49851
|
label: "",
|
|
@@ -49463,7 +49856,7 @@ function ItemReportHeader2({
|
|
|
49463
49856
|
}
|
|
49464
49857
|
)
|
|
49465
49858
|
] }),
|
|
49466
|
-
/* @__PURE__ */
|
|
49859
|
+
/* @__PURE__ */ jsx271("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ jsx271(Button, { type: "submit", children: "Filter" }) })
|
|
49467
49860
|
]
|
|
49468
49861
|
}
|
|
49469
49862
|
);
|
|
@@ -49471,19 +49864,19 @@ function ItemReportHeader2({
|
|
|
49471
49864
|
var ItemReport_default = ItemReport;
|
|
49472
49865
|
|
|
49473
49866
|
// src/components/accounts/LeaseCollection.tsx
|
|
49474
|
-
import { useNavigate as
|
|
49475
|
-
import { useMemo as
|
|
49476
|
-
import { Fragment as
|
|
49867
|
+
import { useNavigate as useNavigate66, useParams as useParams113, useSearchParams as useSearchParams19 } from "react-router-dom";
|
|
49868
|
+
import { useMemo as useMemo56, useState as useState117, useEffect as useEffect115 } from "react";
|
|
49869
|
+
import { Fragment as Fragment140, jsx as jsx272, jsxs as jsxs241 } from "react/jsx-runtime";
|
|
49477
49870
|
var LeaseCollection = ({
|
|
49478
49871
|
leaseType,
|
|
49479
49872
|
defaultCurrency = "KES"
|
|
49480
49873
|
}) => {
|
|
49481
|
-
const navigate =
|
|
49874
|
+
const navigate = useNavigate66();
|
|
49482
49875
|
const [searchParams] = useSearchParams19();
|
|
49483
49876
|
const { apiConfig } = useWarqadConfig();
|
|
49484
|
-
const { branchId } =
|
|
49877
|
+
const { branchId } = useParams113();
|
|
49485
49878
|
const { branches } = useAuth_default();
|
|
49486
|
-
const currentBranch =
|
|
49879
|
+
const currentBranch = useMemo56(
|
|
49487
49880
|
() => branches?.find((b) => b?._id === branchId),
|
|
49488
49881
|
[branches, branchId]
|
|
49489
49882
|
);
|
|
@@ -49519,9 +49912,9 @@ var LeaseCollection = ({
|
|
|
49519
49912
|
key: "name",
|
|
49520
49913
|
className: "text-xs whitespace-nowrap ",
|
|
49521
49914
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
49522
|
-
render: (row) => /* @__PURE__ */
|
|
49523
|
-
/* @__PURE__ */
|
|
49524
|
-
row.unitNames && /* @__PURE__ */
|
|
49915
|
+
render: (row) => /* @__PURE__ */ jsxs241("div", { className: "space-y-1", children: [
|
|
49916
|
+
/* @__PURE__ */ jsx272("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49917
|
+
row.unitNames && /* @__PURE__ */ jsxs241("p", { className: "text-[9px]! capitalize", children: [
|
|
49525
49918
|
"(",
|
|
49526
49919
|
row.unitNames,
|
|
49527
49920
|
")"
|
|
@@ -49533,7 +49926,7 @@ var LeaseCollection = ({
|
|
|
49533
49926
|
key: "phoneNumber",
|
|
49534
49927
|
maxWidth: 70,
|
|
49535
49928
|
render: (row) => {
|
|
49536
|
-
return /* @__PURE__ */
|
|
49929
|
+
return /* @__PURE__ */ jsx272("p", { children: row?.phoneNumber || "N/A" });
|
|
49537
49930
|
}
|
|
49538
49931
|
},
|
|
49539
49932
|
// </span>
|
|
@@ -49543,11 +49936,11 @@ var LeaseCollection = ({
|
|
|
49543
49936
|
className: "text-xs whitespace-nowrap text-right",
|
|
49544
49937
|
render: (row) => {
|
|
49545
49938
|
const Amount = row.totalCollectionString;
|
|
49546
|
-
return /* @__PURE__ */
|
|
49939
|
+
return /* @__PURE__ */ jsx272("div", { className: "", children: /* @__PURE__ */ jsx272("p", { className: "font-bold ", children: Amount }) });
|
|
49547
49940
|
},
|
|
49548
49941
|
renderFooter: (data2) => {
|
|
49549
49942
|
if (currencyFilter === "all") return;
|
|
49550
|
-
return /* @__PURE__ */
|
|
49943
|
+
return /* @__PURE__ */ jsx272("span", { className: " font-bold", children: Formats_default.Price(
|
|
49551
49944
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
49552
49945
|
defaultCurrency,
|
|
49553
49946
|
false
|
|
@@ -49555,7 +49948,7 @@ var LeaseCollection = ({
|
|
|
49555
49948
|
}
|
|
49556
49949
|
}
|
|
49557
49950
|
];
|
|
49558
|
-
const datas =
|
|
49951
|
+
const datas = useMemo56(() => {
|
|
49559
49952
|
let runningBalance = 0;
|
|
49560
49953
|
let filteredData = data?.data || [];
|
|
49561
49954
|
const result = filteredData.map((item) => {
|
|
@@ -49568,9 +49961,9 @@ var LeaseCollection = ({
|
|
|
49568
49961
|
});
|
|
49569
49962
|
return result;
|
|
49570
49963
|
}, [filter, currencyFilter, data]);
|
|
49571
|
-
return /* @__PURE__ */
|
|
49572
|
-
/* @__PURE__ */
|
|
49573
|
-
/* @__PURE__ */
|
|
49964
|
+
return /* @__PURE__ */ jsxs241(Fragment140, { children: [
|
|
49965
|
+
/* @__PURE__ */ jsx272(TransactionView, {}),
|
|
49966
|
+
/* @__PURE__ */ jsx272(
|
|
49574
49967
|
A4DataView,
|
|
49575
49968
|
{
|
|
49576
49969
|
columns,
|
|
@@ -49580,7 +49973,7 @@ var LeaseCollection = ({
|
|
|
49580
49973
|
subtitle: `All Collections`,
|
|
49581
49974
|
fixed: false,
|
|
49582
49975
|
startPage: 1e9,
|
|
49583
|
-
headers: /* @__PURE__ */
|
|
49976
|
+
headers: /* @__PURE__ */ jsx272("div", { className: "flex gap-2" })
|
|
49584
49977
|
}
|
|
49585
49978
|
)
|
|
49586
49979
|
] });
|
|
@@ -49588,8 +49981,8 @@ var LeaseCollection = ({
|
|
|
49588
49981
|
var LeaseCollection_default = LeaseCollection;
|
|
49589
49982
|
|
|
49590
49983
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49591
|
-
import { useNavigate as
|
|
49592
|
-
import { EllipsisVertical as
|
|
49984
|
+
import { useNavigate as useNavigate67, useParams as useParams117 } from "react-router-dom";
|
|
49985
|
+
import { EllipsisVertical as EllipsisVertical49, FilePenLine as FilePenLine45, Trash2 as Trash256 } from "lucide-react";
|
|
49593
49986
|
import { useState as useState119 } from "react";
|
|
49594
49987
|
import { message as message90 } from "antd";
|
|
49595
49988
|
|
|
@@ -49627,14 +50020,14 @@ import { useForm as useForm60 } from "react-hook-form";
|
|
|
49627
50020
|
import { zodResolver as zodResolver59 } from "@hookform/resolvers/zod";
|
|
49628
50021
|
import { message as message87 } from "antd";
|
|
49629
50022
|
import { useEffect as useEffect116 } from "react";
|
|
49630
|
-
import { useParams as
|
|
49631
|
-
import { jsx as
|
|
50023
|
+
import { useParams as useParams114 } from "react-router-dom";
|
|
50024
|
+
import { jsx as jsx273, jsxs as jsxs242 } from "react/jsx-runtime";
|
|
49632
50025
|
function AccountForm3({
|
|
49633
50026
|
onReload,
|
|
49634
50027
|
close,
|
|
49635
50028
|
id
|
|
49636
50029
|
}) {
|
|
49637
|
-
const { branchId } =
|
|
50030
|
+
const { branchId } = useParams114();
|
|
49638
50031
|
const { currencies } = useWarqadConfig();
|
|
49639
50032
|
const { stock } = currencies;
|
|
49640
50033
|
const isEdit = !!id;
|
|
@@ -49700,24 +50093,24 @@ function AccountForm3({
|
|
|
49700
50093
|
fetches();
|
|
49701
50094
|
}
|
|
49702
50095
|
}, [id]);
|
|
49703
|
-
return /* @__PURE__ */
|
|
50096
|
+
return /* @__PURE__ */ jsxs242(
|
|
49704
50097
|
Card,
|
|
49705
50098
|
{
|
|
49706
50099
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49707
50100
|
isLoading: isLoadingGet,
|
|
49708
50101
|
loadingText: "Processing...",
|
|
49709
50102
|
children: [
|
|
49710
|
-
/* @__PURE__ */
|
|
49711
|
-
/* @__PURE__ */
|
|
49712
|
-
/* @__PURE__ */
|
|
50103
|
+
/* @__PURE__ */ jsxs242(Card.Header, { children: [
|
|
50104
|
+
/* @__PURE__ */ jsx273(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
50105
|
+
/* @__PURE__ */ jsx273(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49713
50106
|
] }),
|
|
49714
|
-
/* @__PURE__ */
|
|
50107
|
+
/* @__PURE__ */ jsx273(Card.Content, { children: /* @__PURE__ */ jsxs242(
|
|
49715
50108
|
"form",
|
|
49716
50109
|
{
|
|
49717
50110
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49718
50111
|
children: [
|
|
49719
|
-
/* @__PURE__ */
|
|
49720
|
-
/* @__PURE__ */
|
|
50112
|
+
/* @__PURE__ */ jsxs242("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50113
|
+
/* @__PURE__ */ jsx273(
|
|
49721
50114
|
Fields_default.Input,
|
|
49722
50115
|
{
|
|
49723
50116
|
label: "Name",
|
|
@@ -49728,7 +50121,7 @@ function AccountForm3({
|
|
|
49728
50121
|
required: true
|
|
49729
50122
|
}
|
|
49730
50123
|
),
|
|
49731
|
-
/* @__PURE__ */
|
|
50124
|
+
/* @__PURE__ */ jsx273(
|
|
49732
50125
|
Fields_default.PhoneInput,
|
|
49733
50126
|
{
|
|
49734
50127
|
label: "Phone Number",
|
|
@@ -49737,7 +50130,7 @@ function AccountForm3({
|
|
|
49737
50130
|
placeholder: "Enter phone number"
|
|
49738
50131
|
}
|
|
49739
50132
|
),
|
|
49740
|
-
/* @__PURE__ */
|
|
50133
|
+
/* @__PURE__ */ jsx273(
|
|
49741
50134
|
Fields_default.Select,
|
|
49742
50135
|
{
|
|
49743
50136
|
label: "Currency",
|
|
@@ -49748,7 +50141,7 @@ function AccountForm3({
|
|
|
49748
50141
|
}
|
|
49749
50142
|
)
|
|
49750
50143
|
] }),
|
|
49751
|
-
/* @__PURE__ */
|
|
50144
|
+
/* @__PURE__ */ jsx273("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx273(
|
|
49752
50145
|
Button,
|
|
49753
50146
|
{
|
|
49754
50147
|
isLoading,
|
|
@@ -49772,18 +50165,18 @@ var AccountForm_default3 = AccountForm3;
|
|
|
49772
50165
|
import { useEffect as useEffect117, useState as useState118 } from "react";
|
|
49773
50166
|
import { useForm as useForm61, useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
49774
50167
|
import { zodResolver as zodResolver60 } from "@hookform/resolvers/zod";
|
|
49775
|
-
import { useParams as
|
|
50168
|
+
import { useParams as useParams115 } from "react-router-dom";
|
|
49776
50169
|
import { message as message88 } from "antd";
|
|
49777
|
-
import { Trash2 as
|
|
50170
|
+
import { Trash2 as Trash255, Plus as Plus6 } from "lucide-react";
|
|
49778
50171
|
import dayjs13 from "dayjs";
|
|
49779
|
-
import { jsx as
|
|
50172
|
+
import { jsx as jsx274, jsxs as jsxs243 } from "react/jsx-runtime";
|
|
49780
50173
|
function InvoiceForm2({
|
|
49781
50174
|
onReload,
|
|
49782
50175
|
close,
|
|
49783
50176
|
accountData,
|
|
49784
50177
|
id
|
|
49785
50178
|
}) {
|
|
49786
|
-
const { branchId } =
|
|
50179
|
+
const { branchId } = useParams115();
|
|
49787
50180
|
const [ref2, setRef] = useState118(void 0);
|
|
49788
50181
|
const { post, isLoading } = useApis_default();
|
|
49789
50182
|
const { get, isLoading: getLoading } = useApis_default();
|
|
@@ -49897,25 +50290,25 @@ function InvoiceForm2({
|
|
|
49897
50290
|
e.preventDefault();
|
|
49898
50291
|
}
|
|
49899
50292
|
};
|
|
49900
|
-
return /* @__PURE__ */
|
|
50293
|
+
return /* @__PURE__ */ jsx274(
|
|
49901
50294
|
Card,
|
|
49902
50295
|
{
|
|
49903
50296
|
isLoading: getLoading,
|
|
49904
50297
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49905
|
-
children: /* @__PURE__ */
|
|
49906
|
-
/* @__PURE__ */
|
|
49907
|
-
/* @__PURE__ */
|
|
50298
|
+
children: /* @__PURE__ */ jsxs243(Card.Content, { children: [
|
|
50299
|
+
/* @__PURE__ */ jsx274("input", { type: "hidden", ...register("currency") }),
|
|
50300
|
+
/* @__PURE__ */ jsxs243(
|
|
49908
50301
|
"form",
|
|
49909
50302
|
{
|
|
49910
50303
|
onSubmit: handleSubmit(onSubmit),
|
|
49911
50304
|
onKeyDown: handleKeyDown,
|
|
49912
50305
|
className: "space-y-6",
|
|
49913
50306
|
children: [
|
|
49914
|
-
/* @__PURE__ */
|
|
49915
|
-
/* @__PURE__ */
|
|
49916
|
-
/* @__PURE__ */
|
|
49917
|
-
/* @__PURE__ */
|
|
49918
|
-
/* @__PURE__ */
|
|
50307
|
+
/* @__PURE__ */ jsxs243("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
50308
|
+
/* @__PURE__ */ jsx274("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
50309
|
+
/* @__PURE__ */ jsxs243("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
50310
|
+
/* @__PURE__ */ jsxs243("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
50311
|
+
/* @__PURE__ */ jsx274(
|
|
49919
50312
|
Fields_default.Input,
|
|
49920
50313
|
{
|
|
49921
50314
|
label: "Container No",
|
|
@@ -49924,7 +50317,7 @@ function InvoiceForm2({
|
|
|
49924
50317
|
onChange: (val) => setItemName(val)
|
|
49925
50318
|
}
|
|
49926
50319
|
),
|
|
49927
|
-
/* @__PURE__ */
|
|
50320
|
+
/* @__PURE__ */ jsx274(
|
|
49928
50321
|
Fields_default.Input,
|
|
49929
50322
|
{
|
|
49930
50323
|
label: "Cbm",
|
|
@@ -49934,7 +50327,7 @@ function InvoiceForm2({
|
|
|
49934
50327
|
onChange: (val) => setItemQuantity(val)
|
|
49935
50328
|
}
|
|
49936
50329
|
),
|
|
49937
|
-
/* @__PURE__ */
|
|
50330
|
+
/* @__PURE__ */ jsx274(
|
|
49938
50331
|
Fields_default.Input,
|
|
49939
50332
|
{
|
|
49940
50333
|
label: "Price (KES)",
|
|
@@ -49945,7 +50338,7 @@ function InvoiceForm2({
|
|
|
49945
50338
|
}
|
|
49946
50339
|
)
|
|
49947
50340
|
] }),
|
|
49948
|
-
/* @__PURE__ */
|
|
50341
|
+
/* @__PURE__ */ jsxs243(
|
|
49949
50342
|
Button,
|
|
49950
50343
|
{
|
|
49951
50344
|
type: "button",
|
|
@@ -49953,23 +50346,23 @@ function InvoiceForm2({
|
|
|
49953
50346
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49954
50347
|
variant: "outline",
|
|
49955
50348
|
children: [
|
|
49956
|
-
/* @__PURE__ */
|
|
50349
|
+
/* @__PURE__ */ jsx274(Plus6, { size: 16 }),
|
|
49957
50350
|
" Add Item"
|
|
49958
50351
|
]
|
|
49959
50352
|
}
|
|
49960
50353
|
)
|
|
49961
50354
|
] })
|
|
49962
50355
|
] }),
|
|
49963
|
-
/* @__PURE__ */
|
|
49964
|
-
/* @__PURE__ */
|
|
49965
|
-
/* @__PURE__ */
|
|
49966
|
-
/* @__PURE__ */
|
|
49967
|
-
/* @__PURE__ */
|
|
49968
|
-
/* @__PURE__ */
|
|
49969
|
-
/* @__PURE__ */
|
|
49970
|
-
/* @__PURE__ */
|
|
50356
|
+
/* @__PURE__ */ jsxs243("div", { children: [
|
|
50357
|
+
/* @__PURE__ */ jsx274("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
50358
|
+
/* @__PURE__ */ jsx274("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ jsx274("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs243("table", { className: "w-full text-left border-collapse", children: [
|
|
50359
|
+
/* @__PURE__ */ jsx274("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs243("tr", { children: [
|
|
50360
|
+
/* @__PURE__ */ jsx274("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: "#" }),
|
|
50361
|
+
/* @__PURE__ */ jsx274("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" }),
|
|
50362
|
+
/* @__PURE__ */ jsx274("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" }),
|
|
50363
|
+
/* @__PURE__ */ jsx274("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" })
|
|
49971
50364
|
] }) }),
|
|
49972
|
-
/* @__PURE__ */
|
|
50365
|
+
/* @__PURE__ */ jsx274("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ jsx274("tr", { children: /* @__PURE__ */ jsx274(
|
|
49973
50366
|
"td",
|
|
49974
50367
|
{
|
|
49975
50368
|
colSpan: 4,
|
|
@@ -49978,30 +50371,30 @@ function InvoiceForm2({
|
|
|
49978
50371
|
}
|
|
49979
50372
|
) }) : fields.map((item, index) => {
|
|
49980
50373
|
const total = item.quantity * item.amount;
|
|
49981
|
-
return /* @__PURE__ */
|
|
50374
|
+
return /* @__PURE__ */ jsxs243(
|
|
49982
50375
|
"tr",
|
|
49983
50376
|
{
|
|
49984
50377
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49985
50378
|
children: [
|
|
49986
|
-
/* @__PURE__ */
|
|
49987
|
-
/* @__PURE__ */
|
|
49988
|
-
/* @__PURE__ */
|
|
49989
|
-
/* @__PURE__ */
|
|
50379
|
+
/* @__PURE__ */ jsx274("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 }),
|
|
50380
|
+
/* @__PURE__ */ jsxs243("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
50381
|
+
/* @__PURE__ */ jsx274("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
50382
|
+
/* @__PURE__ */ jsxs243("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49990
50383
|
item.quantity,
|
|
49991
50384
|
" Cbm @",
|
|
49992
50385
|
" ",
|
|
49993
50386
|
Formats_default.Price(item.amount, "KES")
|
|
49994
50387
|
] })
|
|
49995
50388
|
] }),
|
|
49996
|
-
/* @__PURE__ */
|
|
49997
|
-
/* @__PURE__ */
|
|
50389
|
+
/* @__PURE__ */ jsx274("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") }),
|
|
50390
|
+
/* @__PURE__ */ jsx274("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ jsx274(
|
|
49998
50391
|
"button",
|
|
49999
50392
|
{
|
|
50000
50393
|
type: "button",
|
|
50001
50394
|
onClick: () => remove(index),
|
|
50002
50395
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
50003
|
-
children: /* @__PURE__ */
|
|
50004
|
-
|
|
50396
|
+
children: /* @__PURE__ */ jsx274(
|
|
50397
|
+
Trash255,
|
|
50005
50398
|
{
|
|
50006
50399
|
size: 13,
|
|
50007
50400
|
className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
|
|
@@ -50014,8 +50407,8 @@ function InvoiceForm2({
|
|
|
50014
50407
|
item.id
|
|
50015
50408
|
);
|
|
50016
50409
|
}) }),
|
|
50017
|
-
fields.length > 0 && /* @__PURE__ */
|
|
50018
|
-
/* @__PURE__ */
|
|
50410
|
+
fields.length > 0 && /* @__PURE__ */ jsx274("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs243("tr", { children: [
|
|
50411
|
+
/* @__PURE__ */ jsx274(
|
|
50019
50412
|
"td",
|
|
50020
50413
|
{
|
|
50021
50414
|
colSpan: 2,
|
|
@@ -50023,20 +50416,20 @@ function InvoiceForm2({
|
|
|
50023
50416
|
children: "Total"
|
|
50024
50417
|
}
|
|
50025
50418
|
),
|
|
50026
|
-
/* @__PURE__ */
|
|
50419
|
+
/* @__PURE__ */ jsx274("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(
|
|
50027
50420
|
fields.reduce(
|
|
50028
50421
|
(sum, item) => sum + item.quantity * item.amount,
|
|
50029
50422
|
0
|
|
50030
50423
|
),
|
|
50031
50424
|
"KES"
|
|
50032
50425
|
) }),
|
|
50033
|
-
/* @__PURE__ */
|
|
50426
|
+
/* @__PURE__ */ jsx274("td", {})
|
|
50034
50427
|
] }) })
|
|
50035
50428
|
] }) }) })
|
|
50036
50429
|
] }),
|
|
50037
|
-
/* @__PURE__ */
|
|
50038
|
-
/* @__PURE__ */
|
|
50039
|
-
/* @__PURE__ */
|
|
50430
|
+
/* @__PURE__ */ jsxs243("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
50431
|
+
/* @__PURE__ */ jsxs243("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50432
|
+
/* @__PURE__ */ jsx274(
|
|
50040
50433
|
Fields_default.DateInput,
|
|
50041
50434
|
{
|
|
50042
50435
|
label: "Date",
|
|
@@ -50045,20 +50438,20 @@ function InvoiceForm2({
|
|
|
50045
50438
|
required: true
|
|
50046
50439
|
}
|
|
50047
50440
|
),
|
|
50048
|
-
/* @__PURE__ */
|
|
50441
|
+
/* @__PURE__ */ jsx274(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
50049
50442
|
] }),
|
|
50050
|
-
/* @__PURE__ */
|
|
50051
|
-
/* @__PURE__ */
|
|
50443
|
+
/* @__PURE__ */ jsxs243("div", { className: "flex justify-between items-center mt-6", children: [
|
|
50444
|
+
/* @__PURE__ */ jsx274("div", { children: isEdit && /* @__PURE__ */ jsx274(
|
|
50052
50445
|
ConfirmModal,
|
|
50053
50446
|
{
|
|
50054
50447
|
title: "Reverse Transaction",
|
|
50055
|
-
description: /* @__PURE__ */
|
|
50056
|
-
/* @__PURE__ */
|
|
50057
|
-
/* @__PURE__ */
|
|
50448
|
+
description: /* @__PURE__ */ jsxs243("div", { className: "space-y-3 text-left", children: [
|
|
50449
|
+
/* @__PURE__ */ jsx274("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50450
|
+
/* @__PURE__ */ jsx274("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."' })
|
|
50058
50451
|
] }),
|
|
50059
50452
|
confirmationWord: "delete",
|
|
50060
50453
|
onSubmit: onReverse,
|
|
50061
|
-
children: /* @__PURE__ */
|
|
50454
|
+
children: /* @__PURE__ */ jsx274(
|
|
50062
50455
|
Button,
|
|
50063
50456
|
{
|
|
50064
50457
|
type: "button",
|
|
@@ -50071,8 +50464,8 @@ function InvoiceForm2({
|
|
|
50071
50464
|
)
|
|
50072
50465
|
}
|
|
50073
50466
|
) }),
|
|
50074
|
-
/* @__PURE__ */
|
|
50075
|
-
close && /* @__PURE__ */
|
|
50467
|
+
/* @__PURE__ */ jsxs243("div", { className: "flex justify-end gap-3", children: [
|
|
50468
|
+
close && /* @__PURE__ */ jsx274(
|
|
50076
50469
|
Button,
|
|
50077
50470
|
{
|
|
50078
50471
|
type: "button",
|
|
@@ -50082,7 +50475,7 @@ function InvoiceForm2({
|
|
|
50082
50475
|
children: "Cancel"
|
|
50083
50476
|
}
|
|
50084
50477
|
),
|
|
50085
|
-
/* @__PURE__ */
|
|
50478
|
+
/* @__PURE__ */ jsx274(
|
|
50086
50479
|
Button,
|
|
50087
50480
|
{
|
|
50088
50481
|
isLoading,
|
|
@@ -50109,10 +50502,10 @@ var InvoiceForm_default2 = InvoiceForm2;
|
|
|
50109
50502
|
import React47 from "react";
|
|
50110
50503
|
import { useForm as useForm62 } from "react-hook-form";
|
|
50111
50504
|
import { zodResolver as zodResolver61 } from "@hookform/resolvers/zod";
|
|
50112
|
-
import { useParams as
|
|
50505
|
+
import { useParams as useParams116 } from "react-router-dom";
|
|
50113
50506
|
import { message as message89 } from "antd";
|
|
50114
50507
|
import dayjs14 from "dayjs";
|
|
50115
|
-
import { jsx as
|
|
50508
|
+
import { jsx as jsx275, jsxs as jsxs244 } from "react/jsx-runtime";
|
|
50116
50509
|
function JournalForm5({
|
|
50117
50510
|
onReload,
|
|
50118
50511
|
close,
|
|
@@ -50120,7 +50513,7 @@ function JournalForm5({
|
|
|
50120
50513
|
action = "debit",
|
|
50121
50514
|
id
|
|
50122
50515
|
}) {
|
|
50123
|
-
const { branchId } =
|
|
50516
|
+
const { branchId } = useParams116();
|
|
50124
50517
|
const { currencies } = useWarqadConfig();
|
|
50125
50518
|
const { stock: defaultCurrency } = currencies;
|
|
50126
50519
|
const [ref2, setRef] = React47.useState(void 0);
|
|
@@ -50203,19 +50596,19 @@ function JournalForm5({
|
|
|
50203
50596
|
e.preventDefault();
|
|
50204
50597
|
}
|
|
50205
50598
|
};
|
|
50206
|
-
return /* @__PURE__ */
|
|
50599
|
+
return /* @__PURE__ */ jsx275(
|
|
50207
50600
|
Card,
|
|
50208
50601
|
{
|
|
50209
50602
|
isLoading: getLoading,
|
|
50210
50603
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
50211
|
-
children: /* @__PURE__ */
|
|
50604
|
+
children: /* @__PURE__ */ jsx275(Card.Content, { children: /* @__PURE__ */ jsxs244(
|
|
50212
50605
|
"form",
|
|
50213
50606
|
{
|
|
50214
50607
|
onSubmit: handleSubmit(onSubmit),
|
|
50215
50608
|
onKeyDown: handleKeyDown,
|
|
50216
50609
|
className: "space-y-4",
|
|
50217
50610
|
children: [
|
|
50218
|
-
/* @__PURE__ */
|
|
50611
|
+
/* @__PURE__ */ jsx275(
|
|
50219
50612
|
Fields_default.Input,
|
|
50220
50613
|
{
|
|
50221
50614
|
label: "Description",
|
|
@@ -50226,8 +50619,8 @@ function JournalForm5({
|
|
|
50226
50619
|
placeholder: "Enter description"
|
|
50227
50620
|
}
|
|
50228
50621
|
),
|
|
50229
|
-
/* @__PURE__ */
|
|
50230
|
-
/* @__PURE__ */
|
|
50622
|
+
/* @__PURE__ */ jsxs244("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50623
|
+
/* @__PURE__ */ jsx275(
|
|
50231
50624
|
Fields_default.DateInput,
|
|
50232
50625
|
{
|
|
50233
50626
|
label: "Date",
|
|
@@ -50236,7 +50629,7 @@ function JournalForm5({
|
|
|
50236
50629
|
required: true
|
|
50237
50630
|
}
|
|
50238
50631
|
),
|
|
50239
|
-
/* @__PURE__ */
|
|
50632
|
+
/* @__PURE__ */ jsx275(
|
|
50240
50633
|
Fields_default.Input,
|
|
50241
50634
|
{
|
|
50242
50635
|
label: "Currency",
|
|
@@ -50246,8 +50639,8 @@ function JournalForm5({
|
|
|
50246
50639
|
}
|
|
50247
50640
|
)
|
|
50248
50641
|
] }),
|
|
50249
|
-
/* @__PURE__ */
|
|
50250
|
-
/* @__PURE__ */
|
|
50642
|
+
/* @__PURE__ */ jsxs244("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50643
|
+
/* @__PURE__ */ jsx275(
|
|
50251
50644
|
Fields_default.Input,
|
|
50252
50645
|
{
|
|
50253
50646
|
label: "Amount",
|
|
@@ -50258,7 +50651,7 @@ function JournalForm5({
|
|
|
50258
50651
|
placeholder: "0.00"
|
|
50259
50652
|
}
|
|
50260
50653
|
),
|
|
50261
|
-
/* @__PURE__ */
|
|
50654
|
+
/* @__PURE__ */ jsx275(
|
|
50262
50655
|
Fields_default.Select,
|
|
50263
50656
|
{
|
|
50264
50657
|
label: "Action",
|
|
@@ -50272,7 +50665,7 @@ function JournalForm5({
|
|
|
50272
50665
|
}
|
|
50273
50666
|
)
|
|
50274
50667
|
] }),
|
|
50275
|
-
/* @__PURE__ */
|
|
50668
|
+
/* @__PURE__ */ jsx275(
|
|
50276
50669
|
Fields_default.Textarea,
|
|
50277
50670
|
{
|
|
50278
50671
|
label: "Note",
|
|
@@ -50282,18 +50675,18 @@ function JournalForm5({
|
|
|
50282
50675
|
rows: 3
|
|
50283
50676
|
}
|
|
50284
50677
|
),
|
|
50285
|
-
/* @__PURE__ */
|
|
50286
|
-
/* @__PURE__ */
|
|
50678
|
+
/* @__PURE__ */ jsxs244("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
50679
|
+
/* @__PURE__ */ jsx275("div", { children: isEdit && /* @__PURE__ */ jsx275(
|
|
50287
50680
|
ConfirmModal,
|
|
50288
50681
|
{
|
|
50289
50682
|
title: "Reverse Transaction",
|
|
50290
|
-
description: /* @__PURE__ */
|
|
50291
|
-
/* @__PURE__ */
|
|
50292
|
-
/* @__PURE__ */
|
|
50683
|
+
description: /* @__PURE__ */ jsxs244("div", { className: "space-y-3 text-left", children: [
|
|
50684
|
+
/* @__PURE__ */ jsx275("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50685
|
+
/* @__PURE__ */ jsx275("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."' })
|
|
50293
50686
|
] }),
|
|
50294
50687
|
confirmationWord: "delete",
|
|
50295
50688
|
onSubmit: onReverse,
|
|
50296
|
-
children: /* @__PURE__ */
|
|
50689
|
+
children: /* @__PURE__ */ jsx275(
|
|
50297
50690
|
Button,
|
|
50298
50691
|
{
|
|
50299
50692
|
type: "button",
|
|
@@ -50306,8 +50699,8 @@ function JournalForm5({
|
|
|
50306
50699
|
)
|
|
50307
50700
|
}
|
|
50308
50701
|
) }),
|
|
50309
|
-
/* @__PURE__ */
|
|
50310
|
-
close && /* @__PURE__ */
|
|
50702
|
+
/* @__PURE__ */ jsxs244("div", { className: "flex justify-end gap-3", children: [
|
|
50703
|
+
close && /* @__PURE__ */ jsx275(
|
|
50311
50704
|
Button,
|
|
50312
50705
|
{
|
|
50313
50706
|
type: "button",
|
|
@@ -50317,7 +50710,7 @@ function JournalForm5({
|
|
|
50317
50710
|
children: "Cancel"
|
|
50318
50711
|
}
|
|
50319
50712
|
),
|
|
50320
|
-
/* @__PURE__ */
|
|
50713
|
+
/* @__PURE__ */ jsx275(
|
|
50321
50714
|
Button,
|
|
50322
50715
|
{
|
|
50323
50716
|
isLoading,
|
|
@@ -50339,13 +50732,13 @@ function JournalForm5({
|
|
|
50339
50732
|
var journalForm_default2 = JournalForm5;
|
|
50340
50733
|
|
|
50341
50734
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
50342
|
-
import { Fragment as
|
|
50735
|
+
import { Fragment as Fragment141, jsx as jsx276, jsxs as jsxs245 } from "react/jsx-runtime";
|
|
50343
50736
|
function CargoIM({ v, url }) {
|
|
50344
|
-
const { branchId } =
|
|
50737
|
+
const { branchId } = useParams117();
|
|
50345
50738
|
const { apiConfig } = useWarqadConfig();
|
|
50346
50739
|
const { width } = useMediaSize();
|
|
50347
50740
|
const isLargeScreen = width > 768;
|
|
50348
|
-
const navigate =
|
|
50741
|
+
const navigate = useNavigate67();
|
|
50349
50742
|
const type = "supplier";
|
|
50350
50743
|
const [deleteAccount, setDeleteAccount] = useState119(null);
|
|
50351
50744
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
@@ -50358,17 +50751,17 @@ function CargoIM({ v, url }) {
|
|
|
50358
50751
|
const items = (data2) => [
|
|
50359
50752
|
{
|
|
50360
50753
|
label: `Edit ${type}`,
|
|
50361
|
-
icon: /* @__PURE__ */
|
|
50754
|
+
icon: /* @__PURE__ */ jsx276(FilePenLine45, { size: 16 }),
|
|
50362
50755
|
onClick: () => openState({
|
|
50363
50756
|
type: "Account",
|
|
50364
|
-
content: /* @__PURE__ */
|
|
50757
|
+
content: /* @__PURE__ */ jsx276(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
50365
50758
|
title: "Account Form",
|
|
50366
50759
|
width: 800
|
|
50367
50760
|
})
|
|
50368
50761
|
},
|
|
50369
50762
|
{
|
|
50370
50763
|
label: `Delete ${type}`,
|
|
50371
|
-
icon: /* @__PURE__ */
|
|
50764
|
+
icon: /* @__PURE__ */ jsx276(Trash256, { className: "text-red-500", size: 16 }),
|
|
50372
50765
|
onClick: () => setDeleteAccount(data2)
|
|
50373
50766
|
}
|
|
50374
50767
|
].filter(Boolean);
|
|
@@ -50379,7 +50772,7 @@ function CargoIM({ v, url }) {
|
|
|
50379
50772
|
className: "w-full",
|
|
50380
50773
|
cell: ({ row }) => {
|
|
50381
50774
|
const account = row.original;
|
|
50382
|
-
return /* @__PURE__ */
|
|
50775
|
+
return /* @__PURE__ */ jsx276(
|
|
50383
50776
|
"span",
|
|
50384
50777
|
{
|
|
50385
50778
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -50408,8 +50801,8 @@ function CargoIM({ v, url }) {
|
|
|
50408
50801
|
className: "w-px whitespace-nowrap",
|
|
50409
50802
|
cell: ({ row }) => {
|
|
50410
50803
|
const data2 = row.original;
|
|
50411
|
-
return /* @__PURE__ */
|
|
50412
|
-
/* @__PURE__ */
|
|
50804
|
+
return /* @__PURE__ */ jsxs245("div", { className: "flex gap-4 items-center", children: [
|
|
50805
|
+
/* @__PURE__ */ jsx276(
|
|
50413
50806
|
"button",
|
|
50414
50807
|
{
|
|
50415
50808
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50417,7 +50810,7 @@ function CargoIM({ v, url }) {
|
|
|
50417
50810
|
openState({
|
|
50418
50811
|
type: "credit",
|
|
50419
50812
|
closeOnOverlayClick: false,
|
|
50420
|
-
content: /* @__PURE__ */
|
|
50813
|
+
content: /* @__PURE__ */ jsx276(
|
|
50421
50814
|
InvoiceForm_default2,
|
|
50422
50815
|
{
|
|
50423
50816
|
onReload: reload,
|
|
@@ -50432,7 +50825,7 @@ function CargoIM({ v, url }) {
|
|
|
50432
50825
|
children: "Inv"
|
|
50433
50826
|
}
|
|
50434
50827
|
),
|
|
50435
|
-
/* @__PURE__ */
|
|
50828
|
+
/* @__PURE__ */ jsx276(
|
|
50436
50829
|
"button",
|
|
50437
50830
|
{
|
|
50438
50831
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50440,7 +50833,7 @@ function CargoIM({ v, url }) {
|
|
|
50440
50833
|
openState({
|
|
50441
50834
|
type: "debit",
|
|
50442
50835
|
closeOnOverlayClick: false,
|
|
50443
|
-
content: /* @__PURE__ */
|
|
50836
|
+
content: /* @__PURE__ */ jsx276(
|
|
50444
50837
|
journalForm_default2,
|
|
50445
50838
|
{
|
|
50446
50839
|
onReload: reload,
|
|
@@ -50456,14 +50849,14 @@ function CargoIM({ v, url }) {
|
|
|
50456
50849
|
children: "Pay"
|
|
50457
50850
|
}
|
|
50458
50851
|
),
|
|
50459
|
-
/* @__PURE__ */
|
|
50852
|
+
/* @__PURE__ */ jsx276(
|
|
50460
50853
|
Dropdown,
|
|
50461
50854
|
{
|
|
50462
50855
|
className: "cursor-pointer",
|
|
50463
50856
|
width: "w-[150px]",
|
|
50464
50857
|
items: items(data2),
|
|
50465
50858
|
triggerMode: "hover",
|
|
50466
|
-
children: /* @__PURE__ */
|
|
50859
|
+
children: /* @__PURE__ */ jsx276(EllipsisVertical49, {})
|
|
50467
50860
|
}
|
|
50468
50861
|
)
|
|
50469
50862
|
] });
|
|
@@ -50487,9 +50880,9 @@ function CargoIM({ v, url }) {
|
|
|
50487
50880
|
return error;
|
|
50488
50881
|
}
|
|
50489
50882
|
};
|
|
50490
|
-
return /* @__PURE__ */
|
|
50491
|
-
/* @__PURE__ */
|
|
50492
|
-
/* @__PURE__ */
|
|
50883
|
+
return /* @__PURE__ */ jsxs245(Fragment141, { children: [
|
|
50884
|
+
/* @__PURE__ */ jsx276(Modal2, {}),
|
|
50885
|
+
/* @__PURE__ */ jsx276(
|
|
50493
50886
|
ConfirmModal,
|
|
50494
50887
|
{
|
|
50495
50888
|
isOpen: !!deleteAccount,
|
|
@@ -50502,7 +50895,7 @@ function CargoIM({ v, url }) {
|
|
|
50502
50895
|
children: null
|
|
50503
50896
|
}
|
|
50504
50897
|
),
|
|
50505
|
-
/* @__PURE__ */
|
|
50898
|
+
/* @__PURE__ */ jsx276("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ jsx276(
|
|
50506
50899
|
TransactionViewComponent,
|
|
50507
50900
|
{
|
|
50508
50901
|
columns,
|
|
@@ -50513,7 +50906,7 @@ function CargoIM({ v, url }) {
|
|
|
50513
50906
|
onCreate: () => {
|
|
50514
50907
|
openState({
|
|
50515
50908
|
type: "account",
|
|
50516
|
-
content: /* @__PURE__ */
|
|
50909
|
+
content: /* @__PURE__ */ jsx276(AccountForm_default3, { onReload: reload, close }),
|
|
50517
50910
|
title: "Account Form",
|
|
50518
50911
|
width: 800
|
|
50519
50912
|
});
|
|
@@ -50526,8 +50919,8 @@ var CargoIM_default = CargoIM;
|
|
|
50526
50919
|
|
|
50527
50920
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
50528
50921
|
import { useSearchParams as useSearchParams20 } from "react-router-dom";
|
|
50529
|
-
import { useMemo as
|
|
50530
|
-
import { Fragment as
|
|
50922
|
+
import { useMemo as useMemo57, useState as useState120, useEffect as useEffect118 } from "react";
|
|
50923
|
+
import { Fragment as Fragment142, jsx as jsx277, jsxs as jsxs246 } from "react/jsx-runtime";
|
|
50531
50924
|
var CargoIMReport = () => {
|
|
50532
50925
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
50533
50926
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -50571,9 +50964,9 @@ var CargoIMReport = () => {
|
|
|
50571
50964
|
header: "Date",
|
|
50572
50965
|
key: "date",
|
|
50573
50966
|
className: "text-xs whitespace-nowrap",
|
|
50574
|
-
render: (row) => /* @__PURE__ */
|
|
50575
|
-
/* @__PURE__ */
|
|
50576
|
-
/* @__PURE__ */
|
|
50967
|
+
render: (row) => /* @__PURE__ */ jsxs246("div", { className: "", children: [
|
|
50968
|
+
/* @__PURE__ */ jsx277("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50969
|
+
/* @__PURE__ */ jsx277(
|
|
50577
50970
|
"span",
|
|
50578
50971
|
{
|
|
50579
50972
|
onClick: () => {
|
|
@@ -50592,13 +50985,13 @@ var CargoIMReport = () => {
|
|
|
50592
50985
|
header: "Container No",
|
|
50593
50986
|
key: "description",
|
|
50594
50987
|
className: "text-xs w-full break-words",
|
|
50595
|
-
render: (row) => /* @__PURE__ */
|
|
50988
|
+
render: (row) => /* @__PURE__ */ jsx277("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) => {
|
|
50596
50989
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50597
50990
|
/[^a-zA-Z0-9]/g,
|
|
50598
50991
|
""
|
|
50599
50992
|
);
|
|
50600
50993
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50601
|
-
return /* @__PURE__ */
|
|
50994
|
+
return /* @__PURE__ */ jsx277(
|
|
50602
50995
|
"div",
|
|
50603
50996
|
{
|
|
50604
50997
|
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`,
|
|
@@ -50612,13 +51005,13 @@ var CargoIMReport = () => {
|
|
|
50612
51005
|
header: "Cbm",
|
|
50613
51006
|
key: "cbm",
|
|
50614
51007
|
className: "text-xs whitespace-nowrap text-right",
|
|
50615
|
-
render: (row) => /* @__PURE__ */
|
|
51008
|
+
render: (row) => /* @__PURE__ */ jsx277("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) => {
|
|
50616
51009
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50617
51010
|
/[^a-zA-Z0-9]/g,
|
|
50618
51011
|
""
|
|
50619
51012
|
);
|
|
50620
51013
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50621
|
-
return /* @__PURE__ */
|
|
51014
|
+
return /* @__PURE__ */ jsx277(
|
|
50622
51015
|
"div",
|
|
50623
51016
|
{
|
|
50624
51017
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50635,20 +51028,20 @@ var CargoIMReport = () => {
|
|
|
50635
51028
|
),
|
|
50636
51029
|
0
|
|
50637
51030
|
);
|
|
50638
|
-
return totalCbm > 0 ? /* @__PURE__ */
|
|
51031
|
+
return totalCbm > 0 ? /* @__PURE__ */ jsx277("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50639
51032
|
}
|
|
50640
51033
|
},
|
|
50641
51034
|
{
|
|
50642
51035
|
header: "Price",
|
|
50643
51036
|
key: "price",
|
|
50644
51037
|
className: "text-xs whitespace-nowrap text-right",
|
|
50645
|
-
render: (row) => /* @__PURE__ */
|
|
51038
|
+
render: (row) => /* @__PURE__ */ jsx277("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) => {
|
|
50646
51039
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50647
51040
|
/[^a-zA-Z0-9]/g,
|
|
50648
51041
|
""
|
|
50649
51042
|
);
|
|
50650
51043
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50651
|
-
return /* @__PURE__ */
|
|
51044
|
+
return /* @__PURE__ */ jsx277(
|
|
50652
51045
|
"div",
|
|
50653
51046
|
{
|
|
50654
51047
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50662,13 +51055,13 @@ var CargoIMReport = () => {
|
|
|
50662
51055
|
header: "Credit",
|
|
50663
51056
|
key: "credit",
|
|
50664
51057
|
className: "text-xs whitespace-nowrap text-right",
|
|
50665
|
-
render: (row) => /* @__PURE__ */
|
|
51058
|
+
render: (row) => /* @__PURE__ */ jsx277("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) => {
|
|
50666
51059
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50667
51060
|
/[^a-zA-Z0-9]/g,
|
|
50668
51061
|
""
|
|
50669
51062
|
);
|
|
50670
51063
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50671
|
-
return /* @__PURE__ */
|
|
51064
|
+
return /* @__PURE__ */ jsx277(
|
|
50672
51065
|
"div",
|
|
50673
51066
|
{
|
|
50674
51067
|
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`,
|
|
@@ -50677,7 +51070,7 @@ var CargoIMReport = () => {
|
|
|
50677
51070
|
idx
|
|
50678
51071
|
);
|
|
50679
51072
|
}) }),
|
|
50680
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
51073
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx277("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50681
51074
|
data2.reduce(
|
|
50682
51075
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50683
51076
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50691,13 +51084,13 @@ var CargoIMReport = () => {
|
|
|
50691
51084
|
header: "Debit",
|
|
50692
51085
|
key: "debit",
|
|
50693
51086
|
className: "text-xs whitespace-nowrap text-right",
|
|
50694
|
-
render: (row) => /* @__PURE__ */
|
|
51087
|
+
render: (row) => /* @__PURE__ */ jsx277("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) => {
|
|
50695
51088
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50696
51089
|
/[^a-zA-Z0-9]/g,
|
|
50697
51090
|
""
|
|
50698
51091
|
);
|
|
50699
51092
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50700
|
-
return /* @__PURE__ */
|
|
51093
|
+
return /* @__PURE__ */ jsx277(
|
|
50701
51094
|
"div",
|
|
50702
51095
|
{
|
|
50703
51096
|
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`,
|
|
@@ -50706,7 +51099,7 @@ var CargoIMReport = () => {
|
|
|
50706
51099
|
idx
|
|
50707
51100
|
);
|
|
50708
51101
|
}) }),
|
|
50709
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
51102
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx277("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50710
51103
|
data2.reduce(
|
|
50711
51104
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50712
51105
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50720,14 +51113,14 @@ var CargoIMReport = () => {
|
|
|
50720
51113
|
header: "Balance",
|
|
50721
51114
|
key: "runningBalance",
|
|
50722
51115
|
className: "text-xs whitespace-nowrap text-right",
|
|
50723
|
-
render: (row) => /* @__PURE__ */
|
|
50724
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
51116
|
+
render: (row) => /* @__PURE__ */ jsx277("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
51117
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx277("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50725
51118
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50726
51119
|
currency
|
|
50727
51120
|
) })
|
|
50728
51121
|
}
|
|
50729
51122
|
];
|
|
50730
|
-
const datas =
|
|
51123
|
+
const datas = useMemo57(() => {
|
|
50731
51124
|
let runningBalance = 0;
|
|
50732
51125
|
const transactions = data?.data?.transactions;
|
|
50733
51126
|
const res = (transactions || []).map((item) => {
|
|
@@ -50764,10 +51157,10 @@ var CargoIMReport = () => {
|
|
|
50764
51157
|
{ label: "Account Type", value: data?.data?.type },
|
|
50765
51158
|
{ label: "Currency", value: currencyFilter }
|
|
50766
51159
|
];
|
|
50767
|
-
return /* @__PURE__ */
|
|
50768
|
-
/* @__PURE__ */
|
|
50769
|
-
/* @__PURE__ */
|
|
50770
|
-
/* @__PURE__ */
|
|
51160
|
+
return /* @__PURE__ */ jsxs246(Fragment142, { children: [
|
|
51161
|
+
/* @__PURE__ */ jsx277(Modal2, {}),
|
|
51162
|
+
/* @__PURE__ */ jsx277(TransactionView, {}),
|
|
51163
|
+
/* @__PURE__ */ jsx277(
|
|
50771
51164
|
A4DataView,
|
|
50772
51165
|
{
|
|
50773
51166
|
columns,
|
|
@@ -50782,7 +51175,7 @@ var CargoIMReport = () => {
|
|
|
50782
51175
|
openState({
|
|
50783
51176
|
type: "debit",
|
|
50784
51177
|
closeOnOverlayClick: false,
|
|
50785
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */
|
|
51178
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ jsx277(
|
|
50786
51179
|
InvoiceForm_default2,
|
|
50787
51180
|
{
|
|
50788
51181
|
close: closeTransaction,
|
|
@@ -50790,7 +51183,7 @@ var CargoIMReport = () => {
|
|
|
50790
51183
|
onReload: reload,
|
|
50791
51184
|
id: row._id
|
|
50792
51185
|
}
|
|
50793
|
-
) : /* @__PURE__ */
|
|
51186
|
+
) : /* @__PURE__ */ jsx277(
|
|
50794
51187
|
journalForm_default2,
|
|
50795
51188
|
{
|
|
50796
51189
|
close: closeTransaction,
|
|
@@ -50803,7 +51196,7 @@ var CargoIMReport = () => {
|
|
|
50803
51196
|
width: 800
|
|
50804
51197
|
});
|
|
50805
51198
|
},
|
|
50806
|
-
headers: /* @__PURE__ */
|
|
51199
|
+
headers: /* @__PURE__ */ jsx277("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx277(
|
|
50807
51200
|
Fields_default.Select,
|
|
50808
51201
|
{
|
|
50809
51202
|
options: currencies,
|
|
@@ -50819,19 +51212,19 @@ var CargoIMReport = () => {
|
|
|
50819
51212
|
var cargoIMReport_default = CargoIMReport;
|
|
50820
51213
|
|
|
50821
51214
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50822
|
-
import { useNavigate as
|
|
51215
|
+
import { useNavigate as useNavigate68, useParams as useParams118 } from "react-router-dom";
|
|
50823
51216
|
import {
|
|
50824
|
-
EllipsisVertical as
|
|
51217
|
+
EllipsisVertical as EllipsisVertical50,
|
|
50825
51218
|
FileChartLine as FileChartLine2,
|
|
50826
|
-
FilePenLine as
|
|
50827
|
-
Trash2 as
|
|
51219
|
+
FilePenLine as FilePenLine46,
|
|
51220
|
+
Trash2 as Trash257
|
|
50828
51221
|
} from "lucide-react";
|
|
50829
51222
|
import { useState as useState121 } from "react";
|
|
50830
51223
|
import { message as message91 } from "antd";
|
|
50831
|
-
import { Fragment as
|
|
51224
|
+
import { Fragment as Fragment143, jsx as jsx278, jsxs as jsxs247 } from "react/jsx-runtime";
|
|
50832
51225
|
function Forex2Accounts({ v, url }) {
|
|
50833
|
-
const { branchId } =
|
|
50834
|
-
const navigate =
|
|
51226
|
+
const { branchId } = useParams118();
|
|
51227
|
+
const navigate = useNavigate68();
|
|
50835
51228
|
const type = "account";
|
|
50836
51229
|
const [deleteAccount, setDeleteAccount] = useState121(null);
|
|
50837
51230
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
@@ -50844,22 +51237,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50844
51237
|
const items = (data2) => [
|
|
50845
51238
|
{
|
|
50846
51239
|
label: `Currency Report`,
|
|
50847
|
-
icon: /* @__PURE__ */
|
|
51240
|
+
icon: /* @__PURE__ */ jsx278(FileChartLine2, { size: 16 }),
|
|
50848
51241
|
onClick: () => navigate(data2?._id)
|
|
50849
51242
|
},
|
|
50850
51243
|
{
|
|
50851
51244
|
label: `Edit ${type}`,
|
|
50852
|
-
icon: /* @__PURE__ */
|
|
51245
|
+
icon: /* @__PURE__ */ jsx278(FilePenLine46, { size: 16 }),
|
|
50853
51246
|
onClick: () => openState({
|
|
50854
51247
|
type: "forex account",
|
|
50855
|
-
content: /* @__PURE__ */
|
|
51248
|
+
content: /* @__PURE__ */ jsx278(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50856
51249
|
title: "Forex Account Form",
|
|
50857
51250
|
width: 800
|
|
50858
51251
|
})
|
|
50859
51252
|
},
|
|
50860
51253
|
{
|
|
50861
51254
|
label: `Delete ${type}`,
|
|
50862
|
-
icon: /* @__PURE__ */
|
|
51255
|
+
icon: /* @__PURE__ */ jsx278(Trash257, { className: "text-red-500", size: 16 }),
|
|
50863
51256
|
onClick: () => setDeleteAccount(data2)
|
|
50864
51257
|
}
|
|
50865
51258
|
].filter(Boolean);
|
|
@@ -50869,7 +51262,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50869
51262
|
header: "Name",
|
|
50870
51263
|
cell: ({ row }) => {
|
|
50871
51264
|
const account = row.original;
|
|
50872
|
-
return /* @__PURE__ */
|
|
51265
|
+
return /* @__PURE__ */ jsx278(
|
|
50873
51266
|
"span",
|
|
50874
51267
|
{
|
|
50875
51268
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50884,7 +51277,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50884
51277
|
header: "Phone",
|
|
50885
51278
|
cell: ({ row }) => {
|
|
50886
51279
|
const account = row.original;
|
|
50887
|
-
return /* @__PURE__ */
|
|
51280
|
+
return /* @__PURE__ */ jsx278("span", { children: account?.phoneNumber || "N/A" });
|
|
50888
51281
|
}
|
|
50889
51282
|
},
|
|
50890
51283
|
{
|
|
@@ -50892,14 +51285,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50892
51285
|
header: "Balances",
|
|
50893
51286
|
cell: ({ row }) => {
|
|
50894
51287
|
const account = row.original;
|
|
50895
|
-
return /* @__PURE__ */
|
|
50896
|
-
([currency, data2]) => /* @__PURE__ */
|
|
51288
|
+
return /* @__PURE__ */ jsx278("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
51289
|
+
([currency, data2]) => /* @__PURE__ */ jsxs247(
|
|
50897
51290
|
"div",
|
|
50898
51291
|
{
|
|
50899
51292
|
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",
|
|
50900
51293
|
children: [
|
|
50901
|
-
/* @__PURE__ */
|
|
50902
|
-
/* @__PURE__ */
|
|
51294
|
+
/* @__PURE__ */ jsx278("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
51295
|
+
/* @__PURE__ */ jsx278(
|
|
50903
51296
|
"span",
|
|
50904
51297
|
{
|
|
50905
51298
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50918,8 +51311,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50918
51311
|
header: "Actions",
|
|
50919
51312
|
cell: ({ row }) => {
|
|
50920
51313
|
const data2 = row.original;
|
|
50921
|
-
return /* @__PURE__ */
|
|
50922
|
-
/* @__PURE__ */
|
|
51314
|
+
return /* @__PURE__ */ jsxs247("div", { className: "flex gap-4 items-center", children: [
|
|
51315
|
+
/* @__PURE__ */ jsx278(
|
|
50923
51316
|
"button",
|
|
50924
51317
|
{
|
|
50925
51318
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50927,7 +51320,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50927
51320
|
openState({
|
|
50928
51321
|
type: "credit",
|
|
50929
51322
|
closeOnOverlayClick: false,
|
|
50930
|
-
content: /* @__PURE__ */
|
|
51323
|
+
content: /* @__PURE__ */ jsx278(
|
|
50931
51324
|
Forex2FormTransaction_default,
|
|
50932
51325
|
{
|
|
50933
51326
|
close,
|
|
@@ -50943,7 +51336,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50943
51336
|
children: "Out"
|
|
50944
51337
|
}
|
|
50945
51338
|
),
|
|
50946
|
-
/* @__PURE__ */
|
|
51339
|
+
/* @__PURE__ */ jsx278(
|
|
50947
51340
|
"button",
|
|
50948
51341
|
{
|
|
50949
51342
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50951,7 +51344,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50951
51344
|
openState({
|
|
50952
51345
|
type: "debit",
|
|
50953
51346
|
closeOnOverlayClick: false,
|
|
50954
|
-
content: /* @__PURE__ */
|
|
51347
|
+
content: /* @__PURE__ */ jsx278(
|
|
50955
51348
|
Forex2FormTransaction_default,
|
|
50956
51349
|
{
|
|
50957
51350
|
close,
|
|
@@ -50967,13 +51360,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50967
51360
|
children: "In"
|
|
50968
51361
|
}
|
|
50969
51362
|
),
|
|
50970
|
-
/* @__PURE__ */
|
|
51363
|
+
/* @__PURE__ */ jsx278(
|
|
50971
51364
|
Dropdown,
|
|
50972
51365
|
{
|
|
50973
51366
|
className: "cursor-pointer w-[150px]",
|
|
50974
51367
|
items: items(data2),
|
|
50975
51368
|
triggerMode: "hover",
|
|
50976
|
-
children: /* @__PURE__ */
|
|
51369
|
+
children: /* @__PURE__ */ jsx278(EllipsisVertical50, {})
|
|
50977
51370
|
}
|
|
50978
51371
|
)
|
|
50979
51372
|
] });
|
|
@@ -51012,9 +51405,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
51012
51405
|
};
|
|
51013
51406
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
51014
51407
|
console.log(currencies);
|
|
51015
|
-
return /* @__PURE__ */
|
|
51016
|
-
/* @__PURE__ */
|
|
51017
|
-
/* @__PURE__ */
|
|
51408
|
+
return /* @__PURE__ */ jsxs247(Fragment143, { children: [
|
|
51409
|
+
/* @__PURE__ */ jsx278(Modal2, {}),
|
|
51410
|
+
/* @__PURE__ */ jsx278(
|
|
51018
51411
|
ConfirmModal,
|
|
51019
51412
|
{
|
|
51020
51413
|
isOpen: !!deleteAccount,
|
|
@@ -51027,9 +51420,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
51027
51420
|
children: null
|
|
51028
51421
|
}
|
|
51029
51422
|
),
|
|
51030
|
-
/* @__PURE__ */
|
|
51031
|
-
/* @__PURE__ */
|
|
51032
|
-
/* @__PURE__ */
|
|
51423
|
+
/* @__PURE__ */ jsxs247("div", { children: [
|
|
51424
|
+
/* @__PURE__ */ jsx278(ForexAccountSummary_default, { currencies, isLoading }),
|
|
51425
|
+
/* @__PURE__ */ jsx278(
|
|
51033
51426
|
TransactionViewComponent,
|
|
51034
51427
|
{
|
|
51035
51428
|
columns,
|
|
@@ -51041,7 +51434,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
51041
51434
|
onCreate: () => {
|
|
51042
51435
|
openState({
|
|
51043
51436
|
type: "forex account",
|
|
51044
|
-
content: /* @__PURE__ */
|
|
51437
|
+
content: /* @__PURE__ */ jsx278(ForexAccountForm_default, { close, reloads: reload }),
|
|
51045
51438
|
title: "Forex Account Form",
|
|
51046
51439
|
width: 800
|
|
51047
51440
|
});
|
|
@@ -51054,14 +51447,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
51054
51447
|
var Forex2Accounts_default = Forex2Accounts;
|
|
51055
51448
|
|
|
51056
51449
|
// src/components/reports/ProductList.tsx
|
|
51057
|
-
import { useParams as
|
|
51058
|
-
import { Fragment as
|
|
51059
|
-
var
|
|
51450
|
+
import { useParams as useParams119 } from "react-router-dom";
|
|
51451
|
+
import { Fragment as Fragment144, jsx as jsx279, jsxs as jsxs248 } from "react/jsx-runtime";
|
|
51452
|
+
var options10 = [
|
|
51060
51453
|
{ label: "Product", value: "product" },
|
|
51061
51454
|
{ label: "Pack", value: "pack" }
|
|
51062
51455
|
];
|
|
51063
51456
|
var ProductList2 = ({ value = false }) => {
|
|
51064
|
-
const { branchId } =
|
|
51457
|
+
const { branchId } = useParams119();
|
|
51065
51458
|
const { branches } = useAuth_default();
|
|
51066
51459
|
const { TransactionView } = useTransactionView_default();
|
|
51067
51460
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -51083,7 +51476,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
51083
51476
|
key: "name",
|
|
51084
51477
|
className: "text-xs whitespace-nowrap",
|
|
51085
51478
|
render: (row) => {
|
|
51086
|
-
return /* @__PURE__ */
|
|
51479
|
+
return /* @__PURE__ */ jsx279("div", { className: "", children: /* @__PURE__ */ jsx279("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
|
|
51087
51480
|
}
|
|
51088
51481
|
},
|
|
51089
51482
|
...value ? [
|
|
@@ -51091,14 +51484,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
51091
51484
|
header: "Cost",
|
|
51092
51485
|
key: "cost",
|
|
51093
51486
|
className: "text-xs whitespace-nowrap text-right",
|
|
51094
|
-
render: (row) => /* @__PURE__ */
|
|
51487
|
+
render: (row) => /* @__PURE__ */ jsx279("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
51095
51488
|
}
|
|
51096
51489
|
] : []
|
|
51097
51490
|
];
|
|
51098
51491
|
const datas = data?.data || [];
|
|
51099
|
-
return /* @__PURE__ */
|
|
51100
|
-
/* @__PURE__ */
|
|
51101
|
-
/* @__PURE__ */
|
|
51492
|
+
return /* @__PURE__ */ jsxs248(Fragment144, { children: [
|
|
51493
|
+
/* @__PURE__ */ jsx279(TransactionView, {}),
|
|
51494
|
+
/* @__PURE__ */ jsx279(
|
|
51102
51495
|
A4DataView,
|
|
51103
51496
|
{
|
|
51104
51497
|
columns,
|
|
@@ -51108,11 +51501,10 @@ var ProductList2 = ({ value = false }) => {
|
|
|
51108
51501
|
subtitle: branchId ? currentBranch?.name : "All Branches",
|
|
51109
51502
|
tableTitle: "Stock List",
|
|
51110
51503
|
fixed: false,
|
|
51111
|
-
|
|
51112
|
-
headers: /* @__PURE__ */ jsx277(
|
|
51504
|
+
headers: /* @__PURE__ */ jsx279(
|
|
51113
51505
|
Select,
|
|
51114
51506
|
{
|
|
51115
|
-
options:
|
|
51507
|
+
options: options10,
|
|
51116
51508
|
value: stockType,
|
|
51117
51509
|
className: "w-32! print:hidden",
|
|
51118
51510
|
onChange: (e) => {
|