warqadui 0.0.48 → 0.0.50

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.mjs CHANGED
@@ -4497,11 +4497,371 @@ var useA4StatementView = ({
4497
4497
  };
4498
4498
  var useA4DataView_default = useA4StatementView;
4499
4499
 
4500
+ // src/hooks/Fetches/useA4CategoryView.tsx
4501
+ import { useEffect as useEffect12, useRef as useRef7, useState as useState17 } from "react";
4502
+ import { useReactToPrint as useReactToPrint2 } from "react-to-print";
4503
+ import {
4504
+ RefreshCw as RefreshCw2,
4505
+ Printer as Printer2,
4506
+ AlertCircle as AlertCircle2,
4507
+ FileX as FileX2,
4508
+ ChevronLeft as ChevronLeft2,
4509
+ ChevronRight as ChevronRight3
4510
+ } from "lucide-react";
4511
+ import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
4512
+ var useA4CategoryView = ({
4513
+ url,
4514
+ v = 1,
4515
+ delay,
4516
+ params,
4517
+ startPage = 1
4518
+ } = {}) => {
4519
+ const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4520
+ const contentRef = useRef7(null);
4521
+ const reactToPrintFn = useReactToPrint2({
4522
+ contentRef
4523
+ });
4524
+ const getData = async () => {
4525
+ if (url) {
4526
+ await get({ url, v, params, delay });
4527
+ }
4528
+ };
4529
+ useEffect12(() => {
4530
+ getData();
4531
+ }, [url, v, JSON.stringify(params), delay]);
4532
+ const A4CategoryView = ({
4533
+ data,
4534
+ groups: incomingGroups,
4535
+ error = apiError,
4536
+ info,
4537
+ title = "Inventory Report",
4538
+ subtitle = "Official Category List",
4539
+ printable = true,
4540
+ gridTitle = "Items List",
4541
+ startPage: componentStartPage = startPage,
4542
+ isLoading: externalLoading,
4543
+ renderItem,
4544
+ gridColumns = 4
4545
+ }) => {
4546
+ const { store } = useWarqadConfig();
4547
+ const isActuallyLoading = externalLoading ?? isLoading;
4548
+ const measureContainerRef = useRef7(null);
4549
+ const [pages, setPages] = useState17([]);
4550
+ const [isMeasuring, setIsMeasuring] = useState17(true);
4551
+ const [globalFilter, setGlobalFilter] = useState17("");
4552
+ const [currentPageIndex, setCurrentPageIndex] = useState17(0);
4553
+ const [pageSearch, setPageSearch] = useState17("");
4554
+ const groups = incomingGroups ? [...incomingGroups].sort(
4555
+ (a, b) => a.title.localeCompare(b.title)
4556
+ ) : data ? [{ title: gridTitle, items: data }] : [];
4557
+ const flattenedNodes = groups.map((group) => {
4558
+ const sortedItems = [...group.items].sort(
4559
+ (a, b) => String(a.name).localeCompare(String(b.name))
4560
+ );
4561
+ const filteredItems = sortedItems.filter((row) => {
4562
+ if (!globalFilter) return true;
4563
+ const lowerFilter = globalFilter.toLowerCase();
4564
+ return Object.values(row).some(
4565
+ (val) => String(val).toLowerCase().includes(lowerFilter)
4566
+ );
4567
+ });
4568
+ if (filteredItems.length === 0) return [];
4569
+ const nodes = [{ type: "header", title: group.title }];
4570
+ const rows = Array.from(
4571
+ { length: Math.ceil(filteredItems.length / gridColumns) },
4572
+ (_, i) => filteredItems.slice(i * gridColumns, i * gridColumns + gridColumns)
4573
+ );
4574
+ rows.forEach((rowItems) => {
4575
+ nodes.push({ type: "row", items: rowItems });
4576
+ });
4577
+ return nodes;
4578
+ }).flat();
4579
+ const depsString = JSON.stringify({
4580
+ nodeCount: flattenedNodes.length,
4581
+ gridColumns,
4582
+ globalFilter
4583
+ });
4584
+ useEffect12(() => {
4585
+ if (flattenedNodes.length > 0) {
4586
+ setIsMeasuring(true);
4587
+ setPages((prev) => prev.length === 0 ? [[]] : prev);
4588
+ if (componentStartPage !== -1) {
4589
+ setCurrentPageIndex(Math.max(0, componentStartPage - 1));
4590
+ }
4591
+ } else {
4592
+ setIsMeasuring(false);
4593
+ setPages([[]]);
4594
+ setCurrentPageIndex(0);
4595
+ }
4596
+ }, [depsString]);
4597
+ useEffect12(() => {
4598
+ if (!isMeasuring || flattenedNodes.length === 0) return;
4599
+ const timer = setTimeout(() => {
4600
+ if (!measureContainerRef.current) return;
4601
+ const container = measureContainerRef.current;
4602
+ const headerEl = container.querySelector("#a4-header-section");
4603
+ const infoGridEl = container.querySelector("#a4-info-grid");
4604
+ const nodeEls = container.querySelectorAll(".a4-measure-node");
4605
+ const getH = (el) => el ? el.offsetHeight : 0;
4606
+ const headerHeight = getH(headerEl);
4607
+ const infoGridHeight = getH(infoGridEl);
4608
+ let currentChunks = [];
4609
+ let currentChunk = [];
4610
+ let currentHeight = headerHeight + infoGridHeight + 20;
4611
+ Array.from(nodeEls).forEach((node, i) => {
4612
+ const nodeHeight = getH(node);
4613
+ const currentPageLimit = currentChunks.length === 0 ? 940 : 980;
4614
+ if (currentHeight + nodeHeight > currentPageLimit) {
4615
+ if (currentChunk.length > 0) {
4616
+ currentChunks.push([...currentChunk]);
4617
+ currentChunk = [];
4618
+ currentHeight = 80;
4619
+ }
4620
+ }
4621
+ currentChunk.push(flattenedNodes[i]);
4622
+ currentHeight += nodeHeight + 4;
4623
+ });
4624
+ if (currentChunk.length > 0) {
4625
+ currentChunks.push([...currentChunk]);
4626
+ }
4627
+ const finalPages = currentChunks.length > 0 ? currentChunks : [[]];
4628
+ setPages(finalPages);
4629
+ if (componentStartPage === -1) {
4630
+ setCurrentPageIndex(finalPages.length - 1);
4631
+ }
4632
+ setIsMeasuring(false);
4633
+ }, 150);
4634
+ return () => clearTimeout(timer);
4635
+ }, [isMeasuring, depsString]);
4636
+ const HeaderEl = /* @__PURE__ */ jsxs21(
4637
+ "div",
4638
+ {
4639
+ className: "flex justify-between items-start mb-5 px-8 pt-8",
4640
+ id: "a4-header-section",
4641
+ children: [
4642
+ /* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx29("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs21("section", { children: [
4643
+ /* @__PURE__ */ jsx29("h1", { className: "text-4xl font-black text-black dark:text-white print:text-black tracking-tighter uppercase", children: title }),
4644
+ /* @__PURE__ */ jsx29("p", { className: "text-gray-600 dark:text-gray-400 print:text-gray-600 mt-1 uppercase text-xs font-bold tracking-widest", children: subtitle })
4645
+ ] }) }) }),
4646
+ /* @__PURE__ */ jsxs21("div", { className: "text-right", children: [
4647
+ /* @__PURE__ */ jsx29("h2", { className: "text-lg font-black text-black dark:text-white print:text-black uppercase tracking-tight", children: store?.name }),
4648
+ /* @__PURE__ */ jsxs21("div", { className: "text-sm text-gray-600 dark:text-gray-400 print:text-gray-600 leading-relaxed text-right flex flex-col items-end font-medium", children: [
4649
+ store?.address && /* @__PURE__ */ jsx29("span", { className: "whitespace-pre-line", children: store.address }),
4650
+ store?.phone && /* @__PURE__ */ jsx29("span", { children: store.phone }),
4651
+ store?.email && /* @__PURE__ */ jsx29("span", { children: store.email })
4652
+ ] })
4653
+ ] })
4654
+ ]
4655
+ }
4656
+ );
4657
+ const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx29("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx29(
4658
+ InfoGrid,
4659
+ {
4660
+ className: "mb-4",
4661
+ items: info,
4662
+ isLoading: isActuallyLoading
4663
+ }
4664
+ ) }) : null;
4665
+ const renderNode = (node) => {
4666
+ if (node.type === "header") {
4667
+ return /* @__PURE__ */ jsx29("div", { className: "mb-4 border-b border-black print:border-black pb-2 flex items-center gap-2 justify-between px-2 mt-4", children: /* @__PURE__ */ jsx29("h3", { className: "text-sm font-black text-black dark:text-white print:text-black uppercase tracking-[0.2em]", children: node.title }) });
4668
+ }
4669
+ return /* @__PURE__ */ jsx29(
4670
+ "div",
4671
+ {
4672
+ className: "grid gap-4 px-2",
4673
+ style: { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` },
4674
+ children: node.items.map((item, j) => /* @__PURE__ */ jsx29("div", { children: renderItem(item) }, j))
4675
+ }
4676
+ );
4677
+ };
4678
+ const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */ jsx29("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4679
+ isActuallyLoading ? /* @__PURE__ */ jsx29("div", { className: "mb-4", children: /* @__PURE__ */ jsx29(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx29("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx29(AlertCircle2, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx29("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx29(FileX2, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4680
+ /* @__PURE__ */ jsx29("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Report" : "No Records Found" }),
4681
+ /* @__PURE__ */ jsx29("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your report." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no items available in this requested report." }),
4682
+ url && !isActuallyLoading && /* @__PURE__ */ jsxs21(
4683
+ "button",
4684
+ {
4685
+ onClick: () => getData(),
4686
+ className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4687
+ children: [
4688
+ /* @__PURE__ */ jsx29(RefreshCw2, { size: 14 }),
4689
+ "Try Again"
4690
+ ]
4691
+ }
4692
+ )
4693
+ ] }) }) : null;
4694
+ return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col relative w-full items-center", children: [
4695
+ isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */ jsx29("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx29(
4696
+ "div",
4697
+ {
4698
+ style: { width: "210mm", boxSizing: "border-box" },
4699
+ className: "bg-white",
4700
+ children: /* @__PURE__ */ jsxs21(
4701
+ "div",
4702
+ {
4703
+ ref: measureContainerRef,
4704
+ className: "flex flex-col w-full h-full",
4705
+ children: [
4706
+ HeaderEl,
4707
+ DisplayInfoGridEl,
4708
+ /* @__PURE__ */ jsx29("div", { className: "grow w-full px-8 pb-8", children: /* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-2", children: flattenedNodes.map((node, i) => /* @__PURE__ */ jsx29("div", { className: "a4-measure-node", children: renderNode(node) }, i)) }) })
4709
+ ]
4710
+ }
4711
+ )
4712
+ }
4713
+ ) }),
4714
+ /* @__PURE__ */ jsx29("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageNodes, pageIndex) => /* @__PURE__ */ jsx29(
4715
+ "div",
4716
+ {
4717
+ className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
4718
+ children: /* @__PURE__ */ jsx29(
4719
+ PageA4,
4720
+ {
4721
+ className: "w-full",
4722
+ pageNumber: pageIndex + 1,
4723
+ totalPages: pages.length,
4724
+ isLastPage: pageIndex === pages.length - 1,
4725
+ children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col h-full grow w-full", children: [
4726
+ /* @__PURE__ */ jsx29("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
4727
+ /* @__PURE__ */ jsxs21(
4728
+ "button",
4729
+ {
4730
+ onClick: async () => await getData(),
4731
+ disabled: isLoading,
4732
+ className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
4733
+ children: [
4734
+ /* @__PURE__ */ jsx29(
4735
+ RefreshCw2,
4736
+ {
4737
+ size: 16,
4738
+ className: isLoading ? "animate-spin" : ""
4739
+ }
4740
+ ),
4741
+ /* @__PURE__ */ jsx29("span", { className: "text-xs font-semibold", children: "Reload" })
4742
+ ]
4743
+ }
4744
+ ),
4745
+ /* @__PURE__ */ jsxs21(
4746
+ "button",
4747
+ {
4748
+ onClick: () => reactToPrintFn(),
4749
+ className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
4750
+ children: [
4751
+ /* @__PURE__ */ jsx29(Printer2, { size: 16 }),
4752
+ "Print"
4753
+ ]
4754
+ }
4755
+ ),
4756
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
4757
+ /* @__PURE__ */ jsx29(
4758
+ "button",
4759
+ {
4760
+ onClick: (e) => {
4761
+ e.stopPropagation();
4762
+ setCurrentPageIndex(
4763
+ (p) => Math.max(0, p - 1)
4764
+ );
4765
+ },
4766
+ disabled: currentPageIndex === 0,
4767
+ className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4768
+ children: /* @__PURE__ */ jsx29(ChevronLeft2, { size: 18 })
4769
+ }
4770
+ ),
4771
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
4772
+ /* @__PURE__ */ jsxs21(
4773
+ Select,
4774
+ {
4775
+ value: currentPageIndex + 1,
4776
+ onChange: (val) => {
4777
+ const num = Number(val);
4778
+ if (!isNaN(num)) {
4779
+ setCurrentPageIndex(num - 1);
4780
+ }
4781
+ },
4782
+ variant: "ghost",
4783
+ containerClassName: "inline-block",
4784
+ children: [
4785
+ /* @__PURE__ */ jsx29(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ jsx29("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
4786
+ /* @__PURE__ */ jsxs21(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
4787
+ /* @__PURE__ */ jsx29("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ jsx29(
4788
+ "input",
4789
+ {
4790
+ type: "text",
4791
+ placeholder: "Page...",
4792
+ className: "w-full px-2 py-1 text-[11px] border rounded bg-gray-50 dark:bg-zinc-900 border-gray-200 dark:border-zinc-800 outline-none focus:ring-1 focus:ring-blue-500 text-gray-900 dark:text-white",
4793
+ value: pageSearch,
4794
+ onChange: (e) => setPageSearch(e.target.value),
4795
+ onKeyDown: (e) => e.stopPropagation(),
4796
+ autoFocus: true
4797
+ }
4798
+ ) }),
4799
+ /* @__PURE__ */ jsx29("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
4800
+ (p) => String(p).includes(pageSearch)
4801
+ ).map((p) => /* @__PURE__ */ jsx29(SelectItem, { value: p, children: p }, p)) })
4802
+ ] })
4803
+ ]
4804
+ }
4805
+ ),
4806
+ /* @__PURE__ */ jsx29("span", { className: "text-gray-400 mx-0.5", children: "/" }),
4807
+ /* @__PURE__ */ jsx29("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
4808
+ ] }),
4809
+ /* @__PURE__ */ jsx29(
4810
+ "button",
4811
+ {
4812
+ onClick: (e) => {
4813
+ e.stopPropagation();
4814
+ setCurrentPageIndex(
4815
+ (p) => Math.min(pages.length - 1, p + 1)
4816
+ );
4817
+ },
4818
+ disabled: currentPageIndex === pages.length - 1,
4819
+ className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
4820
+ children: /* @__PURE__ */ jsx29(ChevronRight3, { size: 18 })
4821
+ }
4822
+ )
4823
+ ] })
4824
+ ] }) }) }),
4825
+ pageIndex === 0 && HeaderEl,
4826
+ pageIndex === 0 && DisplayInfoGridEl,
4827
+ /* @__PURE__ */ jsxs21("div", { className: "grow w-full px-8 pb-8", children: [
4828
+ pageIndex === 0 && /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-end px-2 mt-2 print:hidden mb-4", children: /* @__PURE__ */ jsx29(
4829
+ "input",
4830
+ {
4831
+ type: "text",
4832
+ value: globalFilter,
4833
+ onChange: (e) => setGlobalFilter(e.target.value),
4834
+ placeholder: "Global Search...",
4835
+ className: "block w-full max-w-xs px-3 py-2 border border-gray-300 rounded-md text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-900 dark:border-zinc-700 dark:text-white"
4836
+ }
4837
+ ) }),
4838
+ pageIndex > 0 && /* @__PURE__ */ jsx29("div", { className: "h-14 print:h-14" }),
4839
+ statusOverlay ? /* @__PURE__ */ jsx29("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-2", children: pageNodes.map((node, i) => /* @__PURE__ */ jsx29("div", { children: renderNode(node) }, i)) })
4840
+ ] })
4841
+ ] })
4842
+ },
4843
+ pageIndex
4844
+ )
4845
+ },
4846
+ pageIndex
4847
+ )) }) })
4848
+ ] });
4849
+ };
4850
+ return {
4851
+ A4CategoryView,
4852
+ data: apiData,
4853
+ isLoading,
4854
+ get,
4855
+ reactToPrintFn
4856
+ };
4857
+ };
4858
+ var useA4CategoryView_default = useA4CategoryView;
4859
+
4500
4860
  // src/hooks/Fetches/useTransaction.tsx
4501
- import { useEffect as useEffect12, useState as useState17 } from "react";
4502
- import { AlertCircle as AlertCircle2, FileX as FileX2, Plus as Plus2, RefreshCw as RefreshCw2 } from "lucide-react";
4861
+ import { useEffect as useEffect13, useState as useState18 } from "react";
4862
+ import { AlertCircle as AlertCircle3, FileX as FileX3, Plus as Plus2, RefreshCw as RefreshCw3 } from "lucide-react";
4503
4863
  import moment from "moment";
4504
- import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
4864
+ import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
4505
4865
  var useTransaction = ({
4506
4866
  url,
4507
4867
  v = 1,
@@ -4509,14 +4869,13 @@ var useTransaction = ({
4509
4869
  params = {},
4510
4870
  dateFilter = true
4511
4871
  }) => {
4512
- const [date, setDate] = useState17(
4872
+ const [date, setDate] = useState18(
4513
4873
  moment().format("DD/MM/YYYY")
4514
4874
  );
4515
4875
  const dateObj = {};
4516
4876
  if (date && dateFilter) dateObj.date = date;
4517
4877
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
4518
4878
  const getData = () => {
4519
- console.log(dateObj);
4520
4879
  get({
4521
4880
  url,
4522
4881
  v,
@@ -4527,7 +4886,7 @@ var useTransaction = ({
4527
4886
  delay
4528
4887
  });
4529
4888
  };
4530
- useEffect12(() => {
4889
+ useEffect13(() => {
4531
4890
  getData();
4532
4891
  }, [url, v, JSON.stringify(params), delay, date]);
4533
4892
  const TransactionViewComponent = ({
@@ -4554,21 +4913,21 @@ var useTransaction = ({
4554
4913
  createTitle = "Add New",
4555
4914
  ...rest
4556
4915
  }) => {
4557
- const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx29(
4916
+ const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx30(
4558
4917
  "div",
4559
4918
  {
4560
4919
  className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
4561
- children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4562
- error ? /* @__PURE__ */ jsx29("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx29(AlertCircle2, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx29("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx29(FileX2, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4563
- /* @__PURE__ */ jsx29("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
4564
- /* @__PURE__ */ jsx29("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
4565
- url && /* @__PURE__ */ jsxs21(
4920
+ children: /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
4921
+ error ? /* @__PURE__ */ jsx30("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx30(AlertCircle3, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx30("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx30(FileX3, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
4922
+ /* @__PURE__ */ jsx30("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
4923
+ /* @__PURE__ */ jsx30("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
4924
+ url && /* @__PURE__ */ jsxs22(
4566
4925
  "button",
4567
4926
  {
4568
4927
  onClick: () => getData(),
4569
4928
  className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
4570
4929
  children: [
4571
- /* @__PURE__ */ jsx29(RefreshCw2, { size: 14 }),
4930
+ /* @__PURE__ */ jsx30(RefreshCw3, { size: 14 }),
4572
4931
  "Try Again"
4573
4932
  ]
4574
4933
  }
@@ -4576,14 +4935,14 @@ var useTransaction = ({
4576
4935
  ] })
4577
4936
  }
4578
4937
  ) : void 0;
4579
- return /* @__PURE__ */ jsxs21(Card, { children: [
4580
- /* @__PURE__ */ jsx29(Card.Header, { children: /* @__PURE__ */ jsxs21("header", { className: "flex items-center justify-between gap-4 py-2", children: [
4581
- /* @__PURE__ */ jsxs21("div", { className: "space-y-1", children: [
4582
- /* @__PURE__ */ jsx29(Card.Title, { children: title }),
4583
- /* @__PURE__ */ jsx29(Card.Description, { children: description })
4938
+ return /* @__PURE__ */ jsxs22(Card, { children: [
4939
+ /* @__PURE__ */ jsx30(Card.Header, { children: /* @__PURE__ */ jsxs22("header", { className: "flex items-center justify-between gap-4 py-2", children: [
4940
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-1", children: [
4941
+ /* @__PURE__ */ jsx30(Card.Title, { children: title }),
4942
+ /* @__PURE__ */ jsx30(Card.Description, { children: description })
4584
4943
  ] }),
4585
- /* @__PURE__ */ jsxs21("section", { className: "flex gap-2 items-center", children: [
4586
- dateFilter && /* @__PURE__ */ jsx29(
4944
+ /* @__PURE__ */ jsxs22("section", { className: "flex gap-2 items-center", children: [
4945
+ dateFilter && /* @__PURE__ */ jsx30(
4587
4946
  Fields_default.DateInput,
4588
4947
  {
4589
4948
  value: date,
@@ -4593,20 +4952,20 @@ var useTransaction = ({
4593
4952
  }
4594
4953
  }
4595
4954
  ),
4596
- /* @__PURE__ */ jsx29(
4955
+ /* @__PURE__ */ jsx30(
4597
4956
  Button,
4598
4957
  {
4599
4958
  size: "sm",
4600
4959
  className: "rounded-md!",
4601
4960
  onClick: onCreate,
4602
4961
  variant: "primary",
4603
- icon: /* @__PURE__ */ jsx29(Plus2, {}),
4962
+ icon: /* @__PURE__ */ jsx30(Plus2, {}),
4604
4963
  children: createTitle
4605
4964
  }
4606
4965
  )
4607
4966
  ] })
4608
4967
  ] }) }),
4609
- /* @__PURE__ */ jsx29(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx29("div", { className: `w-full ${className}`, children: /* @__PURE__ */ jsx29(
4968
+ /* @__PURE__ */ jsx30(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx30("div", { className: `w-full ${className}`, children: /* @__PURE__ */ jsx30(
4610
4969
  DataTable,
4611
4970
  {
4612
4971
  columns,
@@ -4823,7 +5182,7 @@ var storage = {
4823
5182
  };
4824
5183
 
4825
5184
  // src/hooks/uploads/useAntdImageUpload.tsx
4826
- import { useState as useState18 } from "react";
5185
+ import { useState as useState19 } from "react";
4827
5186
 
4828
5187
  // ../../node_modules/@ant-design/icons/es/components/Context.js
4829
5188
  import { createContext as createContext5 } from "react";
@@ -5870,7 +6229,7 @@ warningOnce.resetWarned = resetWarned;
5870
6229
  warningOnce.noteOnce = noteOnce;
5871
6230
 
5872
6231
  // ../../node_modules/@ant-design/icons/es/utils.js
5873
- import React12, { useContext as useContext5, useEffect as useEffect13 } from "react";
6232
+ import React12, { useContext as useContext5, useEffect as useEffect14 } from "react";
5874
6233
  function camelCase(input) {
5875
6234
  return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
5876
6235
  }
@@ -5989,7 +6348,7 @@ var useInsertStyles = (eleRef) => {
5989
6348
  ${mergedStyleStr}
5990
6349
  }`;
5991
6350
  }
5992
- useEffect13(() => {
6351
+ useEffect14(() => {
5993
6352
  const ele = eleRef.current;
5994
6353
  const shadowRoot = getShadowRoot(ele);
5995
6354
  updateCSS(mergedStyleStr, "@ant-design-icons", {
@@ -6186,7 +6545,7 @@ var PlusOutlined_default2 = RefIcon;
6186
6545
 
6187
6546
  // src/hooks/uploads/useAntdImageUpload.tsx
6188
6547
  import { Image, Upload } from "antd";
6189
- import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
6548
+ import { Fragment as Fragment7, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
6190
6549
  var getBase64 = (file) => new Promise((resolve, reject) => {
6191
6550
  const reader = new FileReader();
6192
6551
  reader.readAsDataURL(file);
@@ -6194,9 +6553,9 @@ var getBase64 = (file) => new Promise((resolve, reject) => {
6194
6553
  reader.onerror = (error) => reject(error);
6195
6554
  });
6196
6555
  var useAntdImageUpload = ({ length = 1 }) => {
6197
- const [fileList, setFileList] = useState18([]);
6198
- const [previewOpen, setPreviewOpen] = useState18(false);
6199
- const [previewImage, setPreviewImage] = useState18("");
6556
+ const [fileList, setFileList] = useState19([]);
6557
+ const [previewOpen, setPreviewOpen] = useState19(false);
6558
+ const [previewImage, setPreviewImage] = useState19("");
6200
6559
  const handlePreview = async (file) => {
6201
6560
  if (!file.url && !file.preview) {
6202
6561
  file.preview = await getBase64(file.originFileObj);
@@ -6213,8 +6572,8 @@ var useAntdImageUpload = ({ length = 1 }) => {
6213
6572
  }))
6214
6573
  );
6215
6574
  };
6216
- const ImageBox = () => /* @__PURE__ */ jsxs22(Fragment7, { children: [
6217
- /* @__PURE__ */ jsx30(
6575
+ const ImageBox = () => /* @__PURE__ */ jsxs23(Fragment7, { children: [
6576
+ /* @__PURE__ */ jsx31(
6218
6577
  Upload,
6219
6578
  {
6220
6579
  listType: "picture-card",
@@ -6222,13 +6581,13 @@ var useAntdImageUpload = ({ length = 1 }) => {
6222
6581
  onPreview: handlePreview,
6223
6582
  onChange: handleChange,
6224
6583
  beforeUpload: () => false,
6225
- children: fileList.length >= length ? null : /* @__PURE__ */ jsxs22("button", { style: { border: 0, background: "none" }, type: "button", children: [
6226
- /* @__PURE__ */ jsx30(PlusOutlined_default2, {}),
6227
- /* @__PURE__ */ jsx30("div", { style: { marginTop: 8 }, children: "Upload" })
6584
+ children: fileList.length >= length ? null : /* @__PURE__ */ jsxs23("button", { style: { border: 0, background: "none" }, type: "button", children: [
6585
+ /* @__PURE__ */ jsx31(PlusOutlined_default2, {}),
6586
+ /* @__PURE__ */ jsx31("div", { style: { marginTop: 8 }, children: "Upload" })
6228
6587
  ] })
6229
6588
  }
6230
6589
  ),
6231
- previewImage && /* @__PURE__ */ jsx30(
6590
+ previewImage && /* @__PURE__ */ jsx31(
6232
6591
  Image,
6233
6592
  {
6234
6593
  style: { display: "none" },
@@ -6244,6 +6603,51 @@ var useAntdImageUpload = ({ length = 1 }) => {
6244
6603
  return { ImageBox, fileList, setFileList };
6245
6604
  };
6246
6605
  var useAntdImageUpload_default = useAntdImageUpload;
6606
+
6607
+ // src/components/Views/CategoryView.tsx
6608
+ import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
6609
+ var CategoryCard = ({ item }) => {
6610
+ return /* @__PURE__ */ jsxs24("div", { className: "group bg-white rounded-md overflow-hidden border border-black/80 flex flex-col h-full print:border-black transition-all duration-300", children: [
6611
+ /* @__PURE__ */ jsx32("div", { className: "relative aspect-square w-full overflow-hidden bg-gray-50 flex-shrink-0 border-b border-black/10", children: /* @__PURE__ */ jsx32(
6612
+ "img",
6613
+ {
6614
+ src: item.image,
6615
+ alt: item.name,
6616
+ className: "w-full h-full object-cover"
6617
+ }
6618
+ ) }),
6619
+ /* @__PURE__ */ jsx32("div", { className: "p-1.5 flex flex-col justify-center flex-grow", children: /* @__PURE__ */ jsx32("h3", { className: "text-[10px] font-bold text-black line-clamp-2 leading-tight text-center", children: item.name }) })
6620
+ ] });
6621
+ };
6622
+ var CategoryView = ({
6623
+ categoryName,
6624
+ items,
6625
+ className
6626
+ }) => {
6627
+ return /* @__PURE__ */ jsx32("div", { className: cn("p-6 bg-gray-50 min-h-full", className), children: /* @__PURE__ */ jsxs24("div", { className: "max-w-7xl mx-auto", children: [
6628
+ /* @__PURE__ */ jsxs24("div", { className: "mb-8", children: [
6629
+ /* @__PURE__ */ jsx32("h2", { className: "text-2xl md:text-3xl font-bold text-gray-900 tracking-tight", children: categoryName }),
6630
+ /* @__PURE__ */ jsx32("div", { className: "mt-2 h-1.5 w-16 bg-green-500 rounded-full" })
6631
+ ] }),
6632
+ /* @__PURE__ */ jsx32("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6", children: items.map((item) => /* @__PURE__ */ jsx32(CategoryCard, { item }, item.id)) })
6633
+ ] }) });
6634
+ };
6635
+ var CategoryView_default = CategoryView;
6636
+
6637
+ // src/components/Views/Transaction.tsx
6638
+ import { jsx as jsx33 } from "react/jsx-runtime";
6639
+ var Transaction = () => {
6640
+ return /* @__PURE__ */ jsx33("div", { children: "Transaction" });
6641
+ };
6642
+ var Transaction_default = Transaction;
6643
+
6644
+ // src/components/Views/index.tsx
6645
+ var Views = {
6646
+ Transaction: Transaction_default,
6647
+ CategoryView: CategoryView_default,
6648
+ CategoryCard
6649
+ };
6650
+ var Views_default = Views;
6247
6651
  export {
6248
6652
  Badge,
6249
6653
  Branding,
@@ -6254,6 +6658,7 @@ export {
6254
6658
  CardFooter,
6255
6659
  CardHeader,
6256
6660
  CardTitle,
6661
+ CategoryCard,
6257
6662
  ClassicSpin,
6258
6663
  CodeBlock,
6259
6664
  DashboardLayout,
@@ -6283,9 +6688,11 @@ export {
6283
6688
  Textarea,
6284
6689
  ThemeProvider,
6285
6690
  ThemeToggle,
6691
+ Views_default as Views,
6286
6692
  WarqadProvider,
6287
6693
  generatePdf,
6288
6694
  storage,
6695
+ useA4CategoryView_default as useA4CategoryView,
6289
6696
  useA4DataView_default as useA4StatementView,
6290
6697
  useAntdImageUpload_default as useAntdImageUpload,
6291
6698
  useApis_default as useApi,