@bjsdistribution/dms-client-return 0.0.58 → 0.0.59
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/components/order-view/store.d.ts +2 -3
- package/dist/dms-client-return.cjs.development.js +44 -48
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +44 -48
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-view/notes/AddNote.tsx +11 -17
- package/src/components/order-view/notes/index.tsx +24 -15
- package/src/components/order-view/store.ts +14 -14
|
@@ -86,7 +86,6 @@ declare function useSelectedProductId(): [number | undefined, (args_0: number |
|
|
|
86
86
|
export declare function useReturnAfterOrderData(): [any[], (args_0: any[] | ((prev: any[]) => any[])) => void];
|
|
87
87
|
declare function useClientData(): [ClientData[], (args_0: ClientData[] | ((prev: ClientData[]) => ClientData[])) => void];
|
|
88
88
|
export { useAtom, useOrderDetails, useCustomerDetails, useProductDetails, useDepotDetails, useStatusDetails, useDepotOptions, usePrevOrderDetails, useEscData, useDeleteProdsID, useCreateOrderProducts, useRecieveOrderProducts, useUpdateOrderProducts, useOrderProductsResources, useOrderProductsToolbox, useOrderProductSystemLogs, useEventNotesData, useSelectedProductId, useSelectedProductActionTabKey, useClientData, };
|
|
89
|
-
export declare const UseNotesLoading: () => [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
90
89
|
export declare function usegetNotes(): [any, (args_0: any) => void];
|
|
91
90
|
export declare function usemoduleIds(): [{
|
|
92
91
|
id?: string | undefined;
|
|
@@ -111,7 +110,6 @@ export declare function useGsitOrderId(): [number | undefined, (args_0: number |
|
|
|
111
110
|
export declare function useOrderProductId(): [number | undefined, (args_0: number | ((prev: number | undefined) => number | undefined) | undefined) => void];
|
|
112
111
|
export declare function useReturnData(): [any[], (args_0: any[] | ((prev: any[]) => any[])) => void];
|
|
113
112
|
export declare function useApiCalling(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
114
|
-
export declare function useGlobalStateHitAuditLog(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
115
113
|
export declare function useLiveRecalling(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
116
114
|
export declare const selectedTabKeyAtom: import("jotai/esm/").PrimitiveAtom<string> & {
|
|
117
115
|
init: string;
|
|
@@ -119,7 +117,8 @@ export declare const selectedTabKeyAtom: import("jotai/esm/").PrimitiveAtom<stri
|
|
|
119
117
|
export declare const letselectedProductIdAtom: import("jotai/esm/").PrimitiveAtom<number | null> & {
|
|
120
118
|
init: number | null;
|
|
121
119
|
};
|
|
122
|
-
export declare
|
|
120
|
+
export declare function useAuditLogLoadingState(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
121
|
+
export declare function useGlobalStateHitAuditLog(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
|
|
123
122
|
export declare const countReducerAtom: import("jotai/esm/").WritableAtom<{
|
|
124
123
|
state: any;
|
|
125
124
|
} | null, [any?], void>;
|
|
@@ -823,10 +823,6 @@ var clientDataAtom = /*#__PURE__*/jotai.atom([]);
|
|
|
823
823
|
function useClientData() {
|
|
824
824
|
return jotai.useAtom(clientDataAtom);
|
|
825
825
|
}
|
|
826
|
-
var NotesLoading = /*#__PURE__*/jotai.atom(true);
|
|
827
|
-
var UseNotesLoading = function UseNotesLoading() {
|
|
828
|
-
return jotai.useAtom(NotesLoading);
|
|
829
|
-
};
|
|
830
826
|
var notes = /*#__PURE__*/jotai.atom([]);
|
|
831
827
|
function usegetNotes() {
|
|
832
828
|
return jotai.useAtom(notes);
|
|
@@ -872,10 +868,14 @@ function useLiveRecalling() {
|
|
|
872
868
|
// export const useBulkUPdateDisabledState = () => {
|
|
873
869
|
// return useAtom(BulkUPdateDisabledState);
|
|
874
870
|
// };
|
|
875
|
-
var
|
|
876
|
-
|
|
877
|
-
return jotai.useAtom(
|
|
878
|
-
}
|
|
871
|
+
var auditLogLoadingState = /*#__PURE__*/jotai.atom(true);
|
|
872
|
+
function useAuditLogLoadingState() {
|
|
873
|
+
return jotai.useAtom(auditLogLoadingState);
|
|
874
|
+
}
|
|
875
|
+
var globalStateHitAuditLog = /*#__PURE__*/jotai.atom(false);
|
|
876
|
+
function useGlobalStateHitAuditLog() {
|
|
877
|
+
return jotai.useAtom(globalStateHitAuditLog);
|
|
878
|
+
}
|
|
879
879
|
// Popup state Manage
|
|
880
880
|
var initialState$1 = null;
|
|
881
881
|
var popupReducer = function popupReducer(state, action) {
|
|
@@ -5424,25 +5424,25 @@ function AddNote() {
|
|
|
5424
5424
|
var ssoToken = getCookie('id_token');
|
|
5425
5425
|
var _usemoduleIds = usemoduleIds(),
|
|
5426
5426
|
moduleIds = _usemoduleIds[0];
|
|
5427
|
-
var
|
|
5428
|
-
|
|
5429
|
-
setNoteLoadingStore = _UseNotesLoading[1];
|
|
5427
|
+
var _useGlobalStateHitAud = useGlobalStateHitAuditLog(),
|
|
5428
|
+
setRecallAuditLog = _useGlobalStateHitAud[1];
|
|
5430
5429
|
// Save New Note
|
|
5431
5430
|
var _useState2 = React.useState(null),
|
|
5432
5431
|
notificationData = _useState2[0],
|
|
5433
5432
|
setNotificationData = _useState2[1];
|
|
5434
5433
|
var saveNote = /*#__PURE__*/function () {
|
|
5435
5434
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5436
|
-
var endpoint, payload, response
|
|
5435
|
+
var endpoint, payload, response;
|
|
5437
5436
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5438
5437
|
while (1) switch (_context.prev = _context.next) {
|
|
5439
5438
|
case 0:
|
|
5439
|
+
setRecallAuditLog(false);
|
|
5440
5440
|
if (noteText) {
|
|
5441
|
-
_context.next =
|
|
5441
|
+
_context.next = 3;
|
|
5442
5442
|
break;
|
|
5443
5443
|
}
|
|
5444
5444
|
return _context.abrupt("return");
|
|
5445
|
-
case
|
|
5445
|
+
case 3:
|
|
5446
5446
|
endpoint = dmsComponentLibrary.getBaseEndpoint() + "/audit_logs/orders/";
|
|
5447
5447
|
payload = {
|
|
5448
5448
|
audit_logs: [{
|
|
@@ -5456,8 +5456,8 @@ function AddNote() {
|
|
|
5456
5456
|
manual: 1
|
|
5457
5457
|
}]
|
|
5458
5458
|
};
|
|
5459
|
-
_context.prev =
|
|
5460
|
-
_context.next =
|
|
5459
|
+
_context.prev = 5;
|
|
5460
|
+
_context.next = 8;
|
|
5461
5461
|
return fetch(endpoint, {
|
|
5462
5462
|
method: 'POST',
|
|
5463
5463
|
headers: {
|
|
@@ -5466,42 +5466,36 @@ function AddNote() {
|
|
|
5466
5466
|
},
|
|
5467
5467
|
body: JSON.stringify(payload)
|
|
5468
5468
|
});
|
|
5469
|
-
case
|
|
5469
|
+
case 8:
|
|
5470
5470
|
response = _context.sent;
|
|
5471
5471
|
// setNoteLoadingStore(false);
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
setNotificationData({
|
|
5475
|
-
type: 'success',
|
|
5472
|
+
if (response.ok) {
|
|
5473
|
+
antd.notification.success({
|
|
5476
5474
|
message: 'Success',
|
|
5477
|
-
description:
|
|
5475
|
+
description: 'Note saved successfully.'
|
|
5478
5476
|
});
|
|
5479
|
-
setNoteLoadingStore(!NoteLoadingStore);
|
|
5480
5477
|
setNoteText('');
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
type: 'error',
|
|
5478
|
+
setRecallAuditLog(true);
|
|
5479
|
+
} else {
|
|
5480
|
+
antd.notification.error({
|
|
5485
5481
|
message: 'Error',
|
|
5486
|
-
description:
|
|
5482
|
+
description: 'Failed to save note.'
|
|
5487
5483
|
});
|
|
5488
5484
|
}
|
|
5489
5485
|
_context.next = 15;
|
|
5490
5486
|
break;
|
|
5491
5487
|
case 12:
|
|
5492
5488
|
_context.prev = 12;
|
|
5493
|
-
_context.t0 = _context["catch"](
|
|
5494
|
-
// console.error('Error saving note:', error);
|
|
5495
|
-
// alert('Failed to save note');
|
|
5489
|
+
_context.t0 = _context["catch"](5);
|
|
5496
5490
|
antd.notification.error({
|
|
5497
5491
|
message: 'Error',
|
|
5498
|
-
description:
|
|
5492
|
+
description: 'Failed to save note due to an error.'
|
|
5499
5493
|
});
|
|
5500
5494
|
case 15:
|
|
5501
5495
|
case "end":
|
|
5502
5496
|
return _context.stop();
|
|
5503
5497
|
}
|
|
5504
|
-
}, _callee, null, [[
|
|
5498
|
+
}, _callee, null, [[5, 12]]);
|
|
5505
5499
|
}));
|
|
5506
5500
|
return function saveNote() {
|
|
5507
5501
|
return _ref.apply(this, arguments);
|
|
@@ -5608,22 +5602,23 @@ function AuditLogs() {
|
|
|
5608
5602
|
var Container$C = /*#__PURE__*/styled__default.div(_templateObject$Z || (_templateObject$Z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 295px; /* Set height to limit container size */\n overflow: auto; /* Enable scrolling */\n scrollbar-width: thin;\n"])));
|
|
5609
5603
|
|
|
5610
5604
|
var _templateObject$_, _templateObject2$L, _templateObject3$m;
|
|
5605
|
+
// import { useLocation } from 'react-router-dom';
|
|
5611
5606
|
function Notes() {
|
|
5612
5607
|
var _usemoduleIds = usemoduleIds(),
|
|
5613
5608
|
moduleIds = _usemoduleIds[0],
|
|
5614
5609
|
setModuleIds = _usemoduleIds[1];
|
|
5615
5610
|
var _useOrderId = useOrderId(),
|
|
5616
5611
|
orderId = _useOrderId[0];
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
var
|
|
5621
|
-
|
|
5612
|
+
// const location = useLocation();
|
|
5613
|
+
// const pathname = location.pathname;
|
|
5614
|
+
// const orderIdLocaation = pathname.split('/')[1];
|
|
5615
|
+
var _useGlobalStateHitAud = useGlobalStateHitAuditLog(),
|
|
5616
|
+
recallAuditLog = _useGlobalStateHitAud[0];
|
|
5617
|
+
var _useAuditLogLoadingSt = useAuditLogLoadingState(),
|
|
5618
|
+
setAuditLogLoading = _useAuditLogLoadingSt[1];
|
|
5622
5619
|
var _usegetNotes = usegetNotes(),
|
|
5623
5620
|
setNotes = _usegetNotes[1];
|
|
5624
5621
|
// const [loderStatus] = useCallAPi();
|
|
5625
|
-
var _SeteauditLogToggle = SeteauditLogToggle(),
|
|
5626
|
-
auditState = _SeteauditLogToggle[0];
|
|
5627
5622
|
// Fetch module IDs
|
|
5628
5623
|
var _useApiHook = dmsComponentLibrary.useApiHook({
|
|
5629
5624
|
endpoint: 'audit_logs/modules/',
|
|
@@ -5654,7 +5649,7 @@ function Notes() {
|
|
|
5654
5649
|
}
|
|
5655
5650
|
}, [apiLoading, fetchedData]);
|
|
5656
5651
|
var _useApiHook2 = dmsComponentLibrary.useApiHook({
|
|
5657
|
-
endpoint: "audit_logs/?module_id=" + (moduleIds == null ? void 0 : moduleIds.parentId) + "&module_object_id=" +
|
|
5652
|
+
endpoint: "audit_logs/?module_id=" + (moduleIds == null ? void 0 : moduleIds.parentId) + "&module_object_id=" + orderId,
|
|
5658
5653
|
method: 'GET',
|
|
5659
5654
|
performAction: false
|
|
5660
5655
|
}),
|
|
@@ -5662,7 +5657,6 @@ function Notes() {
|
|
|
5662
5657
|
NotesLoading = _useApiHook2.loading,
|
|
5663
5658
|
setShouldPerformAction = _useApiHook2.setShouldPerformAction;
|
|
5664
5659
|
React.useEffect(function () {
|
|
5665
|
-
var combinedArray = [];
|
|
5666
5660
|
if (moduleIds && orderId) {
|
|
5667
5661
|
setShouldPerformAction(true);
|
|
5668
5662
|
}
|
|
@@ -5672,16 +5666,18 @@ function Notes() {
|
|
|
5672
5666
|
}).map(function (item) {
|
|
5673
5667
|
return [item['ORDER-NOTE'], item['ORDER']];
|
|
5674
5668
|
}).flat().filter(Boolean);
|
|
5675
|
-
|
|
5669
|
+
// const orderData = NotesData?.data[0]?.ORDER || [];
|
|
5670
|
+
// const orderNotesData = NotesData?.data[1]?.['ORDER-NOTE'] || [];
|
|
5671
|
+
// const allNotes = [...orderData, ...orderNotesData];
|
|
5672
|
+
var combinedArray = updatedData.flat();
|
|
5676
5673
|
combinedArray.sort(function (a, b) {
|
|
5677
5674
|
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
|
|
5678
5675
|
});
|
|
5676
|
+
setNotes(combinedArray);
|
|
5677
|
+
recallAuditLog ? setShouldPerformAction(true) : setShouldPerformAction(false);
|
|
5679
5678
|
}
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
loading: NotesLoading
|
|
5683
|
-
});
|
|
5684
|
-
}, [moduleIds, NotesLoading, auditState, apiBaseLoading]);
|
|
5679
|
+
setAuditLogLoading(NotesLoading);
|
|
5680
|
+
}, [moduleIds, orderId, NotesLoading, recallAuditLog]);
|
|
5685
5681
|
return React__default.createElement(Container$D, null, React__default.createElement(CardHeader, null, "NOTES"), React__default.createElement(CustomizedFormSection, null, React__default.createElement(AddNote, null), React__default.createElement(AuditLogs, null)));
|
|
5686
5682
|
}
|
|
5687
5683
|
var Container$D = /*#__PURE__*/styled__default.div(_templateObject$_ || (_templateObject$_ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 5px;\n"])));
|