ptechcore_ui 1.0.8 → 1.0.10

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.cjs CHANGED
@@ -960,6 +960,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
960
960
  onClick: () => {
961
961
  if (item.path) {
962
962
  navigate(item.path);
963
+ setSecondaryCollapsed(false);
963
964
  } else {
964
965
  setSelectedModule(item.id);
965
966
  }
@@ -1763,13 +1764,14 @@ var FDrawer = ({
1763
1764
  next: null,
1764
1765
  current_page: null
1765
1766
  });
1767
+ const [searchQuery, setSearchQuery] = (0, import_react7.useState)("");
1766
1768
  const makeFilters = () => columns.reduce((acc, item) => {
1767
1769
  acc[item.formule ? `${item.search_name}__icontains` : `${item.key}__icontains`] = "";
1768
1770
  return acc;
1769
1771
  }, {});
1770
1772
  const preFilters = columns.length > 0 ? makeFilters() : [];
1771
1773
  const [filters, setFilters] = (0, import_react7.useState)(
1772
- () => Object.keys(allParams).length > 0 ? allParams : { ...preFilters, center_id: activeBusinessEntity?.id ?? null, order_by: order_by ?? "id", page: 1 }
1774
+ () => Object.keys(allParams).length > 0 ? allParams : { ...preFilters, business_entity_id: activeBusinessEntity?.id ?? null, order_by: order_by ?? "id", page: 1 }
1773
1775
  );
1774
1776
  const getDataFilter = async () => {
1775
1777
  setLoading(true);
@@ -1797,6 +1799,7 @@ var FDrawer = ({
1797
1799
  navigate(`${location.pathname}?${params}`);
1798
1800
  }, [filters]);
1799
1801
  (0, import_react7.useEffect)(() => {
1802
+ if (!activeBusinessEntity) return;
1800
1803
  getDataFilter();
1801
1804
  }, [activeBusinessEntity, queryURL, toggle]);
1802
1805
  const renderColumnFilter = (column) => {
@@ -1876,12 +1879,60 @@ var FDrawer = ({
1876
1879
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: cellContent }, column.key);
1877
1880
  });
1878
1881
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1882
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap gap-4", children: [
1883
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 min-w-64", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative", children: [
1884
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" }),
1885
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1886
+ "input",
1887
+ {
1888
+ type: "text",
1889
+ placeholder: "Rechercher une demande...",
1890
+ className: "w-full pl-10 pr-4 py-2 border border-[#d1d7de] rounded-lg focus:ring-2 focus:ring-[#78a6d2] focus:border-transparent",
1891
+ value: searchQuery,
1892
+ onChange: (e) => setSearchQuery(e.target.value)
1893
+ }
1894
+ )
1895
+ ] }) }),
1896
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1897
+ Buttons_default,
1898
+ {
1899
+ onClick: () => {
1900
+ },
1901
+ children: [
1902
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Filter, { className: "h-4 w-4 mr-2" }),
1903
+ "Filtres"
1904
+ ]
1905
+ }
1906
+ ),
1907
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1908
+ Buttons_default,
1909
+ {
1910
+ onClick: () => {
1911
+ },
1912
+ children: [
1913
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Download, { className: "h-4 w-4 mr-2" }),
1914
+ "Exporter"
1915
+ ]
1916
+ }
1917
+ ),
1918
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1919
+ Buttons_default,
1920
+ {
1921
+ onClick: () => {
1922
+ },
1923
+ children: [
1924
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Printer, { className: "h-4 w-4 mr-2" }),
1925
+ "Imprimer"
1926
+ ]
1927
+ }
1928
+ )
1929
+ ] }),
1879
1930
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("table", { className: "w-full", children: [
1880
1931
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { className: "bg-gray-50", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { children: [
1881
1932
  columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("th", { className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider relative", scope: "col", children: [
1882
1933
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex align-center items-center gap-2", children: [
1883
1934
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { onClick: () => setShowFilters(showFilters === column.key ? "" : column.key), children: column.label }),
1884
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
1935
+ column.sortable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
1885
1936
  ] }),
1886
1937
  showOrdering === column.key && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute left-6 mt-2 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-80 overflow-y-auto", role: "menu", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "p-2", children: [
1887
1938
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
package/dist/index.d.cts CHANGED
@@ -214,8 +214,8 @@ type FDrawerColumn = {
214
214
  type FDrawerLineAction = {
215
215
  label: string;
216
216
  permission: string;
217
- navigate: string;
218
- onclick: (item: any) => any;
217
+ navigate?: string;
218
+ onclick?: (item: any) => any;
219
219
  };
220
220
  interface FDrawerProps {
221
221
  children?: React.ReactNode;
package/dist/index.d.ts CHANGED
@@ -214,8 +214,8 @@ type FDrawerColumn = {
214
214
  type FDrawerLineAction = {
215
215
  label: string;
216
216
  permission: string;
217
- navigate: string;
218
- onclick: (item: any) => any;
217
+ navigate?: string;
218
+ onclick?: (item: any) => any;
219
219
  };
220
220
  interface FDrawerProps {
221
221
  children?: React.ReactNode;
package/dist/index.js CHANGED
@@ -921,6 +921,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
921
921
  onClick: () => {
922
922
  if (item.path) {
923
923
  navigate(item.path);
924
+ setSecondaryCollapsed(false);
924
925
  } else {
925
926
  setSelectedModule(item.id);
926
927
  }
@@ -1696,7 +1697,7 @@ var UserServices = {
1696
1697
  // src/components/common/FDrawer.tsx
1697
1698
  import { useEffect as useEffect5, useState as useState7 } from "react";
1698
1699
  import { useLocation as useLocation2, useNavigate as useNavigate2, useSearchParams, Link as Link2 } from "react-router-dom";
1699
- import { ArrowDownAZ, ArrowDownUp, ArrowUpAZ, MoreVertical } from "lucide-react";
1700
+ import { ArrowDownAZ, ArrowDownUp, ArrowUpAZ, Download as Download2, Filter, MoreVertical, Printer, Search as Search2 } from "lucide-react";
1700
1701
  import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1701
1702
  var FDrawer = ({
1702
1703
  children,
@@ -1724,13 +1725,14 @@ var FDrawer = ({
1724
1725
  next: null,
1725
1726
  current_page: null
1726
1727
  });
1728
+ const [searchQuery, setSearchQuery] = useState7("");
1727
1729
  const makeFilters = () => columns.reduce((acc, item) => {
1728
1730
  acc[item.formule ? `${item.search_name}__icontains` : `${item.key}__icontains`] = "";
1729
1731
  return acc;
1730
1732
  }, {});
1731
1733
  const preFilters = columns.length > 0 ? makeFilters() : [];
1732
1734
  const [filters, setFilters] = useState7(
1733
- () => Object.keys(allParams).length > 0 ? allParams : { ...preFilters, center_id: activeBusinessEntity?.id ?? null, order_by: order_by ?? "id", page: 1 }
1735
+ () => Object.keys(allParams).length > 0 ? allParams : { ...preFilters, business_entity_id: activeBusinessEntity?.id ?? null, order_by: order_by ?? "id", page: 1 }
1734
1736
  );
1735
1737
  const getDataFilter = async () => {
1736
1738
  setLoading(true);
@@ -1758,6 +1760,7 @@ var FDrawer = ({
1758
1760
  navigate(`${location.pathname}?${params}`);
1759
1761
  }, [filters]);
1760
1762
  useEffect5(() => {
1763
+ if (!activeBusinessEntity) return;
1761
1764
  getDataFilter();
1762
1765
  }, [activeBusinessEntity, queryURL, toggle]);
1763
1766
  const renderColumnFilter = (column) => {
@@ -1837,12 +1840,60 @@ var FDrawer = ({
1837
1840
  return /* @__PURE__ */ jsx10("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: cellContent }, column.key);
1838
1841
  });
1839
1842
  return /* @__PURE__ */ jsxs6(Fragment3, { children: [
1843
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap gap-4", children: [
1844
+ /* @__PURE__ */ jsx10("div", { className: "flex-1 min-w-64", children: /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
1845
+ /* @__PURE__ */ jsx10(Search2, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" }),
1846
+ /* @__PURE__ */ jsx10(
1847
+ "input",
1848
+ {
1849
+ type: "text",
1850
+ placeholder: "Rechercher une demande...",
1851
+ className: "w-full pl-10 pr-4 py-2 border border-[#d1d7de] rounded-lg focus:ring-2 focus:ring-[#78a6d2] focus:border-transparent",
1852
+ value: searchQuery,
1853
+ onChange: (e) => setSearchQuery(e.target.value)
1854
+ }
1855
+ )
1856
+ ] }) }),
1857
+ /* @__PURE__ */ jsxs6(
1858
+ Buttons_default,
1859
+ {
1860
+ onClick: () => {
1861
+ },
1862
+ children: [
1863
+ /* @__PURE__ */ jsx10(Filter, { className: "h-4 w-4 mr-2" }),
1864
+ "Filtres"
1865
+ ]
1866
+ }
1867
+ ),
1868
+ /* @__PURE__ */ jsxs6(
1869
+ Buttons_default,
1870
+ {
1871
+ onClick: () => {
1872
+ },
1873
+ children: [
1874
+ /* @__PURE__ */ jsx10(Download2, { className: "h-4 w-4 mr-2" }),
1875
+ "Exporter"
1876
+ ]
1877
+ }
1878
+ ),
1879
+ /* @__PURE__ */ jsxs6(
1880
+ Buttons_default,
1881
+ {
1882
+ onClick: () => {
1883
+ },
1884
+ children: [
1885
+ /* @__PURE__ */ jsx10(Printer, { className: "h-4 w-4 mr-2" }),
1886
+ "Imprimer"
1887
+ ]
1888
+ }
1889
+ )
1890
+ ] }),
1840
1891
  /* @__PURE__ */ jsxs6("table", { className: "w-full", children: [
1841
1892
  /* @__PURE__ */ jsx10("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxs6("tr", { children: [
1842
1893
  columns.map((column) => /* @__PURE__ */ jsxs6("th", { className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider relative", scope: "col", children: [
1843
1894
  /* @__PURE__ */ jsxs6("div", { className: "flex align-center items-center gap-2", children: [
1844
1895
  /* @__PURE__ */ jsx10("span", { onClick: () => setShowFilters(showFilters === column.key ? "" : column.key), children: column.label }),
1845
- /* @__PURE__ */ jsx10(ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
1896
+ column.sortable && /* @__PURE__ */ jsx10(ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
1846
1897
  ] }),
1847
1898
  showOrdering === column.key && /* @__PURE__ */ jsx10("div", { className: "absolute left-6 mt-2 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-80 overflow-y-auto", role: "menu", children: /* @__PURE__ */ jsxs6("div", { className: "p-2", children: [
1848
1899
  /* @__PURE__ */ jsx10(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptechcore_ui",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",