Skip to content

Commit

Permalink
VCST-774: fix empty date problem (#416)
Browse files Browse the repository at this point in the history
Co-authored-by: Oleg Zhuk <[email protected]>
  • Loading branch information
basilkot and OlegoO authored May 3, 2024
1 parent 4aaca96 commit bdef2c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
$scope.gridOptions.onExpand();
};
blade.onCollapse = function () {
$scope.gridOptions.onCollapse();
if ($scope.gridOptions.onCollapse) {
$scope.gridOptions.onCollapse();
}
};

// ui-grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,20 @@ angular.module('virtoCommerce.orderModule')
blade.currentEntity.status = status;
};

function clearCreatedDateIfEmpty(items) {
_.forEach(items, function (item) {
if (item.createdDate === '0001-01-01T00:00:00Z') {
item.createdDate = null;
}
});
}

blade.recalculate = function () {
blade.isLoading = true;
customerOrders.recalculate(blade.customerOrder, function (result) {
clearCreatedDateIfEmpty(result.inPayments);
clearCreatedDateIfEmpty(result.shipments);
clearCreatedDateIfEmpty(result.childrenOperations);
angular.copy(result, blade.customerOrder);

var idToFocus = document.activeElement.id;
Expand Down

0 comments on commit bdef2c4

Please sign in to comment.