Skip to content

Commit

Permalink
Merge branch 'release/3.810.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Mar 27, 2024
2 parents 243af73 + 825aaf3 commit 223cdcf
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.809.0</VersionPrefix>
<VersionPrefix>3.810.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"labels": {
"new-filter": "Add new filter",
"unnamed-filter": "Unnamed filter",
"last-day-filter": "Last 24 hours",
"last-week-filter": "Last week",
"last-month-filter": "Last month",
"last-year-filter": "Last year",
"number": "Order number",
"customer": "Customer",
"confirmed": "Confirmed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
if (!$localStorage.orderSearchFilters) {
$localStorage.orderSearchFilters = [{ name: 'orders.blades.customerOrder-list.labels.new-filter' }];
}

addPredefinedFilters($localStorage.orderSearchFilters);

if ($localStorage.orderSearchFilterId) {
filter.current = _.findWhere($localStorage.orderSearchFilters, { id: $localStorage.orderSearchFilterId });
}
Expand Down Expand Up @@ -241,6 +244,55 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
$scope.useIndexedSearch = data.result;
});

function buildPredefinedFilters() {
var currentDate = new Date();
var day = 24 * 60 * 60 * 1000;
var days7 = 7 * day;
var days30 = 30 * day;
var days365 = 365 * day;
var currentDateUtcString = currentDate.toISOString();

return [
{
name: 'orders.blades.customerOrder-list.labels.last-day-filter',
id: 'last-day',
startDate: new Date(currentDate.getTime() - day).toISOString(),
endDate: currentDateUtcString
},
{
name: 'orders.blades.customerOrder-list.labels.last-week-filter',
id: 'last-week',
startDate: new Date(currentDate.getTime() - days7).toISOString(),
endDate: currentDateUtcString
},
{
name: 'orders.blades.customerOrder-list.labels.last-month-filter',
id: 'last-month',
startDate: new Date(currentDate.getTime() - days30).toISOString(),
endDate: currentDateUtcString
},
{
name: 'orders.blades.customerOrder-list.labels.last-year-filter',
id: 'last-year',
startDate: new Date(currentDate.getTime() - days365).toISOString(),
endDate: currentDateUtcString
}
];
}

function addPredefinedFilters(baseFilters) {
var predefinedFilters = buildPredefinedFilters();

// add or replace predefinded filters in base filters
for (var i = 0; i < predefinedFilters.length; i++) {
var predefinedFilter = _.findWhere(baseFilters, { id: predefinedFilters[i].id });
if (predefinedFilter) {
angular.extend(predefinedFilter, predefinedFilters[i]);
} else {
baseFilters.push(predefinedFilters[i]);
}
}
}

// actions on load
//No need to call this because page 'pageSettings.currentPage' is watched!!! It would trigger subsequent duplicated req...
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.OrdersModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<id>VirtoCommerce.Orders</id>
<version>3.809.0</version>
<version>3.810.0</version>
<version-tag />
<platformVersion>3.800.0</platformVersion>
<dependencies>
Expand Down

0 comments on commit 223cdcf

Please sign in to comment.