ptechcore_ui 1.0.16 → 1.0.17

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.js CHANGED
@@ -611,8 +611,9 @@ var ThemeContext_default = ThemeProvider;
611
611
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect2, useState as useState2 } from "react";
612
612
 
613
613
  // src/services/api.ts
614
- var ADDRESS_IP = "localhost:8000";
615
- var ADDRESS_IP_URL = `http://${ADDRESS_IP}/`;
614
+ var chooseEnv = localStorage.getItem("env") ?? "prod";
615
+ var ADDRESS_IP = chooseEnv === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
616
+ var ADDRESS_IP_URL = chooseEnv === "prod" ? `https://${ADDRESS_IP}/` : `http://${ADDRESS_IP}/`;
616
617
  var API_URL = `${ADDRESS_IP_URL}api`;
617
618
  var FetchApi = class {
618
619
  static async post(url, payload, token) {
@@ -705,6 +706,8 @@ var SessionProvider = ({ children }) => {
705
706
  const [loggedUser, setLoggedUser] = useState2(null);
706
707
  const [activeBusinessEntity, setActiveBusinessEntity] = useState2(null);
707
708
  const saved_center_id = localStorage.getItem("active_center_id") || "";
709
+ const [isLoading, setIsLoading] = useState2(true);
710
+ const [showAuthModal, setShowAuthModal] = useState2(false);
708
711
  useEffect2(() => {
709
712
  const storedToken = localStorage.getItem("token");
710
713
  if (storedToken) {
@@ -746,7 +749,9 @@ var SessionProvider = ({ children }) => {
746
749
  setActiveBusinessEntity,
747
750
  token,
748
751
  login,
749
- logout
752
+ logout,
753
+ showAuthModal,
754
+ setShowAuthModal
750
755
  }, children });
751
756
  };
752
757
 
@@ -1615,99 +1620,101 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1615
1620
  }
1616
1621
  )
1617
1622
  ] }),
