ptechcore_ui 1.0.33 → 1.0.35

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
@@ -918,16 +918,16 @@ var AuthServices = {
918
918
  // src/services/VendorServices.ts
919
919
  var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
920
920
  var VendorServices = {
921
- createVendor: (data, token) => {
921
+ create: (data) => {
922
922
  const payload = { ...data };
923
923
  if (!payload.logo) {
924
924
  delete payload.logo;
925
925
  }
926
- return FetchApi.post(`${VENDORS_API_URL}`, payload, token);
926
+ return FetchApi.post(`${VENDORS_API_URL}`, payload);
927
927
  },
928
- getVendor: (id, token) => FetchApi.get(`${VENDORS_API_URL}${id}/`, token),
929
- getVendors: (token, params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`, token),
930
- listVendors: (params) => {
928
+ get: (id) => FetchApi.get(`${VENDORS_API_URL}${id}/`),
929
+ list: (params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`),
930
+ search: (params) => {
931
931
  const searchParams = new URLSearchParams();
932
932
  if (params) {
933
933
  Object.entries(params).forEach(([key, value]) => {
@@ -939,14 +939,14 @@ var VendorServices = {
939
939
  const queryString = searchParams.toString();
940
940
  return FetchApi.get(`${VENDORS_API_URL}search/${queryString ? `?${queryString}` : ""}`);
941
941
  },
942
- updateVendor: (id, data, token) => {
942
+ update: (id, data) => {
943
943
  const payload = { ...data };
944
944
  if (!payload.logo) {
945
945
  delete payload.logo;
946
946
  }
947
- return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload, token);
947
+ return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload);
948
948
  },
949
- deleteVendor: (id, token) => FetchApi.delete(`${VENDORS_API_URL}${id}/`, token)
949
+ delete: (id) => FetchApi.delete(`${VENDORS_API_URL}${id}/`)
950
950
  };
951
951
 
952
952
  // src/contexts/SessionContext.tsx
@@ -1006,7 +1006,7 @@ var SessionProvider = ({ children }) => {
1006
1006
  }
1007
1007
  try {
1008
1008
  setLoadingVendors(true);
1009
- const result = await VendorServices.getVendors(token, { business_entity_id: activeBusinessEntity?.id });
1009
+ const result = await VendorServices.list({ business_entity_id: activeBusinessEntity?.id });
1010
1010
  setVendors(result.data);
1011
1011
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
1012
1012
  sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
@@ -3571,16 +3571,16 @@ var UnitServices = {
3571
3571
  // src/services/ClientServices.ts
3572
3572
  var CLIENTS_API_URL = `${API_URL}/accounting/clients/`;
3573
3573
  var ClientServices = {
3574
- createClient: (data, token) => {
3574
+ create: (data) => {
3575
3575
  const payload = { ...data };
3576
3576
  if (!payload.logo) {
3577
3577
  delete payload.logo;
3578
3578
  }
3579
- return FetchApi.post(`${CLIENTS_API_URL}`, payload, token);
3579
+ return FetchApi.post(`${CLIENTS_API_URL}`, payload);
3580
3580
  },
3581
- getClient: (id, token) => FetchApi.get(`${CLIENTS_API_URL}${id}/`, token),
3582
- getClients: (token, params) => FetchApi.get(`${CLIENTS_API_URL}?${new URLSearchParams(params).toString()}`, token),
3583
- listClients: (params) => {
3581
+ get: (id) => FetchApi.get(`${CLIENTS_API_URL}${id}/`),
3582
+ list: (params) => FetchApi.get(`${CLIENTS_API_URL}?${new URLSearchParams(params).toString()}`),
3583
+ search: (params) => {
3584
3584
  const searchParams = new URLSearchParams();
3585
3585
  if (params) {
3586
3586
  Object.entries(params).forEach(([key, value]) => {
@@ -3592,14 +3592,14 @@ var ClientServices = {
3592
3592
  const queryString = searchParams.toString();
3593
3593
  return FetchApi.get(`${CLIENTS_API_URL}search/${queryString ? `?${queryString}` : ""}`);
3594
3594
  },
3595
- updateClient: (id, data, token) => {
3595
+ update: (id, data) => {
3596
3596
  const payload = { ...data };
3597
3597
  if (!payload.logo) {
3598
3598
  delete payload.logo;
3599
3599
  }
3600
- return FetchApi.put(`${CLIENTS_API_URL}${id}/`, payload, token);
3600
+ return FetchApi.put(`${CLIENTS_API_URL}${id}/`, payload);
3601
3601
  },
3602
- deleteClient: (id, token) => FetchApi.delete(`${CLIENTS_API_URL}${id}/`, token)
3602
+ delete: (id) => FetchApi.delete(`${CLIENTS_API_URL}${id}/`)
3603
3603
  };
3604
3604
 
3605
3605
  // src/components/common/FDrawer.tsx
@@ -4035,6 +4035,11 @@ var FDrawer = ({
4035
4035
  (0, import_react8.useEffect)(() => {
4036
4036
  setFilters((prev) => ({ ...prev, global_search: debouncedSearchQuery, page: 1 }));
4037
4037
  }, [debouncedSearchQuery]);
4038
+ (0, import_react8.useEffect)(() => {
4039
+ if (activeBusinessEntity?.id) {
4040
+ setFilters((prev) => ({ ...prev, business_entity_id: activeBusinessEntity.id }));
4041
+ }
4042
+ }, [activeBusinessEntity?.id]);
4038
4043
  (0, import_react8.useEffect)(() => {
4039
4044
  const handleClickOutside = (event) => {
4040
4045
  if (filterPanelRef.current && !filterPanelRef.current.contains(event.target)) {
@@ -4845,10 +4850,10 @@ var FormVendor = ({
4845
4850
  const handleSaveVendor = async (entityData) => {
4846
4851
  try {
4847
4852
  if (object && object.id) {
4848
- await VendorServices.updateVendor(object.id, entityData, token);
4853
+ await VendorServices.update(object.id, entityData);
4849
4854
  success("Fournisseur modifi\xE9 avec succ\xE8s !");
4850
4855
  } else {
4851
- await VendorServices.createVendor(entityData, token);
4856
+ await VendorServices.create(entityData);
4852
4857
  success("Fournisseur cr\xE9\xE9 avec succ\xE8s !");
4853
4858
  }
4854
4859
  refresh();
@@ -7004,10 +7009,10 @@ var FormClient = ({
7004
7009
  ...logo && typeof logo !== "string" ? { logo } : {}
7005
7010
  };
7006
7011
  if (object && object.id) {
7007
- await ClientServices.updateClient(object.id, dataToSave, token || "");
7012
+ await ClientServices.update(object.id, dataToSave);
7008
7013
  success("Client modifi\xE9 avec succ\xE8s");
7009
7014
  } else {
7010
- await ClientServices.createClient(dataToSave, token || "");
7015
+ await ClientServices.create(dataToSave);
7011
7016
  success("Client cr\xE9\xE9 avec succ\xE8s");
7012
7017
  }
7013
7018
  refresh();
@@ -8725,7 +8730,7 @@ var SelectVendor = ({
8725
8730
  }
8726
8731
  try {
8727
8732
  setLoadingVendors(true);
8728
- const result = await VendorServices.getVendors(token, { business_entity_id: activeBusinessEntity?.id });
8733
+ const result = await VendorServices.list({ business_entity_id: activeBusinessEntity?.id });
8729
8734
  setVendors(result.data);
8730
8735
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
8731
8736
  sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
package/dist/index.d.cts CHANGED
@@ -620,12 +620,12 @@ interface VendorListResponse {
620
620
  };
621
621
  }
622
622
  declare const VendorServices: {
623
- createVendor: (data: Partial<Vendor>, token: string) => Promise<unknown>;
624
- getVendor: (id: number, token: string) => Promise<unknown>;
625
- getVendors: (token: string, params?: any) => Promise<unknown>;
626
- listVendors: (params?: Record<string, any>) => Promise<VendorListResponse>;
627
- updateVendor: (id: number, data: Partial<Vendor>, token: string) => Promise<unknown>;
628
- deleteVendor: (id: number, token: string) => Promise<unknown>;
623
+ create: (data: Partial<Vendor>) => Promise<unknown>;
624
+ get: (id: number) => Promise<unknown>;
625
+ list: (params?: any) => Promise<unknown>;
626
+ search: (params?: Record<string, any>) => Promise<VendorListResponse>;
627
+ update: (id: number, data: Partial<Vendor>) => Promise<unknown>;
628
+ delete: (id: number) => Promise<unknown>;
629
629
  };
630
630
 
631
631
  type FromModule = 'accounting' | 'crm' | 'procurement';
@@ -689,12 +689,12 @@ interface ClientListResponse {
689
689
  };
690
690
  }
691
691
  declare const ClientServices: {
692
- createClient: (data: Partial<Client>, token: string) => Promise<unknown>;
693
- getClient: (id: number, token: string) => Promise<Client>;
694
- getClients: (token: string, params?: any) => Promise<unknown>;
695
- listClients: (params?: Record<string, any>) => Promise<ClientListResponse>;
696
- updateClient: (id: number, data: Partial<Client>, token: string) => Promise<unknown>;
697
- deleteClient: (id: number, token: string) => Promise<unknown>;
692
+ create: (data: Partial<Client>) => Promise<unknown>;
693
+ get: (id: number) => Promise<Client>;
694
+ list: (params?: any) => Promise<unknown>;
695
+ search: (params?: Record<string, any>) => Promise<ClientListResponse>;
696
+ update: (id: number, data: Partial<Client>) => Promise<unknown>;
697
+ delete: (id: number) => Promise<unknown>;
698
698
  };
699
699
 
700
700
  type ImportField = {
package/dist/index.d.ts CHANGED
@@ -620,12 +620,12 @@ interface VendorListResponse {
620
620
  };
621
621
  }
622
622
  declare const VendorServices: {
623
- createVendor: (data: Partial<Vendor>, token: string) => Promise<unknown>;
624
- getVendor: (id: number, token: string) => Promise<unknown>;
625
- getVendors: (token: string, params?: any) => Promise<unknown>;
626
- listVendors: (params?: Record<string, any>) => Promise<VendorListResponse>;
627
- updateVendor: (id: number, data: Partial<Vendor>, token: string) => Promise<unknown>;
628
- deleteVendor: (id: number, token: string) => Promise<unknown>;
623
+ create: (data: Partial<Vendor>) => Promise<unknown>;
624
+ get: (id: number) => Promise<unknown>;
625
+ list: (params?: any) => Promise<unknown>;
626
+ search: (params?: Record<string, any>) => Promise<VendorListResponse>;
627
+ update: (id: number, data: Partial<Vendor>) => Promise<unknown>;
628
+ delete: (id: number) => Promise<unknown>;
629
629
  };
630
630
 
631
631
  type FromModule = 'accounting' | 'crm' | 'procurement';
@@ -689,12 +689,12 @@ interface ClientListResponse {
689
689
  };
690
690
  }
691
691
  declare const ClientServices: {
692
- createClient: (data: Partial<Client>, token: string) => Promise<unknown>;
693
- getClient: (id: number, token: string) => Promise<Client>;
694
- getClients: (token: string, params?: any) => Promise<unknown>;
695
- listClients: (params?: Record<string, any>) => Promise<ClientListResponse>;
696
- updateClient: (id: number, data: Partial<Client>, token: string) => Promise<unknown>;
697
- deleteClient: (id: number, token: string) => Promise<unknown>;
692
+ create: (data: Partial<Client>) => Promise<unknown>;
693
+ get: (id: number) => Promise<Client>;
694
+ list: (params?: any) => Promise<unknown>;
695
+ search: (params?: Record<string, any>) => Promise<ClientListResponse>;
696
+ update: (id: number, data: Partial<Client>) => Promise<unknown>;
697
+ delete: (id: number) => Promise<unknown>;
698
698
  };
699
699
 
700
700
  type ImportField = {
package/dist/index.js CHANGED
@@ -841,16 +841,16 @@ var AuthServices = {
841
841
  // src/services/VendorServices.ts
842
842
  var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
843
843
  var VendorServices = {
844
- createVendor: (data, token) => {
844
+ create: (data) => {
845
845
  const payload = { ...data };
846
846
  if (!payload.logo) {
847
847
  delete payload.logo;
848
848
  }
849
- return FetchApi.post(`${VENDORS_API_URL}`, payload, token);
849
+ return FetchApi.post(`${VENDORS_API_URL}`, payload);
850
850
  },
851
- getVendor: (id, token) => FetchApi.get(`${VENDORS_API_URL}${id}/`, token),
852
- getVendors: (token, params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`, token),
853
- listVendors: (params) => {
851
+ get: (id) => FetchApi.get(`${VENDORS_API_URL}${id}/`),
852
+ list: (params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`),
853
+ search: (params) => {
854
854
  const searchParams = new URLSearchParams();
855
855
  if (params) {
856
856
  Object.entries(params).forEach(([key, value]) => {
@@ -862,14 +862,14 @@ var VendorServices = {
862
862
  const queryString = searchParams.toString();
863
863
  return FetchApi.get(`${VENDORS_API_URL}search/${queryString ? `?${queryString}` : ""}`);
864
864
  },
865
- updateVendor: (id, data, token) => {
865
+ update: (id, data) => {
866
866
  const payload = { ...data };
867
867
  if (!payload.logo) {
868
868
  delete payload.logo;
869
869
  }
870
- return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload, token);
870
+ return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload);
871
871
  },
872
- deleteVendor: (id, token) => FetchApi.delete(`${VENDORS_API_URL}${id}/`, token)
872
+ delete: (id) => FetchApi.delete(`${VENDORS_API_URL}${id}/`)
873
873
  };
874
874
 
875
875
  // src/contexts/SessionContext.tsx
@@ -929,7 +929,7 @@ var SessionProvider = ({ children }) => {
929
929
  }
930
930
  try {
931
931
  setLoadingVendors(true);
932
- const result = await VendorServices.getVendors(token, { business_entity_id: activeBusinessEntity?.id });
932
+ const result = await VendorServices.list({ business_entity_id: activeBusinessEntity?.id });
933
933
  setVendors(result.data);
934
934
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
935
935
  sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
@@ -3494,16 +3494,16 @@ var UnitServices = {
3494
3494
  // src/services/ClientServices.ts
3495
3495
  var CLIENTS_API_URL = `${API_URL}/accounting/clients/`;
3496
3496
  var ClientServices = {
3497
- createClient: (data, token) => {
3497
+ create: (data) => {
3498
3498
  const payload = { ...data };
3499
3499
  if (!payload.logo) {
3500
3500
  delete payload.logo;
3501
3501
  }
3502
- return FetchApi.post(`${CLIENTS_API_URL}`, payload, token);
3502
+ return FetchApi.post(`${CLIENTS_API_URL}`, payload);
3503
3503
  },
3504
- getClient: (id, token) => FetchApi.get(`${CLIENTS_API_URL}${id}/`, token),
3505
- getClients: (token, params) => FetchApi.get(`${CLIENTS_API_URL}?${new URLSearchParams(params).toString()}`, token),
3506
- listClients: (params) => {
3504
+ get: (id) => FetchApi.get(`${CLIENTS_API_URL}${id}/`),
3505
+ list: (params) => FetchApi.get(`${CLIENTS_API_URL}?${new URLSearchParams(params).toString()}`),
3506
+ search: (params) => {
3507
3507
  const searchParams = new URLSearchParams();
3508
3508
  if (params) {
3509
3509
  Object.entries(params).forEach(([key, value]) => {
@@ -3515,14 +3515,14 @@ var ClientServices = {
3515
3515
  const queryString = searchParams.toString();
3516
3516
  return FetchApi.get(`${CLIENTS_API_URL}search/${queryString ? `?${queryString}` : ""}`);
3517
3517
  },
3518
- updateClient: (id, data, token) => {
3518
+ update: (id, data) => {
3519
3519
  const payload = { ...data };
3520
3520
  if (!payload.logo) {
3521
3521
  delete payload.logo;
3522
3522
  }
3523
- return FetchApi.put(`${CLIENTS_API_URL}${id}/`, payload, token);
3523
+ return FetchApi.put(`${CLIENTS_API_URL}${id}/`, payload);
3524
3524
  },
3525
- deleteClient: (id, token) => FetchApi.delete(`${CLIENTS_API_URL}${id}/`, token)
3525
+ delete: (id) => FetchApi.delete(`${CLIENTS_API_URL}${id}/`)
3526
3526
  };
3527
3527
 
3528
3528
  // src/components/common/FDrawer.tsx
@@ -3958,6 +3958,11 @@ var FDrawer = ({
3958
3958
  useEffect6(() => {
3959
3959
  setFilters((prev) => ({ ...prev, global_search: debouncedSearchQuery, page: 1 }));
3960
3960
  }, [debouncedSearchQuery]);
3961
+ useEffect6(() => {
3962
+ if (activeBusinessEntity?.id) {
3963
+ setFilters((prev) => ({ ...prev, business_entity_id: activeBusinessEntity.id }));
3964
+ }
3965
+ }, [activeBusinessEntity?.id]);
3961
3966
  useEffect6(() => {
3962
3967
  const handleClickOutside = (event) => {
3963
3968
  if (filterPanelRef.current && !filterPanelRef.current.contains(event.target)) {
@@ -4773,10 +4778,10 @@ var FormVendor = ({
4773
4778
  const handleSaveVendor = async (entityData) => {
4774
4779
  try {
4775
4780
  if (object && object.id) {
4776
- await VendorServices.updateVendor(object.id, entityData, token);
4781
+ await VendorServices.update(object.id, entityData);
4777
4782
  success("Fournisseur modifi\xE9 avec succ\xE8s !");
4778
4783
  } else {
4779
- await VendorServices.createVendor(entityData, token);
4784
+ await VendorServices.create(entityData);
4780
4785
  success("Fournisseur cr\xE9\xE9 avec succ\xE8s !");
4781
4786
  }
4782
4787
  refresh();
@@ -6951,10 +6956,10 @@ var FormClient = ({
6951
6956
  ...logo && typeof logo !== "string" ? { logo } : {}
6952
6957
  };
6953
6958
  if (object && object.id) {
6954
- await ClientServices.updateClient(object.id, dataToSave, token || "");
6959
+ await ClientServices.update(object.id, dataToSave);
6955
6960
  success("Client modifi\xE9 avec succ\xE8s");
6956
6961
  } else {
6957
- await ClientServices.createClient(dataToSave, token || "");
6962
+ await ClientServices.create(dataToSave);
6958
6963
  success("Client cr\xE9\xE9 avec succ\xE8s");
6959
6964
  }
6960
6965
  refresh();
@@ -8672,7 +8677,7 @@ var SelectVendor = ({
8672
8677
  }
8673
8678
  try {
8674
8679
  setLoadingVendors(true);
8675
- const result = await VendorServices.getVendors(token, { business_entity_id: activeBusinessEntity?.id });
8680
+ const result = await VendorServices.list({ business_entity_id: activeBusinessEntity?.id });
8676
8681
  setVendors(result.data);
8677
8682
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
8678
8683
  sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptechcore_ui",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",