@bjsdistribution/dms-client-return 0.0.58 → 0.0.60
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 +4 -4
- package/dist/dms-client-return.cjs.development.js +76 -72
- 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 +76 -72
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +3 -2
- package/src/components/order-daily-overview/store/store.ts +1 -1
- package/src/components/order-daily-overview/table/ReturnTable.tsx +5 -3
- package/src/components/order-view/hooks/useUpdateOrder.ts +3 -0
- package/src/components/order-view/index.tsx +0 -1
- package/src/components/order-view/modalsPopup/DeleteProduct.tsx +2 -2
- 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/order-details/expanded-content/footer/index.tsx +3 -5
- package/src/components/order-view/products-info/expanded-content/index.tsx +2 -1
- package/src/components/order-view/store.ts +27 -21
- package/src/index.tsx +5 -2
|
@@ -585,7 +585,7 @@ var loading = /*#__PURE__*/atom(false);
|
|
|
585
585
|
var useStatsLoading = function useStatsLoading() {
|
|
586
586
|
return useAtom(loading);
|
|
587
587
|
};
|
|
588
|
-
//
|
|
588
|
+
//order return page
|
|
589
589
|
var loadingState = /*#__PURE__*/atom(false);
|
|
590
590
|
var useLoading = function useLoading() {
|
|
591
591
|
return useAtom(loadingState);
|
|
@@ -815,10 +815,6 @@ var clientDataAtom = /*#__PURE__*/atom([]);
|
|
|
815
815
|
function useClientData() {
|
|
816
816
|
return useAtom(clientDataAtom);
|
|
817
817
|
}
|
|
818
|
-
var NotesLoading = /*#__PURE__*/atom(true);
|
|
819
|
-
var UseNotesLoading = function UseNotesLoading() {
|
|
820
|
-
return useAtom(NotesLoading);
|
|
821
|
-
};
|
|
822
818
|
var notes = /*#__PURE__*/atom([]);
|
|
823
819
|
function usegetNotes() {
|
|
824
820
|
return useAtom(notes);
|
|
@@ -851,9 +847,9 @@ var returnDataAtom = /*#__PURE__*/atom([]);
|
|
|
851
847
|
function useReturnData() {
|
|
852
848
|
return useAtom(returnDataAtom);
|
|
853
849
|
}
|
|
854
|
-
var
|
|
855
|
-
function
|
|
856
|
-
return useAtom(
|
|
850
|
+
var apiUpdateCalling = /*#__PURE__*/atom(false);
|
|
851
|
+
function useUpdateApiCall() {
|
|
852
|
+
return useAtom(apiUpdateCalling);
|
|
857
853
|
}
|
|
858
854
|
var liveRecalling = /*#__PURE__*/atom(false);
|
|
859
855
|
//re api call of live status
|
|
@@ -864,10 +860,14 @@ function useLiveRecalling() {
|
|
|
864
860
|
// export const useBulkUPdateDisabledState = () => {
|
|
865
861
|
// return useAtom(BulkUPdateDisabledState);
|
|
866
862
|
// };
|
|
867
|
-
var
|
|
868
|
-
|
|
869
|
-
return useAtom(
|
|
870
|
-
}
|
|
863
|
+
var auditLogLoadingState = /*#__PURE__*/atom(true);
|
|
864
|
+
function useAuditLogLoadingState() {
|
|
865
|
+
return useAtom(auditLogLoadingState);
|
|
866
|
+
}
|
|
867
|
+
var globalStateHitAuditLog = /*#__PURE__*/atom(false);
|
|
868
|
+
function useGlobalStateHitAuditLog() {
|
|
869
|
+
return useAtom(globalStateHitAuditLog);
|
|
870
|
+
}
|
|
871
871
|
// Popup state Manage
|
|
872
872
|
var initialState$1 = null;
|
|
873
873
|
var popupReducer = function popupReducer(state, action) {
|
|
@@ -1072,7 +1072,8 @@ function SelectionFilter() {
|
|
|
1072
1072
|
if (!currentSearch.includes('filter')) {
|
|
1073
1073
|
console.log('inside include');
|
|
1074
1074
|
// for dev
|
|
1075
|
-
navigate(
|
|
1075
|
+
//navigate(`filter?${queryParams.toString()}`);
|
|
1076
|
+
navigate("/orders/view/return/filter?" + queryParams.toString());
|
|
1076
1077
|
// for local
|
|
1077
1078
|
//navigate(`/filter?${queryParams.toString()}`);
|
|
1078
1079
|
}
|
|
@@ -1165,7 +1166,7 @@ function SelectionFilter() {
|
|
|
1165
1166
|
dispatch({
|
|
1166
1167
|
type: 'CLEAR_CLIENT'
|
|
1167
1168
|
});
|
|
1168
|
-
window.location.href = '/
|
|
1169
|
+
window.location.href = '/orders/view/return/';
|
|
1169
1170
|
}
|
|
1170
1171
|
}, [clearState]);
|
|
1171
1172
|
useEffect(function () {
|
|
@@ -5197,6 +5198,8 @@ var Container$y = /*#__PURE__*/styled.div(_templateObject3$h || (_templateObject
|
|
|
5197
5198
|
function useUpdateOrder() {
|
|
5198
5199
|
var controller;
|
|
5199
5200
|
var ssoToken = getCookie('id_token');
|
|
5201
|
+
var _useUpdateApiCall = useUpdateApiCall(),
|
|
5202
|
+
setCallApi = _useUpdateApiCall[1]; //single detail
|
|
5200
5203
|
var update = /*#__PURE__*/function () {
|
|
5201
5204
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
5202
5205
|
var endpoint, signal, requestOptions, response, json;
|
|
@@ -5239,9 +5242,10 @@ function useUpdateOrder() {
|
|
|
5239
5242
|
message: 'Success',
|
|
5240
5243
|
description: 'Order has been updated.'
|
|
5241
5244
|
});
|
|
5245
|
+
setCallApi(true);
|
|
5242
5246
|
return _context.abrupt("return", json);
|
|
5243
|
-
case
|
|
5244
|
-
_context.prev =
|
|
5247
|
+
case 19:
|
|
5248
|
+
_context.prev = 19;
|
|
5245
5249
|
_context.t0 = _context["catch"](4);
|
|
5246
5250
|
// setLoading(false);
|
|
5247
5251
|
// console.log(err, 'error');
|
|
@@ -5249,14 +5253,14 @@ function useUpdateOrder() {
|
|
|
5249
5253
|
message: 'Error',
|
|
5250
5254
|
description: "" + _context.t0 || 'An error has occurred. Please try again later.'
|
|
5251
5255
|
});
|
|
5252
|
-
case
|
|
5253
|
-
_context.prev =
|
|
5254
|
-
return _context.finish(
|
|
5255
|
-
case
|
|
5256
|
+
case 22:
|
|
5257
|
+
_context.prev = 22;
|
|
5258
|
+
return _context.finish(22);
|
|
5259
|
+
case 24:
|
|
5256
5260
|
case "end":
|
|
5257
5261
|
return _context.stop();
|
|
5258
5262
|
}
|
|
5259
|
-
}, _callee, null, [[4,
|
|
5263
|
+
}, _callee, null, [[4, 19, 22, 24]]);
|
|
5260
5264
|
}));
|
|
5261
5265
|
return function update(_x) {
|
|
5262
5266
|
return _ref.apply(this, arguments);
|
|
@@ -5279,8 +5283,8 @@ function OrderDetailsFooter() {
|
|
|
5279
5283
|
var _useAtom = useAtom(errorAtom),
|
|
5280
5284
|
errorState = _useAtom[0];
|
|
5281
5285
|
// const [, setLogsCallAPi] = useLogsCallAPi();
|
|
5282
|
-
var
|
|
5283
|
-
setCallApi =
|
|
5286
|
+
var _useUpdateApiCall = useUpdateApiCall(),
|
|
5287
|
+
setCallApi = _useUpdateApiCall[1]; //single detail
|
|
5284
5288
|
// const [, setNoteLoadingStore] = UseNotesLoading();
|
|
5285
5289
|
var errorFound = function errorFound() {
|
|
5286
5290
|
var isError = errorState.w3wError.length > 0 || errorState.emailError.length > 0 || errorState.homeContactError.length > 0 || errorState.workCOntanctError.length > 0 || errorState.mobileError.length > 0 || errorState.postCodeError.length > 0;
|
|
@@ -5311,12 +5315,12 @@ function OrderDetailsFooter() {
|
|
|
5311
5315
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5312
5316
|
while (1) switch (_context.prev = _context.next) {
|
|
5313
5317
|
case 0:
|
|
5314
|
-
setCallApi(true);
|
|
5315
5318
|
payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
|
|
5316
|
-
_context.next =
|
|
5319
|
+
_context.next = 3;
|
|
5317
5320
|
return updateOrder([payload]);
|
|
5318
|
-
case
|
|
5321
|
+
case 3:
|
|
5319
5322
|
response = _context.sent;
|
|
5323
|
+
setCallApi(false);
|
|
5320
5324
|
// setLogsCallAPi(prev => !prev);
|
|
5321
5325
|
if (response && (response == null || (_response$data = response.data) == null ? void 0 : _response$data.length) > 0) {
|
|
5322
5326
|
setOrderDetails(response == null ? void 0 : response.data[0]);
|
|
@@ -5416,25 +5420,25 @@ function AddNote() {
|
|
|
5416
5420
|
var ssoToken = getCookie('id_token');
|
|
5417
5421
|
var _usemoduleIds = usemoduleIds(),
|
|
5418
5422
|
moduleIds = _usemoduleIds[0];
|
|
5419
|
-
var
|
|
5420
|
-
|
|
5421
|
-
setNoteLoadingStore = _UseNotesLoading[1];
|
|
5423
|
+
var _useGlobalStateHitAud = useGlobalStateHitAuditLog(),
|
|
5424
|
+
setRecallAuditLog = _useGlobalStateHitAud[1];
|
|
5422
5425
|
// Save New Note
|
|
5423
5426
|
var _useState2 = useState(null),
|
|
5424
5427
|
notificationData = _useState2[0],
|
|
5425
5428
|
setNotificationData = _useState2[1];
|
|
5426
5429
|
var saveNote = /*#__PURE__*/function () {
|
|
5427
5430
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5428
|
-
var endpoint, payload, response
|
|
5431
|
+
var endpoint, payload, response;
|
|
5429
5432
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5430
5433
|
while (1) switch (_context.prev = _context.next) {
|
|
5431
5434
|
case 0:
|
|
5435
|
+
setRecallAuditLog(false);
|
|
5432
5436
|
if (noteText) {
|
|
5433
|
-
_context.next =
|
|
5437
|
+
_context.next = 3;
|
|
5434
5438
|
break;
|
|
5435
5439
|
}
|
|
5436
5440
|
return _context.abrupt("return");
|
|
5437
|
-
case
|
|
5441
|
+
case 3:
|
|
5438
5442
|
endpoint = getBaseEndpoint() + "/audit_logs/orders/";
|
|
5439
5443
|
payload = {
|
|
5440
5444
|
audit_logs: [{
|
|
@@ -5448,8 +5452,8 @@ function AddNote() {
|
|
|
5448
5452
|
manual: 1
|
|
5449
5453
|
}]
|
|
5450
5454
|
};
|
|
5451
|
-
_context.prev =
|
|
5452
|
-
_context.next =
|
|
5455
|
+
_context.prev = 5;
|
|
5456
|
+
_context.next = 8;
|
|
5453
5457
|
return fetch(endpoint, {
|
|
5454
5458
|
method: 'POST',
|
|
5455
5459
|
headers: {
|
|
@@ -5458,42 +5462,36 @@ function AddNote() {
|
|
|
5458
5462
|
},
|
|
5459
5463
|
body: JSON.stringify(payload)
|
|
5460
5464
|
});
|
|
5461
|
-
case
|
|
5465
|
+
case 8:
|
|
5462
5466
|
response = _context.sent;
|
|
5463
5467
|
// setNoteLoadingStore(false);
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
setNotificationData({
|
|
5467
|
-
type: 'success',
|
|
5468
|
+
if (response.ok) {
|
|
5469
|
+
notification.success({
|
|
5468
5470
|
message: 'Success',
|
|
5469
|
-
description:
|
|
5471
|
+
description: 'Note saved successfully.'
|
|
5470
5472
|
});
|
|
5471
|
-
setNoteLoadingStore(!NoteLoadingStore);
|
|
5472
5473
|
setNoteText('');
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
type: 'error',
|
|
5474
|
+
setRecallAuditLog(true);
|
|
5475
|
+
} else {
|
|
5476
|
+
notification.error({
|
|
5477
5477
|
message: 'Error',
|
|
5478
|
-
description:
|
|
5478
|
+
description: 'Failed to save note.'
|
|
5479
5479
|
});
|
|
5480
5480
|
}
|
|
5481
5481
|
_context.next = 15;
|
|
5482
5482
|
break;
|
|
5483
5483
|
case 12:
|
|
5484
5484
|
_context.prev = 12;
|
|
5485
|
-
_context.t0 = _context["catch"](
|
|
5486
|
-
// console.error('Error saving note:', error);
|
|
5487
|
-
// alert('Failed to save note');
|
|
5485
|
+
_context.t0 = _context["catch"](5);
|
|
5488
5486
|
notification.error({
|
|
5489
5487
|
message: 'Error',
|
|
5490
|
-
description:
|
|
5488
|
+
description: 'Failed to save note due to an error.'
|
|
5491
5489
|
});
|
|
5492
5490
|
case 15:
|
|
5493
5491
|
case "end":
|
|
5494
5492
|
return _context.stop();
|
|
5495
5493
|
}
|
|
5496
|
-
}, _callee, null, [[
|
|
5494
|
+
}, _callee, null, [[5, 12]]);
|
|
5497
5495
|
}));
|
|
5498
5496
|
return function saveNote() {
|
|
5499
5497
|
return _ref.apply(this, arguments);
|
|
@@ -5600,22 +5598,23 @@ function AuditLogs() {
|
|
|
5600
5598
|
var Container$C = /*#__PURE__*/styled.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"])));
|
|
5601
5599
|
|
|
5602
5600
|
var _templateObject$_, _templateObject2$L, _templateObject3$m;
|
|
5601
|
+
// import { useLocation } from 'react-router-dom';
|
|
5603
5602
|
function Notes() {
|
|
5604
5603
|
var _usemoduleIds = usemoduleIds(),
|
|
5605
5604
|
moduleIds = _usemoduleIds[0],
|
|
5606
5605
|
setModuleIds = _usemoduleIds[1];
|
|
5607
5606
|
var _useOrderId = useOrderId(),
|
|
5608
5607
|
orderId = _useOrderId[0];
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
var
|
|
5613
|
-
|
|
5608
|
+
// const location = useLocation();
|
|
5609
|
+
// const pathname = location.pathname;
|
|
5610
|
+
// const orderIdLocaation = pathname.split('/')[1];
|
|
5611
|
+
var _useGlobalStateHitAud = useGlobalStateHitAuditLog(),
|
|
5612
|
+
recallAuditLog = _useGlobalStateHitAud[0];
|
|
5613
|
+
var _useAuditLogLoadingSt = useAuditLogLoadingState(),
|
|
5614
|
+
setAuditLogLoading = _useAuditLogLoadingSt[1];
|
|
5614
5615
|
var _usegetNotes = usegetNotes(),
|
|
5615
5616
|
setNotes = _usegetNotes[1];
|
|
5616
5617
|
// const [loderStatus] = useCallAPi();
|
|
5617
|
-
var _SeteauditLogToggle = SeteauditLogToggle(),
|
|
5618
|
-
auditState = _SeteauditLogToggle[0];
|
|
5619
5618
|
// Fetch module IDs
|
|
5620
5619
|
var _useApiHook = useApiHook({
|
|
5621
5620
|
endpoint: 'audit_logs/modules/',
|
|
@@ -5646,7 +5645,7 @@ function Notes() {
|
|
|
5646
5645
|
}
|
|
5647
5646
|
}, [apiLoading, fetchedData]);
|
|
5648
5647
|
var _useApiHook2 = useApiHook({
|
|
5649
|
-
endpoint: "audit_logs/?module_id=" + (moduleIds == null ? void 0 : moduleIds.parentId) + "&module_object_id=" +
|
|
5648
|
+
endpoint: "audit_logs/?module_id=" + (moduleIds == null ? void 0 : moduleIds.parentId) + "&module_object_id=" + orderId,
|
|
5650
5649
|
method: 'GET',
|
|
5651
5650
|
performAction: false
|
|
5652
5651
|
}),
|
|
@@ -5654,7 +5653,6 @@ function Notes() {
|
|
|
5654
5653
|
NotesLoading = _useApiHook2.loading,
|
|
5655
5654
|
setShouldPerformAction = _useApiHook2.setShouldPerformAction;
|
|
5656
5655
|
useEffect(function () {
|
|
5657
|
-
var combinedArray = [];
|
|
5658
5656
|
if (moduleIds && orderId) {
|
|
5659
5657
|
setShouldPerformAction(true);
|
|
5660
5658
|
}
|
|
@@ -5664,16 +5662,18 @@ function Notes() {
|
|
|
5664
5662
|
}).map(function (item) {
|
|
5665
5663
|
return [item['ORDER-NOTE'], item['ORDER']];
|
|
5666
5664
|
}).flat().filter(Boolean);
|
|
5667
|
-
|
|
5665
|
+
// const orderData = NotesData?.data[0]?.ORDER || [];
|
|
5666
|
+
// const orderNotesData = NotesData?.data[1]?.['ORDER-NOTE'] || [];
|
|
5667
|
+
// const allNotes = [...orderData, ...orderNotesData];
|
|
5668
|
+
var combinedArray = updatedData.flat();
|
|
5668
5669
|
combinedArray.sort(function (a, b) {
|
|
5669
5670
|
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
|
|
5670
5671
|
});
|
|
5672
|
+
setNotes(combinedArray);
|
|
5673
|
+
recallAuditLog ? setShouldPerformAction(true) : setShouldPerformAction(false);
|
|
5671
5674
|
}
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
loading: NotesLoading
|
|
5675
|
-
});
|
|
5676
|
-
}, [moduleIds, NotesLoading, auditState, apiBaseLoading]);
|
|
5675
|
+
setAuditLogLoading(NotesLoading);
|
|
5676
|
+
}, [moduleIds, orderId, NotesLoading, recallAuditLog]);
|
|
5677
5677
|
return React.createElement(Container$D, null, React.createElement(CardHeader, null, "NOTES"), React.createElement(CustomizedFormSection, null, React.createElement(AddNote, null), React.createElement(AuditLogs, null)));
|
|
5678
5678
|
}
|
|
5679
5679
|
var Container$D = /*#__PURE__*/styled.div(_templateObject$_ || (_templateObject$_ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 5px;\n"])));
|
|
@@ -6595,7 +6595,8 @@ function ExpandedContent$2() {
|
|
|
6595
6595
|
}
|
|
6596
6596
|
//@ts-ignore
|
|
6597
6597
|
if ((response == null ? void 0 : response.code) === 200 && newId) {
|
|
6598
|
-
|
|
6598
|
+
// suggested by rahul
|
|
6599
|
+
navigate("" + newId);
|
|
6599
6600
|
setSelectedProducts([]);
|
|
6600
6601
|
}
|
|
6601
6602
|
}, [response, newId, navigate, setSelectedProducts]);
|
|
@@ -11582,7 +11583,8 @@ var ReturnTable$1 = function ReturnTable() {
|
|
|
11582
11583
|
customerId: customerId == null ? void 0 : customerId.toString()
|
|
11583
11584
|
});
|
|
11584
11585
|
//for dev
|
|
11585
|
-
navigate(
|
|
11586
|
+
//navigate(`filter?${queryParams.toString()}`);
|
|
11587
|
+
navigate("/orders/view/return/filter?" + queryParams.toString());
|
|
11586
11588
|
//for local
|
|
11587
11589
|
//navigate(`/filter?${queryParams.toString()}`);
|
|
11588
11590
|
};
|
|
@@ -11608,13 +11610,12 @@ var ReturnTable$1 = function ReturnTable() {
|
|
|
11608
11610
|
type: RTS
|
|
11609
11611
|
});
|
|
11610
11612
|
//for dev
|
|
11611
|
-
navigate(
|
|
11613
|
+
//navigate(`filter?${queryParams.toString()}`);
|
|
11614
|
+
navigate("/orders/view/return/filter?" + queryParams.toString());
|
|
11612
11615
|
//for local
|
|
11613
11616
|
//navigate(`/filter?${queryParams.toString()}`);
|
|
11614
11617
|
};
|
|
11615
|
-
return React.createElement(React.Fragment, null, statsLoading && React.createElement(Loader, null), React.createElement(StyledTableWrapper, {
|
|
11616
|
-
id: "tableScrolling"
|
|
11617
|
-
}, React.createElement(StyledTable, null, React.createElement("thead", null, React.createElement("tr", null, [{
|
|
11618
|
+
return React.createElement(React.Fragment, null, statsLoading && React.createElement(Loader, null), React.createElement(StyledTableWrapper, null, React.createElement(StyledTable, null, React.createElement("thead", null, React.createElement("tr", null, [{
|
|
11618
11619
|
label: 'Trading Name',
|
|
11619
11620
|
key: 'trading_as'
|
|
11620
11621
|
}, {
|
|
@@ -11854,6 +11855,8 @@ function ReturnClient() {
|
|
|
11854
11855
|
setSelectedClient = _useSelectedClient[1];
|
|
11855
11856
|
var _useSearchParams = useSearchParams(),
|
|
11856
11857
|
searchParams = _useSearchParams[0];
|
|
11858
|
+
var _useSelectedLocation = useSelectedLocation(),
|
|
11859
|
+
setSelectedLocationValue = _useSelectedLocation[1];
|
|
11857
11860
|
var splitPath = function splitPath(str) {
|
|
11858
11861
|
var _str$split;
|
|
11859
11862
|
var parts = str == null || (_str$split = str.split('/')) == null ? void 0 : _str$split.filter(function (part) {
|
|
@@ -11868,6 +11871,7 @@ function ReturnClient() {
|
|
|
11868
11871
|
setLocationOptions([]);
|
|
11869
11872
|
setSelectedClient(null);
|
|
11870
11873
|
setSelectedFilterValue(null);
|
|
11874
|
+
setSelectedLocationValue(null);
|
|
11871
11875
|
}
|
|
11872
11876
|
}, [location.pathname, searchParams]);
|
|
11873
11877
|
// useEffect(() => {
|