1618
- mobileMenuOpen && /* @__PURE__ */ jsx9(
1619
- "div",
1620
- {
1621
- className: "fixed inset-0 bg-black bg-opacity-50 z-50 lg:hidden",
1622
- onClick: () => setMobileMenuOpen(false),
1623
- "aria-hidden": "true",
1624
- children: /* @__PURE__ */ jsxs5(
1625
- "aside",
1626
- {
1627
- className: "w-80 h-full bg-[var(--color-sidebar-bg)]",
1628
- onClick: (e) => e.stopPropagation(),
1629
- role: "navigation",
1630
- "aria-label": "Navigation mobile",
1631
- children: [
1632
- /* @__PURE__ */ jsxs5("div", { className: "h-16 flex items-center justify-between px-4 border-b border-[var(--color-sidebar-border)]", children: [
1633
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
1634
- /* @__PURE__ */ jsx9("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx9("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
1635
- /* @__PURE__ */ jsxs5("div", { children: [
1636
- /* @__PURE__ */ jsx9("h1", { className: "text-white font-bold text-lg", children: "WiseBook" }),
1637
- /* @__PURE__ */ jsx9("p", { className: "text-gray-400 text-xs", children: "ERP Next-Gen" })
1638
- ] })
1639
- ] }),
1640
- /* @__PURE__ */ jsx9(
1641
- "button",
1642
- {
1643
- onClick: () => setMobileMenuOpen(false),
1644
- className: "text-[var(--color-sidebar-text-secondary)]",
1645
- "aria-label": "Fermer le menu",
1646
- children: /* @__PURE__ */ jsx9(X2, { className: "w-6 h-6" })
1647
- }
1648
- )
1623
+ mobileMenuOpen && /* @__PURE__ */ jsxs5(Fragment2, { children: [
1624
+ /* @__PURE__ */ jsx9(
1625
+ "div",
1626
+ {
1627
+ className: "fixed inset-0 bg-white z-40 lg:hidden",
1628
+ onClick: () => setMobileMenuOpen(false),
1629
+ "aria-hidden": "true"
1630
+ }
1631
+ ),
1632
+ /* @__PURE__ */ jsxs5(
1633
+ "aside",
1634
+ {
1635
+ className: "fixed left-0 top-0 w-80 h-full bg-[var(--color-sidebar-bg)] z-50 lg:hidden transform transition-transform duration-300 ease-in-out shadow-2xl",
1636
+ onClick: (e) => e.stopPropagation(),
1637
+ role: "navigation",
1638
+ "aria-label": "Navigation mobile",
1639
+ children: [
1640
+ /* @__PURE__ */ jsxs5("div", { className: "h-16 flex items-center justify-between px-4 border-b border-[var(--color-sidebar-border)]", children: [
1641
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
1642
+ /* @__PURE__ */ jsx9("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx9("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
1643
+ /* @__PURE__ */ jsxs5("div", { children: [
1644
+ /* @__PURE__ */ jsx9("h1", { className: "text-white font-bold text-lg", children: "WiseBook" }),
1645
+ /* @__PURE__ */ jsx9("p", { className: "text-gray-400 text-xs", children: "ERP Next-Gen" })
1646
+ ] })
1649
1647
  ] }),
1650
- /* @__PURE__ */ jsx9("nav", { className: "py-4", role: "menubar", children: primaryMenuItems.map((item) => /* @__PURE__ */ jsxs5("div", { children: [
1651
- /* @__PURE__ */ jsxs5(
1652
- "button",
1653
- {
1654
- onClick: () => {
1655
- if (item.path) {
1656
- navigate(item.path);
1657
- setMobileMenuOpen(false);
1658
- } else {
1659
- setSelectedModule(item.id);
1660
- }
1661
- },
1662
- className: cn(
1663
- "w-full flex items-center gap-3 px-4 py-3 transition-all duration-200",
1664
- "hover:bg-[var(--color-sidebar-hover)]",
1665
- isModuleActive(item.id) && "bg-[var(--color-sidebar-active)] border-l-4 border-[var(--color-primary)]"
1666
- ),
1667
- role: "menuitem",
1668
- "aria-current": isModuleActive(item.id) ? "page" : void 0,
1669
- children: [
1670
- /* @__PURE__ */ jsx9("div", { className: cn(
1671
- "transition-colors",
1672
- isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
1673
- ), children: item.icon }),
1674
- /* @__PURE__ */ jsx9("span", { className: cn(
1675
- "flex-1 text-left text-sm font-medium",
1676
- isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)]"
1677
- ), children: item.label }),
1678
- item.badge && /* @__PURE__ */ jsx9("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-[var(--color-background)] rounded-full", children: item.badge })
1679
- ]
1680
- }
1681
- ),
1682
- isModuleActive(item.id) && secondaryMenuItems[item.id] && /* @__PURE__ */ jsx9("div", { className: "bg-[var(--color-sidebar-submenu-bg)] py-2", children: secondaryMenuItems[item.id].map((subItem) => /* @__PURE__ */ jsxs5(
1683
- "button",
1684
- {
1685
- onClick: () => {
1686
- if (subItem.path) {
1687
- navigate(subItem.path);
1688
- setMobileMenuOpen(false);
1689
- }
1690
- },
1691
- className: cn(
1692
- "w-full flex items-center gap-3 pl-12 pr-4 py-2 text-sm",
1693
- "hover:bg-[var(--color-sidebar-hover)]",
1694
- isActive(subItem.path || "") && "bg-[var(--color-sidebar-active)] text-[var(--color-primary)]"
1695
- ),
1696
- children: [
1697
- subItem.icon,
1698
- /* @__PURE__ */ jsx9("span", { className: cn(
1699
- isActive(subItem.path || "") ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
1700
- ), children: subItem.label })
1701
- ]
1648
+ /* @__PURE__ */ jsx9(
1649
+ "button",
1650
+ {
1651
+ onClick: () => setMobileMenuOpen(false),
1652
+ className: "text-[var(--color-sidebar-text-secondary)]",
1653
+ "aria-label": "Fermer le menu",
1654
+ children: /* @__PURE__ */ jsx9(X2, { className: "w-6 h-6" })
1655
+ }
1656
+ )
1657
+ ] }),
1658
+ /* @__PURE__ */ jsx9("nav", { className: "py-4", role: "menubar", children: primaryMenuItems.map((item) => /* @__PURE__ */ jsxs5("div", { children: [
1659
+ /* @__PURE__ */ jsxs5(
1660
+ "button",
1661
+ {
1662
+ onClick: () => {
1663
+ if (item.path) {
1664
+ navigate(item.path);
1665
+ setMobileMenuOpen(false);
1666
+ } else {
1667
+ setSelectedModule(item.id);
1668
+ }
1702
1669
  },
1703
- subItem.id
1704
- )) })
1705
- ] }, item.id)) })
1706
- ]
1707
- }
1708
- )
1709
- }
1710
- ),
1670
+ className: cn(
1671
+ "w-full flex items-center gap-3 px-4 py-3 transition-all duration-200",
1672
+ "hover:bg-[var(--color-sidebar-hover)]",
1673
+ isModuleActive(item.id) && "bg-[var(--color-sidebar-active)] border-l-4 border-[var(--color-primary)]"
1674
+ ),
1675
+ role: "menuitem",
1676
+ "aria-current": isModuleActive(item.id) ? "page" : void 0,
1677
+ children: [
1678
+ /* @__PURE__ */ jsx9("div", { className: cn(
1679
+ "transition-colors",
1680
+ isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
1681
+ ), children: item.icon }),
1682
+ /* @__PURE__ */ jsx9("span", { className: cn(
1683
+ "flex-1 text-left text-sm font-medium",
1684
+ isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)]"
1685
+ ), children: item.label }),
1686
+ item.badge && /* @__PURE__ */ jsx9("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-[var(--color-background)] rounded-full", children: item.badge })
1687
+ ]
1688
+ }
1689
+ ),
1690
+ isModuleActive(item.id) && secondaryMenuItems[item.id] && /* @__PURE__ */ jsx9("div", { className: "bg-[var(--color-sidebar-submenu-bg)] py-2", children: secondaryMenuItems[item.id].map((subItem) => /* @__PURE__ */ jsxs5(
1691
+ "button",
1692
+ {
1693
+ onClick: () => {
1694
+ if (subItem.path) {
1695
+ navigate(subItem.path);
1696
+ setMobileMenuOpen(false);
1697
+ }
1698
+ },
1699
+ className: cn(
1700
+ "w-full flex items-center gap-3 pl-12 pr-4 py-2 text-sm",
1701
+ "hover:bg-[var(--color-sidebar-hover)]",
1702
+ isActive(subItem.path || "") && "bg-[var(--color-sidebar-active)] text-[var(--color-primary)]"
1703
+ ),
1704
+ children: [
1705
+ subItem.icon,
1706
+ /* @__PURE__ */ jsx9("span", { className: cn(
1707
+ isActive(subItem.path || "") ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
1708
+ ), children: subItem.label })
1709
+ ]
1710
+ },
1711
+ subItem.id
1712
+ )) })
1713
+ ] }, item.id)) })
1714
+ ]
1715
+ }
1716
+ )
1717
+ ] }),
1711
1718
  /* @__PURE__ */ jsxs5("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
1712
1719
  /* @__PURE__ */ jsxs5(
1713
1720
  "header",
@@ -3689,7 +3696,7 @@ var useAlert = () => {
3689
3696
  };
3690
3697
 
3691
3698
  // src/components/common/CommonSelect.tsx
3692
- import { useEffect as useEffect12, useState as useState16 } from "react";
3699
+ import { useEffect as useEffect13, useState as useState18 } from "react";
3693
3700
 
3694
3701
  // src/services/VendorServices.ts
3695
3702
  var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
@@ -3768,7 +3775,7 @@ import { Fragment as Fragment62, jsx as jsx142, jsxs as jsxs102 } from "react/js
3768
3775
  import { createContext as createContext42, useContext as useContext42, useState as useState112, useCallback as useCallback22 } from "react";
3769
3776
  import { jsx as jsx152, jsxs as jsxs112 } from "react/jsx-runtime";
3770
3777
  import { jsx as jsx162, jsxs as jsxs122 } from "react/jsx-runtime";
3771
- import { useEffect as useEffect11, useState as useState14 } from "react";
3778
+ import { useEffect as useEffect12, useState as useState16 } from "react";
3772
3779
  import { jsx as jsx172 } from "react/jsx-runtime";
3773
3780
  import { jsx as jsx222, jsxs as jsxs132 } from "react/jsx-runtime";
3774
3781
  import { Link as Link32 } from "react-router-dom";
@@ -3816,16 +3823,75 @@ import { ArrowDownAZ as ArrowDownAZ22, ArrowDownUp as ArrowDownUp22, ArrowUpAZ a
3816
3823
  import { Fragment as Fragment422, jsx as jsx1222, jsxs as jsxs822 } from "react/jsx-runtime";
3817
3824
  import { useState as useState1022, useEffect as useEffect822 } from "react";
3818
3825
  import { useState as useState922, useRef as useRef22, useEffect as useEffect722 } from "react";
3819
- import { Search as Search322, ChevronDown as ChevronDown22, X as X422 } from "lucide-react";
3826
+ import { Search as Search322, ChevronDown as ChevronDown22, X as X422, RefreshCw as RefreshCw22, Plus as Plus32 } from "lucide-react";
3820
3827
  import { Fragment as Fragment522, jsx as jsx1322, jsxs as jsxs922 } from "react/jsx-runtime";
3821
- import { X as X522, Plus as Plus32, Trash2 as Trash222, Users as Users22, Loader as Loader222, RotateCcw as RotateCcw22, Ban as Ban22, Eye as Eye222, FileText as FileText222, History as History22 } from "lucide-react";
3828
+ import { X as X522, Plus as Plus222, Trash2 as Trash222, Users as Users22, Loader as Loader222, RotateCcw as RotateCcw22, Ban as Ban22, Eye as Eye222, FileText as FileText222, History as History22 } from "lucide-react";
3822
3829
  import { Fragment as Fragment622, jsx as jsx1422, jsxs as jsxs1022 } from "react/jsx-runtime";
3823
3830
  import { createContext as createContext422, useContext as useContext422, useState as useState1122, useCallback as useCallback222 } from "react";
3824
3831
  import { jsx as jsx1522, jsxs as jsxs1122 } from "react/jsx-runtime";
3825
3832
  import { jsx as jsx1622, jsxs as jsxs1222 } from "react/jsx-runtime";
3833
+ import { useEffect as useEffect11, useState as useState14 } from "react";
3834
+ import { jsx as jsx1722 } from "react/jsx-runtime";
3835
+ import { jsx as jsx2222, jsxs as jsxs1322 } from "react/jsx-runtime";
3836
+ import { Link as Link322 } from "react-router-dom";
3837
+ import { jsx as jsx3222, jsxs as jsxs2222 } from "react/jsx-runtime";
3838
+ import React4222, { useState as useState5222, useEffect as useEffect4222 } from "react";
3839
+ import { useLocation as useLocation322, useNavigate as useNavigate322 } from "react-router-dom";
3840
+ import {
3841
+ Settings as Settings322,
3842
+ ChevronLeft as ChevronLeft322,
3843
+ ChevronRight as ChevronRight222,
3844
+ Search as Search422,
3845
+ Bell as Bell222,
3846
+ User as User222,
3847
+ LogOut as LogOut222,
3848
+ Menu as Menu322,
3849
+ X as X2222,
3850
+ Palette as Palette222,
3851
+ DollarSign as DollarSign222,
3852
+ HelpCircle as HelpCircle222,
3853
+ Building2 as Building2222
3854
+ } from "lucide-react";
3855
+ import { clsx as clsx222 } from "clsx";
3856
+ import { twMerge as twMerge222 } from "tailwind-merge";
3857
+ import { createContext as createContext522, useContext as useContext522, useState as useState1222, useEffect as useEffect922 } from "react";
3858
+ import { jsx as jsx4222 } from "react/jsx-runtime";
3859
+ import { createContext as createContext2222, useContext as useContext2222, useEffect as useEffect2222, useState as useState2222 } from "react";
3860
+ import { jsx as jsx5222 } from "react/jsx-runtime";
3861
+ import { createContext as createContext3222, useContext as useContext3222, useState as useState3222, useCallback as useCallback322 } from "react";
3862
+ import { jsx as jsx6222 } from "react/jsx-runtime";
3863
+ import { useState as useState4222, useEffect as useEffect3222 } from "react";
3864
+ import { jsx as jsx7222, jsxs as jsxs3222 } from "react/jsx-runtime";
3865
+ import { X as X622, Loader as Loader322, Eye as Eye322, FileText as FileText322, Check as Check222, XCircle as XCircle322, Edit as Edit222, CheckCircle as CheckCircle322, Clock as Clock222, AlertCircle as AlertCircle222, User as UserIcon222, Send as Send222 } from "lucide-react";
3866
+ import { useParams as useParams222, useSearchParams as useSearchParams322 } from "react-router-dom";
3867
+ import { Fragment as Fragment722, jsx as jsx8222, jsxs as jsxs4222 } from "react/jsx-runtime";
3868
+ import { Fragment as Fragment2222, jsx as jsx9222, jsxs as jsxs5222 } from "react/jsx-runtime";
3869
+ import { useEffect as useEffect5222, useState as useState6222 } from "react";
3870
+ import { CheckCircle as CheckCircle2222, XCircle as XCircle2222, AlertTriangle as AlertTriangle222, Info as Info222, X as X3222 } from "lucide-react";
3871
+ import { jsx as jsx10222, jsxs as jsxs6222 } from "react/jsx-runtime";
3872
+ import { ChevronLeft as ChevronLeft2222, Download as Download322, Menu as Menu2222, Settings as Settings2222 } from "lucide-react";
3873
+ import { useState as useState7222 } from "react";
3874
+ import { Fragment as Fragment3222, jsx as jsx11222, jsxs as jsxs7222 } from "react/jsx-runtime";
3875
+ import { useEffect as useEffect6222, useState as useState8222 } from "react";
3876
+ import { useLocation as useLocation2222, useNavigate as useNavigate2222, useSearchParams as useSearchParams2222, Link as Link2222 } from "react-router-dom";
3877
+ import { ArrowDownAZ as ArrowDownAZ222, ArrowDownUp as ArrowDownUp222, ArrowUpAZ as ArrowUpAZ222, Download as Download2222, Filter as Filter222, MoreVertical as MoreVertical222, Printer as Printer222, Search as Search2222 } from "lucide-react";
3878
+ import { Fragment as Fragment4222, jsx as jsx12222, jsxs as jsxs8222 } from "react/jsx-runtime";
3879
+ import { useState as useState10222, useEffect as useEffect8222 } from "react";
3880
+ import { useState as useState9222, useRef as useRef222, useEffect as useEffect7222 } from "react";
3881
+ import { Search as Search3222, ChevronDown as ChevronDown222, X as X4222 } from "lucide-react";
3882
+ import { Fragment as Fragment5222, jsx as jsx13222, jsxs as jsxs9222 } from "react/jsx-runtime";
3883
+ import { X as X5222, Plus as Plus322, Trash2 as Trash2222, Users as Users222, Loader as Loader2222, RotateCcw as RotateCcw222, Ban as Ban222, Eye as Eye2222, FileText as FileText2222, History as History222 } from "lucide-react";
3884
+ import { Fragment as Fragment6222, jsx as jsx14222, jsxs as jsxs10222 } from "react/jsx-runtime";
3885
+ import { createContext as createContext4222, useContext as useContext4222, useState as useState11222, useCallback as useCallback2222 } from "react";
3886
+ import { jsx as jsx15222, jsxs as jsxs11222 } from "react/jsx-runtime";
3887
+ import { jsx as jsx16222, jsxs as jsxs12222 } from "react/jsx-runtime";
3826
3888
  import { useState as useState13 } from "react";
3827
3889
  import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
3828
3890
  import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
3891
+ import { useState as useState15 } from "react";
3892
+ import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
3893
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
3894
+ import { jsx as jsx23 } from "react/jsx-runtime";
3829
3895
  var PrimaryButton2 = ({
3830
3896
  loading = false,
3831
3897
  children,
@@ -3930,14 +3996,30 @@ var USERS_API_URL22 = `${API_URL22}/core/users/`;
3930
3996
  var ToastContext22 = createContext322(void 0);
3931
3997
  var APPROVAL_API_URL22 = `${API_URL22}/approvals/cases/`;
3932
3998
  var AlertContext22 = createContext422(void 0);
3933
- var URI = `${API_URL2}/core/departments/`;
3934
- var URI2 = `${API_URL2}/accounting/profit-or-cost-center/`;
3935
- var COST_URI = `${API_URL2}/accounting/cost-center/`;
3936
- var PROFIT_URI = `${API_URL2}/accounting/profit-center/`;
3999
+ var VENDORS_API_URL22 = `${API_URL22}/accounting/vendors/`;
4000
+ var ThemeContext222 = createContext522(void 0);
4001
+ var ADDRESS_IP222 = "localhost:8000";
4002
+ var ADDRESS_IP_URL222 = `http://${ADDRESS_IP222}/`;
4003
+ var API_URL222 = `${ADDRESS_IP_URL222}api`;
4004
+ var API_BASE_URL322 = `${API_URL222}/core/auth/`;
4005
+ var SessionContext222 = createContext2222(void 0);
4006
+ var API_BASE_URL2222 = `${API_URL222}/core/auth/`;
4007
+ var USERS_API_URL222 = `${API_URL222}/core/users/`;
4008
+ var ToastContext222 = createContext3222(void 0);
4009
+ var APPROVAL_API_URL222 = `${API_URL222}/approvals/cases/`;
4010
+ var AlertContext222 = createContext4222(void 0);
4011
+ var URI = `${API_URL22}/core/departments/`;
4012
+ var URI2 = `${API_URL22}/accounting/profit-or-cost-center/`;
4013
+ var COST_URI = `${API_URL22}/accounting/cost-center/`;
4014
+ var PROFIT_URI = `${API_URL22}/accounting/profit-center/`;
4015
+ var URI3 = `${API_URL2}/core/departments/`;
4016
+ var URI4 = `${API_URL2}/accounting/profit-or-cost-center/`;
4017
+ var COST_URI2 = `${API_URL2}/accounting/cost-center/`;
4018
+ var PROFIT_URI2 = `${API_URL2}/accounting/profit-center/`;
3937
4019
 
3938
4020
  // src/components/common/FormVendor.tsx
3939
- import { useState as useState15 } from "react";
3940
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4021
+ import { useState as useState17 } from "react";
4022
+ import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
3941
4023
  var MinimalVendorForm = ({
3942
4024
  isOpen,
3943
4025
  onClose,
@@ -3946,13 +4028,13 @@ var MinimalVendorForm = ({
3946
4028
  refresh = () => {
3947
4029
  }
3948
4030
  }) => {
3949
- const [formData, setFormData] = useState15(object || {
4031
+ const [formData, setFormData] = useState17(object || {
3950
4032
  from_module: from ?? null,
3951
4033
  legal_name: "",
3952
4034
  trading_name: ""
3953
4035
  });
3954
- const [errors, setErrors] = useState15({});
3955
- const [loading, setLoading] = useState15(false);
4036
+ const [errors, setErrors] = useState17({});
4037
+ const [loading, setLoading] = useState17(false);
3956
4038
  const { token } = useSession();
3957
4039
  const { success, error: showError } = useToast();
3958
4040
  const handleInputChange = (e) => {
@@ -4011,7 +4093,7 @@ var MinimalVendorForm = ({
4011
4093
  }
4012
4094
  };
4013
4095
  if (!isOpen) return null;
4014
- return /* @__PURE__ */ jsx20(
4096
+ return /* @__PURE__ */ jsx24(
4015
4097
  Modals_default2,
4016
4098
  {
4017
4099
  title: "Ajouter un fournisseur",
@@ -4019,9 +4101,9 @@ var MinimalVendorForm = ({
4019
4101
  description: ``,
4020
4102
  open: isOpen,
4021
4103
  onClose,
4022
- children: /* @__PURE__ */ jsxs16("form", { onSubmit: handleSubmit, className: "p-", children: [
4023
- /* @__PURE__ */ jsx20("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs16("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
4024
- /* @__PURE__ */ jsx20(
4104
+ children: /* @__PURE__ */ jsxs18("form", { onSubmit: handleSubmit, className: "p-", children: [
4105
+ /* @__PURE__ */ jsx24("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
4106
+ /* @__PURE__ */ jsx24(
4025
4107
  TextInput2,
4026
4108
  {
4027
4109
  label: "Raison sociale",
@@ -4033,7 +4115,7 @@ var MinimalVendorForm = ({
4033
4115
  onChange: handleInputChange
4034
4116
  }
4035
4117
  ),
4036
- /* @__PURE__ */ jsx20(
4118
+ /* @__PURE__ */ jsx24(
4037
4119
  TextInput2,
4038
4120
  {
4039
4121
  label: "Nom commercial",
@@ -4044,8 +4126,8 @@ var MinimalVendorForm = ({
4044
4126
  }
4045
4127
  )
4046
4128
  ] }) }),
4047
- /* @__PURE__ */ jsxs16("div", { className: "flex justify-between pt-6 mt-8", children: [
4048
- /* @__PURE__ */ jsx20(
4129
+ /* @__PURE__ */ jsxs18("div", { className: "flex justify-between pt-6 mt-8", children: [
4130
+ /* @__PURE__ */ jsx24(
4049
4131
  "button",
4050
4132
  {
4051
4133
  type: "button",
@@ -4054,7 +4136,7 @@ var MinimalVendorForm = ({
4054
4136
  children: "Annuler"
4055
4137
  }
4056
4138
  ),
4057
- /* @__PURE__ */ jsx20(
4139
+ /* @__PURE__ */ jsx24(
4058
4140
  Buttons_default2,
4059
4141
  {
4060
4142
  type: "button",
@@ -4070,43 +4152,43 @@ var MinimalVendorForm = ({
4070
4152
  };
4071
4153
 
4072
4154
  // src/services/DepartmentServices.ts
4073
- var URI3 = `${API_URL}/core/departments/`;
4155
+ var URI5 = `${API_URL}/core/departments/`;
4074
4156
  var DepartmentServices = {
4075
- create: (data) => FetchApi.post(`${URI3}`, data),
4076
- get: (id) => FetchApi.get(`${URI3}${id}/`),
4077
- list: (params) => FetchApi.get(`${URI3}?${new URLSearchParams(params).toString()}`),
4078
- update: (id, data) => FetchApi.put(`${URI3}${id}/`, data),
4079
- delete: (id) => FetchApi.delete(`${URI3}${id}/`)
4157
+ create: (data) => FetchApi.post(`${URI5}`, data),
4158
+ get: (id) => FetchApi.get(`${URI5}${id}/`),
4159
+ list: (params) => FetchApi.get(`${URI5}?${new URLSearchParams(params).toString()}`),
4160
+ update: (id, data) => FetchApi.put(`${URI5}${id}/`, data),
4161
+ delete: (id) => FetchApi.delete(`${URI5}${id}/`)
4080
4162
  };
4081
4163
 
4082
4164
  // src/services/ProfitCostsServices.ts
4083
- var URI4 = `${API_URL}/accounting/profit-or-cost-center/`;
4084
- var COST_URI2 = `${API_URL}/accounting/cost-center/`;
4165
+ var URI6 = `${API_URL}/accounting/profit-or-cost-center/`;
4166
+ var COST_URI3 = `${API_URL}/accounting/cost-center/`;
4085
4167
  var CostServices = {
4086
- create: (data) => FetchApi.post(`${COST_URI2}`, data),
4087
- get: (id) => FetchApi.get(`${COST_URI2}${id}/`),
4088
- list: (params) => FetchApi.get(`${COST_URI2}?${new URLSearchParams(params).toString()}`),
4089
- update: (id, data) => FetchApi.put(`${COST_URI2}${id}/`, data),
4090
- delete: (id) => FetchApi.delete(`${COST_URI2}${id}/`)
4168
+ create: (data) => FetchApi.post(`${COST_URI3}`, data),
4169
+ get: (id) => FetchApi.get(`${COST_URI3}${id}/`),
4170
+ list: (params) => FetchApi.get(`${COST_URI3}?${new URLSearchParams(params).toString()}`),
4171
+ update: (id, data) => FetchApi.put(`${COST_URI3}${id}/`, data),
4172
+ delete: (id) => FetchApi.delete(`${COST_URI3}${id}/`)
4091
4173
  };
4092
- var PROFIT_URI2 = `${API_URL}/accounting/profit-center/`;
4174
+ var PROFIT_URI3 = `${API_URL}/accounting/profit-center/`;
4093
4175
 
4094
4176
  // src/components/common/CommonSelect.tsx
4095
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
4177
+ import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
4096
4178
  var SelectVendor = ({
4097
4179
  value,
4098
4180
  onSelect
4099
4181
  }) => {
4100
- const [showModal, setShowModal] = useState16(false);
4101
- const [selectedVendor, setSelectedVendor] = useState16(null);
4182
+ const [showModal, setShowModal] = useState18(false);
4183
+ const [selectedVendor, setSelectedVendor] = useState18(null);
4102
4184
  const { token, activeBusinessEntity } = useSession();
4103
- const [vendors, setVendors] = useState16(() => {
4185
+ const [vendors, setVendors] = useState18(() => {
4104
4186
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
4105
4187
  const cached = sessionStorage.getItem(cacheKey);
4106
4188
  return cached ? JSON.parse(cached) : [];
4107
4189
  });
4108
- const [loadingVendors, setLoadingVendors] = useState16(false);
4109
- useEffect12(() => {
4190
+ const [loadingVendors, setLoadingVendors] = useState18(false);
4191
+ useEffect13(() => {
4110
4192
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
4111
4193
  const cached = sessionStorage.getItem(cacheKey);
4112
4194
  if (!cached) {
@@ -4144,9 +4226,9 @@ var SelectVendor = ({
4144
4226
  sessionStorage.removeItem(cacheKey);
4145
4227
  loadVendors();
4146
4228
  };
4147
- return /* @__PURE__ */ jsxs17("div", { children: [
4148
- /* @__PURE__ */ jsx21("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx21("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
4149
- /* @__PURE__ */ jsx21(
4229
+ return /* @__PURE__ */ jsxs19("div", { children: [
4230
+ /* @__PURE__ */ jsx25("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx25("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
4231
+ /* @__PURE__ */ jsx25(
4150
4232
  SearchableSelect,
4151
4233
  {
4152
4234
  value,
@@ -4162,8 +4244,8 @@ var SelectVendor = ({
4162
4244
  },
4163
4245
  "fourni" + value
4164
4246
  ),
4165
- loadingVendors && /* @__PURE__ */ jsx21("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des fournisseurs..." }),
4166
- showModal && /* @__PURE__ */ jsx21(
4247
+ loadingVendors && /* @__PURE__ */ jsx25("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des fournisseurs..." }),
4248
+ showModal && /* @__PURE__ */ jsx25(
4167
4249
  MinimalVendorForm,
4168
4250
  {
4169
4251
  object: selectedVendor,
@@ -4180,13 +4262,13 @@ var SelectUser = ({
4180
4262
  onSelect
4181
4263
  }) => {
4182
4264
  const { token, activeBusinessEntity } = useSession();
4183
- const [users, setUsers] = useState16(() => {
4265
+ const [users, setUsers] = useState18(() => {
4184
4266
  const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
4185
4267
  const cached = sessionStorage.getItem(cacheKey);
4186
4268
  return cached ? JSON.parse(cached) : [];
4187
4269
  });
4188
- const [loading, setLoading] = useState16(false);
4189
- useEffect12(() => {
4270
+ const [loading, setLoading] = useState18(false);
4271
+ useEffect13(() => {
4190
4272
  const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
4191
4273
  const cached = sessionStorage.getItem(cacheKey);
4192
4274
  if (!cached) {
@@ -4222,19 +4304,19 @@ var SelectUser = ({
4222
4304
  return users.map((user) => ({
4223
4305
  value: user.id,
4224
4306
  label: `${user.first_name} ${user.last_name}`,
4225
- content: /* @__PURE__ */ jsx21("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
4226
- /* @__PURE__ */ jsxs17("div", { className: "font-medium text-gray-900", children: [
4307
+ content: /* @__PURE__ */ jsx25("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ jsxs19("div", { className: "flex-1", children: [
4308
+ /* @__PURE__ */ jsxs19("div", { className: "font-medium text-gray-900", children: [
4227
4309
  user.first_name,
4228
4310
  " ",
4229
4311
  user.last_name
4230
4312
  ] }),
4231
- /* @__PURE__ */ jsx21("div", { className: "text-sm text-gray-500", children: user.email })
4313
+ /* @__PURE__ */ jsx25("div", { className: "text-sm text-gray-500", children: user.email })
4232
4314
  ] }) })
4233
4315
  }));
4234
4316
  };
4235
- return /* @__PURE__ */ jsxs17("div", { children: [
4236
- /* @__PURE__ */ jsx21("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx21("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
4237
- /* @__PURE__ */ jsx21(
4317
+ return /* @__PURE__ */ jsxs19("div", { children: [
4318
+ /* @__PURE__ */ jsx25("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx25("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
4319
+ /* @__PURE__ */ jsx25(
4238
4320
  SearchableSelect,
4239
4321
  {
4240
4322
  value,
@@ -4247,7 +4329,7 @@ var SelectUser = ({
4247
4329
  },
4248
4330
  "user" + value
4249
4331
  ),
4250
- loading && /* @__PURE__ */ jsx21("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
4332
+ loading && /* @__PURE__ */ jsx25("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
4251
4333
  ] });
4252
4334
  };
4253
4335
  var SelectDepartment = ({
@@ -4255,13 +4337,13 @@ var SelectDepartment = ({
4255
4337
  onSelect
4256
4338
  }) => {
4257
4339
  const { token, activeBusinessEntity } = useSession();
4258
- const [departments, setDepartments] = useState16(() => {
4340
+ const [departments, setDepartments] = useState18(() => {
4259
4341
  const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
4260
4342
  const cached = sessionStorage.getItem(cacheKey);
4261
4343
  return cached ? JSON.parse(cached) : [];
4262
4344
  });
4263
- const [loading, setLoading] = useState16(false);
4264
- useEffect12(() => {
4345
+ const [loading, setLoading] = useState18(false);
4346
+ useEffect13(() => {
4265
4347
  const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
4266
4348
  const cached = sessionStorage.getItem(cacheKey);
4267
4349
  if (!cached) {
@@ -4297,9 +4379,9 @@ var SelectDepartment = ({
4297
4379
  label: dept.name
4298
4380
  }));
4299
4381
  };
4300
- return /* @__PURE__ */ jsxs17("div", { children: [
4301
- /* @__PURE__ */ jsx21("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx21("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
4302
- /* @__PURE__ */ jsx21(
4382
+ return /* @__PURE__ */ jsxs19("div", { children: [
4383
+ /* @__PURE__ */ jsx25("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx25("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
4384
+ /* @__PURE__ */ jsx25(
4303
4385
  SearchableSelect,
4304
4386
  {
4305
4387
  value,
@@ -4312,7 +4394,7 @@ var SelectDepartment = ({
4312
4394
  },
4313
4395
  "dept" + value
4314
4396
  ),
4315
- loading && /* @__PURE__ */ jsx21("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
4397
+ loading && /* @__PURE__ */ jsx25("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
4316
4398
  ] });
4317
4399
  };
4318
4400
  var SelectCostCenter = ({
@@ -4320,13 +4402,13 @@ var SelectCostCenter = ({
4320
4402
  onSelect
4321
4403
  }) => {
4322
4404
  const { token, activeBusinessEntity } = useSession();
4323
- const [costCenters, setCostCenters] = useState16(() => {
4405
+ const [costCenters, setCostCenters] = useState18(() => {
4324
4406
  const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
4325
4407
  const cached = sessionStorage.getItem(cacheKey);
4326
4408
  return cached ? JSON.parse(cached) : [];
4327
4409
  });
4328
- const [loading, setLoading] = useState16(false);
4329
- useEffect12(() => {
4410
+ const [loading, setLoading] = useState18(false);
4411
+ useEffect13(() => {
4330
4412
  const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
4331
4413
  const cached = sessionStorage.getItem(cacheKey);
4332
4414
  if (!cached) {
@@ -4360,18 +4442,18 @@ var SelectCostCenter = ({
4360
4442
  return costCenters.map((center) => ({
4361
4443
  value: center.id,
4362
4444
  label: `${center.code ? `[${center.code}] ` : ""}${center.name}`,
4363
- content: /* @__PURE__ */ jsx21("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ jsxs17("div", { className: "flex-1", children: [
4364
- /* @__PURE__ */ jsx21("div", { className: "font-medium text-gray-900", children: center.name }),
4365
- center.code && /* @__PURE__ */ jsxs17("div", { className: "text-sm text-gray-500", children: [
4445
+ content: /* @__PURE__ */ jsx25("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ jsxs19("div", { className: "flex-1", children: [
4446
+ /* @__PURE__ */ jsx25("div", { className: "font-medium text-gray-900", children: center.name }),
4447
+ center.code && /* @__PURE__ */ jsxs19("div", { className: "text-sm text-gray-500", children: [
4366
4448
  "Code: ",
4367
4449
  center.code
4368
4450
  ] })
4369
4451
  ] }) })
4370
4452
  }));
4371
4453
  };
4372
- return /* @__PURE__ */ jsxs17("div", { children: [
4373
- /* @__PURE__ */ jsx21("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx21("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
4374
- /* @__PURE__ */ jsx21(
4454
+ return /* @__PURE__ */ jsxs19("div", { children: [
4455
+ /* @__PURE__ */ jsx25("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx25("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
4456
+ /* @__PURE__ */ jsx25(
4375
4457
  SearchableSelect,
4376
4458
  {
4377
4459
  value,
@@ -4384,12 +4466,12 @@ var SelectCostCenter = ({
4384
4466
  },
4385
4467
  "cost" + value
4386
4468
  ),
4387
- loading && /* @__PURE__ */ jsx21("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
4469
+ loading && /* @__PURE__ */ jsx25("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
4388
4470
  ] });
4389
4471
  };
4390
4472
 
4391
4473
  // src/components/common/Choices.tsx
4392
- import { jsx as jsx23 } from "react/jsx-runtime";
4474
+ import { jsx as jsx26 } from "react/jsx-runtime";
4393
4475
  var CHOICES = {
4394
4476
  INVOICE_TYPES: [
4395
4477
  { value: "sale", label: { fr: "Vente", en: "Sale", default: "Sale" } },
@@ -4647,7 +4729,7 @@ var InvoiceTypeSelector = ({
4647
4729
  value: item.value,
4648
4730
  label: item.label[language]
4649
4731
  }));
4650
- return /* @__PURE__ */ jsx23(
4732
+ return /* @__PURE__ */ jsx26(
4651
4733
  SearchableSelect,
4652
4734
  {
4653
4735
  value,
@@ -4670,7 +4752,7 @@ var PaymentMethodSelector = ({
4670
4752
  value: item.value,
4671
4753
  label: item.label[language]
4672
4754
  }));
4673
- return /* @__PURE__ */ jsx23(
4755
+ return /* @__PURE__ */ jsx26(
4674
4756
  SearchableSelect,
4675
4757
  {
4676
4758
  value,
@@ -4693,7 +4775,7 @@ var TemplateFNESelector = ({
4693
4775
  value: item.value,
4694
4776
  label: item.label[language]
4695
4777
  }));
4696
- return /* @__PURE__ */ jsx23(
4778
+ return /* @__PURE__ */ jsx26(
4697
4779
  SearchableSelect,
4698
4780
  {
4699
4781
  value,
@@ -4716,7 +4798,7 @@ var ForeignCurrencySelector = ({
4716
4798
  value: item.value,
4717
4799
  label: item.label[language]
4718
4800
  }));
4719
- return /* @__PURE__ */ jsx23(
4801
+ return /* @__PURE__ */ jsx26(
4720
4802
  SearchableSelect,
4721
4803
  {
4722
4804
  value,
@@ -4740,7 +4822,7 @@ var TaxSelector = ({
4740
4822
  value: item.value,
4741
4823
  label: item.label[language]
4742
4824
  }));
4743
- return /* @__PURE__ */ jsx23(
4825
+ return /* @__PURE__ */ jsx26(
4744
4826
  SearchableSelect,
4745
4827
  {
4746
4828
  value,
@@ -4768,7 +4850,7 @@ var LegalFormSelector = ({
4768
4850
  value: item.value,
4769
4851
  label: item.label[language] ?? item.label.default
4770
4852
  }));
4771
- return /* @__PURE__ */ jsx23(
4853
+ return /* @__PURE__ */ jsx26(
4772
4854
  SearchableSelect,
4773
4855
  {
4774
4856
  value,
@@ -4791,7 +4873,7 @@ var CountrySelector = ({
4791
4873
  value: item.value,
4792
4874
  label: item.label[language]
4793
4875
  }));
4794
- return /* @__PURE__ */ jsx23(
4876
+ return /* @__PURE__ */ jsx26(
4795
4877
  SearchableSelect,
4796
4878
  {
4797
4879
  value,