ptechcore_ui 1.0.80 → 1.0.82
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 +133 -44
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +134 -45
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1554,8 +1554,8 @@ var UserServices = {
|
|
|
1554
1554
|
deleteUser: (id, token) => FetchApi.delete(`${USERS_API_URL}${id}/`, token),
|
|
1555
1555
|
// Obtenir les utilisateurs d'une entité
|
|
1556
1556
|
getEntityUsers: (entityId, token) => FetchApi.get(`${API_URL}/core/entities/${entityId}/users/`, token),
|
|
1557
|
-
// Obtenir les entités auxquelles
|
|
1558
|
-
getuserEntitiesAccess: (
|
|
1557
|
+
// Obtenir les entités auxquelles l'utilisateur connecté a accès
|
|
1558
|
+
getuserEntitiesAccess: (token) => FetchApi.get(`${API_URL}/core/users/entities/`, token),
|
|
1559
1559
|
// Ajouter un utilisateur à une entité
|
|
1560
1560
|
addUserToEntity: (entityId, userId, token) => FetchApi.post(`${API_URL}/core/entities/${entityId}/users/`, { user_id: userId }, token),
|
|
1561
1561
|
// === Nouvelles méthodes pour le profil utilisateur ===
|
|
@@ -2270,19 +2270,19 @@ var MODULE_URLS = {
|
|
|
2270
2270
|
wiseHR: "https://rewise.praedium-tech.com/admin/human-capital/dashboard/"
|
|
2271
2271
|
},
|
|
2272
2272
|
development: {
|
|
2273
|
-
wiseConnect: "http://localhost:
|
|
2273
|
+
wiseConnect: "http://localhost:5177/admin/crm/trade-strategy/lead-insight/",
|
|
2274
2274
|
wiseReach: "http://localhost:5173/admin/marketing/dashboard/",
|
|
2275
|
-
wiseOps: "http://localhost:
|
|
2275
|
+
wiseOps: "http://localhost:5174/dashboard/",
|
|
2276
2276
|
wiseGuard: "http://localhost:5173/admin/security/dashboard/",
|
|
2277
2277
|
wiseThrive: "http://localhost:5173/dashboard/",
|
|
2278
|
-
wiseView: "http://localhost:
|
|
2278
|
+
wiseView: "http://localhost:5173/",
|
|
2279
2279
|
wiseProcess: "http://localhost:5173/workspace/sop-connect/",
|
|
2280
2280
|
wiseBill: "http://localhost:5173/admin/invoicing/insight/summary/",
|
|
2281
|
-
wiseBooks: "http://localhost:
|
|
2281
|
+
wiseBooks: "http://localhost:5176/admin/accounting/client/invoice-queue/",
|
|
2282
2282
|
wiseAsset: "#",
|
|
2283
2283
|
wiseCash: "http://localhost:5173/admin/finance/dashboard/",
|
|
2284
2284
|
wiseCollect: "http://localhost:5173/admin/recovery/collection/dashboard/",
|
|
2285
|
-
wiseProcure: "http://localhost:
|
|
2285
|
+
wiseProcure: "http://localhost:5175/",
|
|
2286
2286
|
wiseHR: "http://localhost:5173/admin/human-capital/dashboard/"
|
|
2287
2287
|
}
|
|
2288
2288
|
};
|
|
@@ -3179,7 +3179,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
3179
3179
|
"button",
|
|
3180
3180
|
{
|
|
3181
3181
|
onClick: () => {
|
|
3182
|
-
|
|
3182
|
+
const env = localStorage.getItem("env") || "prod";
|
|
3183
|
+
window.location.href = env === "localhost" ? "http://localhost:5173/parameters/profit-cost-centers/" : "https://core.rewise.praedium-tech.com/parameters/profit-cost-centers/";
|
|
3183
3184
|
setShowUserMenu(false);
|
|
3184
3185
|
},
|
|
3185
3186
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
@@ -4740,6 +4741,7 @@ var FDrawer = ({
|
|
|
4740
4741
|
const [showOrdering, setShowOrdering] = (0, import_react10.useState)(null);
|
|
4741
4742
|
const [showFilters, setShowFilters] = (0, import_react10.useState)(null);
|
|
4742
4743
|
const [dropdownOpen, setDropdownOpen] = (0, import_react10.useState)(null);
|
|
4744
|
+
const [dropdownPos, setDropdownPos] = (0, import_react10.useState)({ top: 0, left: 0, openUp: false });
|
|
4743
4745
|
const [queryURL, setQueryURL] = (0, import_react10.useState)("");
|
|
4744
4746
|
const [reponseDetail, setReponseDetail] = (0, import_react10.useState)({
|
|
4745
4747
|
total_pages: null,
|
|
@@ -4798,6 +4800,7 @@ var FDrawer = ({
|
|
|
4798
4800
|
if (columnsPanelRef.current && !columnsPanelRef.current.contains(target)) {
|
|
4799
4801
|
setShowColumnsPanel(false);
|
|
4800
4802
|
}
|
|
4803
|
+
setDropdownOpen(null);
|
|
4801
4804
|
};
|
|
4802
4805
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4803
4806
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -5497,36 +5500,61 @@ var FDrawer = ({
|
|
|
5497
5500
|
"button",
|
|
5498
5501
|
{
|
|
5499
5502
|
type: "button",
|
|
5500
|
-
onClick: () =>
|
|
5503
|
+
onClick: (e) => {
|
|
5504
|
+
if (dropdownOpen === item.id) {
|
|
5505
|
+
setDropdownOpen(null);
|
|
5506
|
+
} else {
|
|
5507
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
5508
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
5509
|
+
const openUp = spaceBelow < 200;
|
|
5510
|
+
setDropdownPos({
|
|
5511
|
+
top: openUp ? rect.top : rect.bottom + 4,
|
|
5512
|
+
left: rect.right - 192,
|
|
5513
|
+
openUp
|
|
5514
|
+
});
|
|
5515
|
+
setDropdownOpen(item.id);
|
|
5516
|
+
}
|
|
5517
|
+
},
|
|
5501
5518
|
className: "p-1 rounded-full hover:bg-gray-100 transition-colors",
|
|
5502
5519
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.MoreVertical, { className: "w-4 h-4 text-gray-400" })
|
|
5503
5520
|
}
|
|
5504
5521
|
),
|
|
5505
|
-
dropdownOpen === item.id && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
handleDuplicate(item);
|
|
5522
|
+
dropdownOpen === item.id && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5523
|
+
"div",
|
|
5524
|
+
{
|
|
5525
|
+
className: "fixed w-48 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-[9999]",
|
|
5526
|
+
style: {
|
|
5527
|
+
top: dropdownPos.openUp ? void 0 : dropdownPos.top,
|
|
5528
|
+
bottom: dropdownPos.openUp ? window.innerHeight - dropdownPos.top : void 0,
|
|
5529
|
+
left: Math.max(8, dropdownPos.left)
|
|
5530
|
+
},
|
|
5531
|
+
children: [
|
|
5532
|
+
actions.filter((action) => !action.permission || hasPermission(action.permission)).filter((action) => !action.condition || action.condition(item)).map(
|
|
5533
|
+
(action, index) => action.navigate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_router_dom4.Link, { to: action.navigate, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => {
|
|
5534
|
+
action.onclick && action.onclick(item);
|
|
5519
5535
|
setDropdownOpen(null);
|
|
5520
|
-
},
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5536
|
+
}, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index)
|
|
5537
|
+
),
|
|
5538
|
+
onDuplicate && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "border-t border-gray-100 my-1" }),
|
|
5540
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5541
|
+
"button",
|
|
5542
|
+
{
|
|
5543
|
+
onClick: () => {
|
|
5544
|
+
handleDuplicate(item);
|
|
5545
|
+
setDropdownOpen(null);
|
|
5546
|
+
},
|
|
5547
|
+
className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2",
|
|
5548
|
+
children: [
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Copy, { className: "h-4 w-4" }),
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Dupliquer" })
|
|
5551
|
+
]
|
|
5552
|
+
}
|
|
5553
|
+
)
|
|
5554
|
+
] })
|
|
5555
|
+
]
|
|
5556
|
+
}
|
|
5557
|
+
)
|
|
5530
5558
|
] }) })
|
|
5531
5559
|
]
|
|
5532
5560
|
},
|
|
@@ -19226,7 +19254,7 @@ var CatalogueProductSelector = ({
|
|
|
19226
19254
|
};
|
|
19227
19255
|
const getBestPrice = (product) => {
|
|
19228
19256
|
const prices = product.supplier_prices || [];
|
|
19229
|
-
const homologatedPrices = prices.filter((sp) => sp.
|
|
19257
|
+
const homologatedPrices = prices.filter((sp) => sp.homologation_status === "approved");
|
|
19230
19258
|
if (homologatedPrices.length > 0) return homologatedPrices.sort((a, b) => a.unit_price - b.unit_price)[0];
|
|
19231
19259
|
return prices[0] || null;
|
|
19232
19260
|
};
|
|
@@ -19434,9 +19462,9 @@ var CatalogueProductSelector = ({
|
|
|
19434
19462
|
const price = supplierPrices.find((sp) => sp.vendor === Number(e.target.value));
|
|
19435
19463
|
if (price) updateSelectedPrice(productId, price);
|
|
19436
19464
|
},
|
|
19437
|
-
options: supplierPrices.filter((sp) => !onlyHomologated || sp.
|
|
19465
|
+
options: supplierPrices.filter((sp) => !onlyHomologated || sp.homologation_status === "approved").sort((a, b) => a.unit_price - b.unit_price).map((sp) => ({
|
|
19438
19466
|
value: String(sp.vendor),
|
|
19439
|
-
label: `${getSupplierName(sp)} - ${formatCurrency(sp.unit_price)}/${listItem.unit}${sp.
|
|
19467
|
+
label: `${getSupplierName(sp)} - ${formatCurrency(sp.unit_price)}/${listItem.unit}${sp.homologation_status === "approved" ? " (Homologu\xE9)" : ""}${sp.discount_percent ? ` (-${sp.discount_percent}%)` : ""}`
|
|
19440
19468
|
}))
|
|
19441
19469
|
}
|
|
19442
19470
|
)
|
|
@@ -20333,6 +20361,7 @@ var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
|
20333
20361
|
var PurchaseRequestsPage = () => {
|
|
20334
20362
|
const [refreshToggle, setRefreshToggle] = (0, import_react44.useState)(false);
|
|
20335
20363
|
const [showModal, setShowModal] = (0, import_react44.useState)(false);
|
|
20364
|
+
const [showAllRequests, setShowAllRequests] = (0, import_react44.useState)(false);
|
|
20336
20365
|
const [showPrintPreview, setShowPrintPreview] = (0, import_react44.useState)(false);
|
|
20337
20366
|
const [selectedPurchaseRequest, setSelectedPurchaseRequest] = (0, import_react44.useState)(null);
|
|
20338
20367
|
const { success, error: showError, confirm: confirm2 } = useToast();
|
|
@@ -20343,7 +20372,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20343
20372
|
setRefreshToggle((prev) => !prev);
|
|
20344
20373
|
};
|
|
20345
20374
|
const tabs = [
|
|
20346
|
-
{ id: "purchase_requests", label: "
|
|
20375
|
+
{ id: "purchase_requests", label: "Mes Demandes d'achat", icon: import_lucide_react36.ClipboardCheck },
|
|
20347
20376
|
{ id: "my_gr_se", label: "My GR-SE", icon: import_lucide_react36.ClipboardCheck }
|
|
20348
20377
|
];
|
|
20349
20378
|
const [activeTab, setActiveTab] = (0, import_react44.useState)("purchase_requests");
|
|
@@ -20352,12 +20381,18 @@ var PurchaseRequestsPage = () => {
|
|
|
20352
20381
|
{
|
|
20353
20382
|
title: "Proculink",
|
|
20354
20383
|
description: "G\xE9rez vos demandes d'achat",
|
|
20355
|
-
sideAction: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20384
|
+
sideAction: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex gap-2", children: [
|
|
20385
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Buttons_default, { variant: "outline", onClick: () => setShowAllRequests(true), children: [
|
|
20386
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react36.ClipboardCheck, { className: "h-4 w-4 mr-2" }),
|
|
20387
|
+
" Toutes les DA"
|
|
20388
|
+
] }),
|
|
20389
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Buttons_default, { onClick: () => {
|
|
20390
|
+
setShowModal(true);
|
|
20391
|
+
setSelectedPurchaseRequest(null);
|
|
20392
|
+
}, children: [
|
|
20393
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react36.Plus, { className: "h-4 w-4 mr-2" }),
|
|
20394
|
+
" Nouvelle demande"
|
|
20395
|
+
] })
|
|
20361
20396
|
] }),
|
|
20362
20397
|
tabs: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("nav", { className: "flex space-x-1 mt-4 overflow-x-auto", children: tabs.map((tab) => {
|
|
20363
20398
|
const Icon = tab.icon;
|
|
@@ -20456,6 +20491,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20456
20491
|
],
|
|
20457
20492
|
actions: [
|
|
20458
20493
|
{
|
|
20494
|
+
condition: (item) => loggedUser?.id === item.created_by,
|
|
20459
20495
|
label: "Modifier",
|
|
20460
20496
|
permission: "",
|
|
20461
20497
|
onclick: (item) => {
|
|
@@ -20477,6 +20513,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20477
20513
|
},
|
|
20478
20514
|
{
|
|
20479
20515
|
label: "Supprimer",
|
|
20516
|
+
condition: (item) => loggedUser?.id !== item.created_by,
|
|
20480
20517
|
permission: "",
|
|
20481
20518
|
onclick: (item) => {
|
|
20482
20519
|
if (item.status !== "draft") {
|
|
@@ -20586,7 +20623,59 @@ var PurchaseRequestsPage = () => {
|
|
|
20586
20623
|
}
|
|
20587
20624
|
)
|
|
20588
20625
|
}
|
|
20589
|
-
)
|
|
20626
|
+
),
|
|
20627
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Modals_default, { title: "Toutes les demandes d'achat", open: showAllRequests, onClose: () => setShowAllRequests(false), width: "w-[90vw]", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20628
|
+
FDrawer,
|
|
20629
|
+
{
|
|
20630
|
+
apiEndpoint: "/procurement/purchase-requests/",
|
|
20631
|
+
columns: [
|
|
20632
|
+
{ key: "created_at", label: "Date de cr\xE9ation", type: "date", filterable: true, sortable: true, search_name: "created_at" },
|
|
20633
|
+
{ key: "request_number", label: "N\xB0 DA", type: "text", filterable: true, sortable: true, search_name: "request_number" },
|
|
20634
|
+
{ key: "requested_by_user", label: "Demandeur", type: "text", filterable: true, sortable: false, search_name: "requester__last_name" },
|
|
20635
|
+
{ key: "title", label: "Titre", type: "text", filterable: true, sortable: true, search_name: "title" },
|
|
20636
|
+
{ key: "amount", label: "Montant Estim\xE9", type: "number", filterable: true, sortable: true, search_name: "amount", formule: (item) => item.amount ? `${formatCurrency(item.amount)}` : "0 FCFA" },
|
|
20637
|
+
{
|
|
20638
|
+
key: "status",
|
|
20639
|
+
label: "Statut",
|
|
20640
|
+
type: "text",
|
|
20641
|
+
filterable: true,
|
|
20642
|
+
sortable: true,
|
|
20643
|
+
search_name: "status",
|
|
20644
|
+
filter_options: [
|
|
20645
|
+
{ value: "draft", label: "Brouillon" },
|
|
20646
|
+
{ value: "submitted", label: "Soumise" },
|
|
20647
|
+
{ value: "approved", label: "Approuv\xE9e" },
|
|
20648
|
+
{ value: "rejected", label: "Rejet\xE9e" },
|
|
20649
|
+
{ value: "in_sourcing", label: "En sourcing" },
|
|
20650
|
+
{ value: "completed", label: "Termin\xE9e" },
|
|
20651
|
+
{ value: "cancelled", label: "Annul\xE9e" }
|
|
20652
|
+
],
|
|
20653
|
+
formule: (item) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(StatusBadge, { status: item.status })
|
|
20654
|
+
},
|
|
20655
|
+
{
|
|
20656
|
+
key: "sourcing_id",
|
|
20657
|
+
label: "Sourcing",
|
|
20658
|
+
type: "text",
|
|
20659
|
+
filterable: false,
|
|
20660
|
+
sortable: false,
|
|
20661
|
+
search_name: "sourcing_id",
|
|
20662
|
+
formule: (item) => {
|
|
20663
|
+
if (item.sourcing_id) {
|
|
20664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "bg-secondary text-[13px] text-primary px-4 py-1 rounded-[4px]", children: "SSJ" });
|
|
20665
|
+
}
|
|
20666
|
+
if (item.rfq) {
|
|
20667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "bg-secondary text-[13px] text-primary px-4 py-1 rounded-[4px]", children: "appel d'offre" });
|
|
20668
|
+
}
|
|
20669
|
+
return "N/A";
|
|
20670
|
+
}
|
|
20671
|
+
},
|
|
20672
|
+
{ key: "vendor", label: "Fournisseur", type: "text", filterable: true, sortable: true, search_name: "vendor", formule: (item) => item.po_details?.vendor_name ?? "", filter_endpoint: "/accounting/vendors/" },
|
|
20673
|
+
{ key: "po_amount", label: "Montant Reel", type: "number", filterable: true, sortable: true, search_name: "po_amount", formule: (item) => item.po_amount ? `${formatCurrency(item.po_amount)}` : "-" }
|
|
20674
|
+
],
|
|
20675
|
+
actions: [],
|
|
20676
|
+
ordering: "-created_at"
|
|
20677
|
+
}
|
|
20678
|
+
) })
|
|
20590
20679
|
]
|
|
20591
20680
|
}
|
|
20592
20681
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -470,7 +470,7 @@ declare const UserServices: {
|
|
|
470
470
|
updateUser: (id: number, data: Partial<User$1>, token: string) => Promise<unknown>;
|
|
471
471
|
deleteUser: (id: number, token: string) => Promise<unknown>;
|
|
472
472
|
getEntityUsers: (entityId: number, token: string) => Promise<unknown>;
|
|
473
|
-
getuserEntitiesAccess: (
|
|
473
|
+
getuserEntitiesAccess: (token: string) => Promise<unknown>;
|
|
474
474
|
addUserToEntity: (entityId: number, userId: number, token: string) => Promise<unknown>;
|
|
475
475
|
updateMyProfile: (data: UpdateProfileData) => Promise<unknown>;
|
|
476
476
|
updateProfilePicture: (file: File) => Promise<unknown>;
|
|
@@ -946,6 +946,7 @@ type FDrawerLineAction = {
|
|
|
946
946
|
permission: string;
|
|
947
947
|
navigate?: string;
|
|
948
948
|
onclick?: (item: any) => any;
|
|
949
|
+
condition?: (item: any) => boolean;
|
|
949
950
|
};
|
|
950
951
|
type ViewMode$1 = 'table' | 'grid';
|
|
951
952
|
type FDrawerToolbarAction = {
|
package/dist/index.d.ts
CHANGED
|
@@ -470,7 +470,7 @@ declare const UserServices: {
|
|
|
470
470
|
updateUser: (id: number, data: Partial<User$1>, token: string) => Promise<unknown>;
|
|
471
471
|
deleteUser: (id: number, token: string) => Promise<unknown>;
|
|
472
472
|
getEntityUsers: (entityId: number, token: string) => Promise<unknown>;
|
|
473
|
-
getuserEntitiesAccess: (
|
|
473
|
+
getuserEntitiesAccess: (token: string) => Promise<unknown>;
|
|
474
474
|
addUserToEntity: (entityId: number, userId: number, token: string) => Promise<unknown>;
|
|
475
475
|
updateMyProfile: (data: UpdateProfileData) => Promise<unknown>;
|
|
476
476
|
updateProfilePicture: (file: File) => Promise<unknown>;
|
|
@@ -946,6 +946,7 @@ type FDrawerLineAction = {
|
|
|
946
946
|
permission: string;
|
|
947
947
|
navigate?: string;
|
|
948
948
|
onclick?: (item: any) => any;
|
|
949
|
+
condition?: (item: any) => boolean;
|
|
949
950
|
};
|
|
950
951
|
type ViewMode$1 = 'table' | 'grid';
|
|
951
952
|
type FDrawerToolbarAction = {
|
package/dist/index.js
CHANGED
|
@@ -1361,8 +1361,8 @@ var UserServices = {
|
|
|
1361
1361
|
deleteUser: (id, token) => FetchApi.delete(`${USERS_API_URL}${id}/`, token),
|
|
1362
1362
|
// Obtenir les utilisateurs d'une entité
|
|
1363
1363
|
getEntityUsers: (entityId, token) => FetchApi.get(`${API_URL}/core/entities/${entityId}/users/`, token),
|
|
1364
|
-
// Obtenir les entités auxquelles
|
|
1365
|
-
getuserEntitiesAccess: (
|
|
1364
|
+
// Obtenir les entités auxquelles l'utilisateur connecté a accès
|
|
1365
|
+
getuserEntitiesAccess: (token) => FetchApi.get(`${API_URL}/core/users/entities/`, token),
|
|
1366
1366
|
// Ajouter un utilisateur à une entité
|
|
1367
1367
|
addUserToEntity: (entityId, userId, token) => FetchApi.post(`${API_URL}/core/entities/${entityId}/users/`, { user_id: userId }, token),
|
|
1368
1368
|
// === Nouvelles méthodes pour le profil utilisateur ===
|
|
@@ -2077,19 +2077,19 @@ var MODULE_URLS = {
|
|
|
2077
2077
|
wiseHR: "https://rewise.praedium-tech.com/admin/human-capital/dashboard/"
|
|
2078
2078
|
},
|
|
2079
2079
|
development: {
|
|
2080
|
-
wiseConnect: "http://localhost:
|
|
2080
|
+
wiseConnect: "http://localhost:5177/admin/crm/trade-strategy/lead-insight/",
|
|
2081
2081
|
wiseReach: "http://localhost:5173/admin/marketing/dashboard/",
|
|
2082
|
-
wiseOps: "http://localhost:
|
|
2082
|
+
wiseOps: "http://localhost:5174/dashboard/",
|
|
2083
2083
|
wiseGuard: "http://localhost:5173/admin/security/dashboard/",
|
|
2084
2084
|
wiseThrive: "http://localhost:5173/dashboard/",
|
|
2085
|
-
wiseView: "http://localhost:
|
|
2085
|
+
wiseView: "http://localhost:5173/",
|
|
2086
2086
|
wiseProcess: "http://localhost:5173/workspace/sop-connect/",
|
|
2087
2087
|
wiseBill: "http://localhost:5173/admin/invoicing/insight/summary/",
|
|
2088
|
-
wiseBooks: "http://localhost:
|
|
2088
|
+
wiseBooks: "http://localhost:5176/admin/accounting/client/invoice-queue/",
|
|
2089
2089
|
wiseAsset: "#",
|
|
2090
2090
|
wiseCash: "http://localhost:5173/admin/finance/dashboard/",
|
|
2091
2091
|
wiseCollect: "http://localhost:5173/admin/recovery/collection/dashboard/",
|
|
2092
|
-
wiseProcure: "http://localhost:
|
|
2092
|
+
wiseProcure: "http://localhost:5175/",
|
|
2093
2093
|
wiseHR: "http://localhost:5173/admin/human-capital/dashboard/"
|
|
2094
2094
|
}
|
|
2095
2095
|
};
|
|
@@ -2986,7 +2986,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2986
2986
|
"button",
|
|
2987
2987
|
{
|
|
2988
2988
|
onClick: () => {
|
|
2989
|
-
|
|
2989
|
+
const env = localStorage.getItem("env") || "prod";
|
|
2990
|
+
window.location.href = env === "localhost" ? "http://localhost:5173/parameters/profit-cost-centers/" : "https://core.rewise.praedium-tech.com/parameters/profit-cost-centers/";
|
|
2990
2991
|
setShowUserMenu(false);
|
|
2991
2992
|
},
|
|
2992
2993
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
@@ -4547,6 +4548,7 @@ var FDrawer = ({
|
|
|
4547
4548
|
const [showOrdering, setShowOrdering] = useState10(null);
|
|
4548
4549
|
const [showFilters, setShowFilters] = useState10(null);
|
|
4549
4550
|
const [dropdownOpen, setDropdownOpen] = useState10(null);
|
|
4551
|
+
const [dropdownPos, setDropdownPos] = useState10({ top: 0, left: 0, openUp: false });
|
|
4550
4552
|
const [queryURL, setQueryURL] = useState10("");
|
|
4551
4553
|
const [reponseDetail, setReponseDetail] = useState10({
|
|
4552
4554
|
total_pages: null,
|
|
@@ -4605,6 +4607,7 @@ var FDrawer = ({
|
|
|
4605
4607
|
if (columnsPanelRef.current && !columnsPanelRef.current.contains(target)) {
|
|
4606
4608
|
setShowColumnsPanel(false);
|
|
4607
4609
|
}
|
|
4610
|
+
setDropdownOpen(null);
|
|
4608
4611
|
};
|
|
4609
4612
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4610
4613
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -5304,36 +5307,61 @@ var FDrawer = ({
|
|
|
5304
5307
|
"button",
|
|
5305
5308
|
{
|
|
5306
5309
|
type: "button",
|
|
5307
|
-
onClick: () =>
|
|
5310
|
+
onClick: (e) => {
|
|
5311
|
+
if (dropdownOpen === item.id) {
|
|
5312
|
+
setDropdownOpen(null);
|
|
5313
|
+
} else {
|
|
5314
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
5315
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
5316
|
+
const openUp = spaceBelow < 200;
|
|
5317
|
+
setDropdownPos({
|
|
5318
|
+
top: openUp ? rect.top : rect.bottom + 4,
|
|
5319
|
+
left: rect.right - 192,
|
|
5320
|
+
openUp
|
|
5321
|
+
});
|
|
5322
|
+
setDropdownOpen(item.id);
|
|
5323
|
+
}
|
|
5324
|
+
},
|
|
5308
5325
|
className: "p-1 rounded-full hover:bg-gray-100 transition-colors",
|
|
5309
5326
|
children: /* @__PURE__ */ jsx16(MoreVertical, { className: "w-4 h-4 text-gray-400" })
|
|
5310
5327
|
}
|
|
5311
5328
|
),
|
|
5312
|
-
dropdownOpen === item.id && /* @__PURE__ */ jsxs11(
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
handleDuplicate(item);
|
|
5329
|
+
dropdownOpen === item.id && /* @__PURE__ */ jsxs11(
|
|
5330
|
+
"div",
|
|
5331
|
+
{
|
|
5332
|
+
className: "fixed w-48 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-[9999]",
|
|
5333
|
+
style: {
|
|
5334
|
+
top: dropdownPos.openUp ? void 0 : dropdownPos.top,
|
|
5335
|
+
bottom: dropdownPos.openUp ? window.innerHeight - dropdownPos.top : void 0,
|
|
5336
|
+
left: Math.max(8, dropdownPos.left)
|
|
5337
|
+
},
|
|
5338
|
+
children: [
|
|
5339
|
+
actions.filter((action) => !action.permission || hasPermission(action.permission)).filter((action) => !action.condition || action.condition(item)).map(
|
|
5340
|
+
(action, index) => action.navigate ? /* @__PURE__ */ jsx16(Link3, { to: action.navigate, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index) : /* @__PURE__ */ jsx16("button", { onClick: () => {
|
|
5341
|
+
action.onclick && action.onclick(item);
|
|
5326
5342
|
setDropdownOpen(null);
|
|
5327
|
-
},
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5343
|
+
}, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index)
|
|
5344
|
+
),
|
|
5345
|
+
onDuplicate && /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
5346
|
+
/* @__PURE__ */ jsx16("div", { className: "border-t border-gray-100 my-1" }),
|
|
5347
|
+
/* @__PURE__ */ jsxs11(
|
|
5348
|
+
"button",
|
|
5349
|
+
{
|
|
5350
|
+
onClick: () => {
|
|
5351
|
+
handleDuplicate(item);
|
|
5352
|
+
setDropdownOpen(null);
|
|
5353
|
+
},
|
|
5354
|
+
className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2",
|
|
5355
|
+
children: [
|
|
5356
|
+
/* @__PURE__ */ jsx16(Copy, { className: "h-4 w-4" }),
|
|
5357
|
+
/* @__PURE__ */ jsx16("span", { children: "Dupliquer" })
|
|
5358
|
+
]
|
|
5359
|
+
}
|
|
5360
|
+
)
|
|
5361
|
+
] })
|
|
5362
|
+
]
|
|
5363
|
+
}
|
|
5364
|
+
)
|
|
5337
5365
|
] }) })
|
|
5338
5366
|
]
|
|
5339
5367
|
},
|
|
@@ -19155,7 +19183,7 @@ var CatalogueProductSelector = ({
|
|
|
19155
19183
|
};
|
|
19156
19184
|
const getBestPrice = (product) => {
|
|
19157
19185
|
const prices = product.supplier_prices || [];
|
|
19158
|
-
const homologatedPrices = prices.filter((sp) => sp.
|
|
19186
|
+
const homologatedPrices = prices.filter((sp) => sp.homologation_status === "approved");
|
|
19159
19187
|
if (homologatedPrices.length > 0) return homologatedPrices.sort((a, b) => a.unit_price - b.unit_price)[0];
|
|
19160
19188
|
return prices[0] || null;
|
|
19161
19189
|
};
|
|
@@ -19363,9 +19391,9 @@ var CatalogueProductSelector = ({
|
|
|
19363
19391
|
const price = supplierPrices.find((sp) => sp.vendor === Number(e.target.value));
|
|
19364
19392
|
if (price) updateSelectedPrice(productId, price);
|
|
19365
19393
|
},
|
|
19366
|
-
options: supplierPrices.filter((sp) => !onlyHomologated || sp.
|
|
19394
|
+
options: supplierPrices.filter((sp) => !onlyHomologated || sp.homologation_status === "approved").sort((a, b) => a.unit_price - b.unit_price).map((sp) => ({
|
|
19367
19395
|
value: String(sp.vendor),
|
|
19368
|
-
label: `${getSupplierName(sp)} - ${formatCurrency(sp.unit_price)}/${listItem.unit}${sp.
|
|
19396
|
+
label: `${getSupplierName(sp)} - ${formatCurrency(sp.unit_price)}/${listItem.unit}${sp.homologation_status === "approved" ? " (Homologu\xE9)" : ""}${sp.discount_percent ? ` (-${sp.discount_percent}%)` : ""}`
|
|
19369
19397
|
}))
|
|
19370
19398
|
}
|
|
19371
19399
|
)
|
|
@@ -20262,6 +20290,7 @@ import { jsx as jsx61, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
|
20262
20290
|
var PurchaseRequestsPage = () => {
|
|
20263
20291
|
const [refreshToggle, setRefreshToggle] = useState38(false);
|
|
20264
20292
|
const [showModal, setShowModal] = useState38(false);
|
|
20293
|
+
const [showAllRequests, setShowAllRequests] = useState38(false);
|
|
20265
20294
|
const [showPrintPreview, setShowPrintPreview] = useState38(false);
|
|
20266
20295
|
const [selectedPurchaseRequest, setSelectedPurchaseRequest] = useState38(null);
|
|
20267
20296
|
const { success, error: showError, confirm: confirm2 } = useToast();
|
|
@@ -20272,7 +20301,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20272
20301
|
setRefreshToggle((prev) => !prev);
|
|
20273
20302
|
};
|
|
20274
20303
|
const tabs = [
|
|
20275
|
-
{ id: "purchase_requests", label: "
|
|
20304
|
+
{ id: "purchase_requests", label: "Mes Demandes d'achat", icon: ClipboardCheck },
|
|
20276
20305
|
{ id: "my_gr_se", label: "My GR-SE", icon: ClipboardCheck }
|
|
20277
20306
|
];
|
|
20278
20307
|
const [activeTab, setActiveTab] = useState38("purchase_requests");
|
|
@@ -20281,12 +20310,18 @@ var PurchaseRequestsPage = () => {
|
|
|
20281
20310
|
{
|
|
20282
20311
|
title: "Proculink",
|
|
20283
20312
|
description: "G\xE9rez vos demandes d'achat",
|
|
20284
|
-
sideAction: /* @__PURE__ */ jsxs54(
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20313
|
+
sideAction: /* @__PURE__ */ jsxs54("div", { className: "flex gap-2", children: [
|
|
20314
|
+
/* @__PURE__ */ jsxs54(Buttons_default, { variant: "outline", onClick: () => setShowAllRequests(true), children: [
|
|
20315
|
+
/* @__PURE__ */ jsx61(ClipboardCheck, { className: "h-4 w-4 mr-2" }),
|
|
20316
|
+
" Toutes les DA"
|
|
20317
|
+
] }),
|
|
20318
|
+
/* @__PURE__ */ jsxs54(Buttons_default, { onClick: () => {
|
|
20319
|
+
setShowModal(true);
|
|
20320
|
+
setSelectedPurchaseRequest(null);
|
|
20321
|
+
}, children: [
|
|
20322
|
+
/* @__PURE__ */ jsx61(Plus9, { className: "h-4 w-4 mr-2" }),
|
|
20323
|
+
" Nouvelle demande"
|
|
20324
|
+
] })
|
|
20290
20325
|
] }),
|
|
20291
20326
|
tabs: /* @__PURE__ */ jsx61("nav", { className: "flex space-x-1 mt-4 overflow-x-auto", children: tabs.map((tab) => {
|
|
20292
20327
|
const Icon = tab.icon;
|
|
@@ -20385,6 +20420,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20385
20420
|
],
|
|
20386
20421
|
actions: [
|
|
20387
20422
|
{
|
|
20423
|
+
condition: (item) => loggedUser?.id === item.created_by,
|
|
20388
20424
|
label: "Modifier",
|
|
20389
20425
|
permission: "",
|
|
20390
20426
|
onclick: (item) => {
|
|
@@ -20406,6 +20442,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20406
20442
|
},
|
|
20407
20443
|
{
|
|
20408
20444
|
label: "Supprimer",
|
|
20445
|
+
condition: (item) => loggedUser?.id !== item.created_by,
|
|
20409
20446
|
permission: "",
|
|
20410
20447
|
onclick: (item) => {
|
|
20411
20448
|
if (item.status !== "draft") {
|
|
@@ -20515,7 +20552,59 @@ var PurchaseRequestsPage = () => {
|
|
|
20515
20552
|
}
|
|
20516
20553
|
)
|
|
20517
20554
|
}
|
|
20518
|
-
)
|
|
20555
|
+
),
|
|
20556
|
+
/* @__PURE__ */ jsx61(Modals_default, { title: "Toutes les demandes d'achat", open: showAllRequests, onClose: () => setShowAllRequests(false), width: "w-[90vw]", children: /* @__PURE__ */ jsx61(
|
|
20557
|
+
FDrawer,
|
|
20558
|
+
{
|
|
20559
|
+
apiEndpoint: "/procurement/purchase-requests/",
|
|
20560
|
+
columns: [
|
|
20561
|
+
{ key: "created_at", label: "Date de cr\xE9ation", type: "date", filterable: true, sortable: true, search_name: "created_at" },
|
|
20562
|
+
{ key: "request_number", label: "N\xB0 DA", type: "text", filterable: true, sortable: true, search_name: "request_number" },
|
|
20563
|
+
{ key: "requested_by_user", label: "Demandeur", type: "text", filterable: true, sortable: false, search_name: "requester__last_name" },
|
|
20564
|
+
{ key: "title", label: "Titre", type: "text", filterable: true, sortable: true, search_name: "title" },
|
|
20565
|
+
{ key: "amount", label: "Montant Estim\xE9", type: "number", filterable: true, sortable: true, search_name: "amount", formule: (item) => item.amount ? `${formatCurrency(item.amount)}` : "0 FCFA" },
|
|
20566
|
+
{
|
|
20567
|
+
key: "status",
|
|
20568
|
+
label: "Statut",
|
|
20569
|
+
type: "text",
|
|
20570
|
+
filterable: true,
|
|
20571
|
+
sortable: true,
|
|
20572
|
+
search_name: "status",
|
|
20573
|
+
filter_options: [
|
|
20574
|
+
{ value: "draft", label: "Brouillon" },
|
|
20575
|
+
{ value: "submitted", label: "Soumise" },
|
|
20576
|
+
{ value: "approved", label: "Approuv\xE9e" },
|
|
20577
|
+
{ value: "rejected", label: "Rejet\xE9e" },
|
|
20578
|
+
{ value: "in_sourcing", label: "En sourcing" },
|
|
20579
|
+
{ value: "completed", label: "Termin\xE9e" },
|
|
20580
|
+
{ value: "cancelled", label: "Annul\xE9e" }
|
|
20581
|
+
],
|
|
20582
|
+
formule: (item) => /* @__PURE__ */ jsx61(StatusBadge, { status: item.status })
|
|
20583
|
+
},
|
|
20584
|
+
{
|
|
20585
|
+
key: "sourcing_id",
|
|
20586
|
+
label: "Sourcing",
|
|
20587
|
+
type: "text",
|
|
20588
|
+
filterable: false,
|
|
20589
|
+
sortable: false,
|
|
20590
|
+
search_name: "sourcing_id",
|
|
20591
|
+
formule: (item) => {
|
|
20592
|
+
if (item.sourcing_id) {
|
|
20593
|
+
return /* @__PURE__ */ jsx61("span", { className: "bg-secondary text-[13px] text-primary px-4 py-1 rounded-[4px]", children: "SSJ" });
|
|
20594
|
+
}
|
|
20595
|
+
if (item.rfq) {
|
|
20596
|
+
return /* @__PURE__ */ jsx61("span", { className: "bg-secondary text-[13px] text-primary px-4 py-1 rounded-[4px]", children: "appel d'offre" });
|
|
20597
|
+
}
|
|
20598
|
+
return "N/A";
|
|
20599
|
+
}
|
|
20600
|
+
},
|
|
20601
|
+
{ key: "vendor", label: "Fournisseur", type: "text", filterable: true, sortable: true, search_name: "vendor", formule: (item) => item.po_details?.vendor_name ?? "", filter_endpoint: "/accounting/vendors/" },
|
|
20602
|
+
{ key: "po_amount", label: "Montant Reel", type: "number", filterable: true, sortable: true, search_name: "po_amount", formule: (item) => item.po_amount ? `${formatCurrency(item.po_amount)}` : "-" }
|
|
20603
|
+
],
|
|
20604
|
+
actions: [],
|
|
20605
|
+
ordering: "-created_at"
|
|
20606
|
+
}
|
|
20607
|
+
) })
|
|
20519
20608
|
]
|
|
20520
20609
|
}
|
|
20521
20610
|
);
|
|
@@ -20698,7 +20787,7 @@ import { useState as useState49, useEffect as useEffect36 } from "react";
|
|
|
20698
20787
|
var API_BASE_URL3 = `${API_URL}/core/permissions`;
|
|
20699
20788
|
|
|
20700
20789
|
// src/forms/UserForm.tsx
|
|
20701
|
-
import { Building2 as Building29, User as UserIcon3, X as X17 } from "lucide-react";
|
|
20790
|
+
import { Building2 as Building29, User as UserIcon3, X as X17, Shield as Shield3 } from "lucide-react";
|
|
20702
20791
|
import { Fragment as Fragment16, jsx as jsx74, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
20703
20792
|
|
|
20704
20793
|
// src/pages/organizations/DetailEntity.tsx
|