Skip to content

Commit

Permalink
VCST-156: correct pagination in subscription orders (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: AlexTzykin <[email protected]>
  • Loading branch information
ksavosteev and AlexTzykin committed Jan 17, 2024
1 parent 6c2f07d commit 2e1250d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CoreModule.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.OrdersModule.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.OrdersModule.Core" Version="3.426.2" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.447.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public virtual async Task<Subscription> TryCreateSubscriptionFromOrderAsync(Cust

//Generate numbers for new subscriptions
var store = await _storeService.GetNoCloneAsync(order.StoreId, StoreResponseGroup.StoreInfo.ToString());
var numberTemplate = store.Settings.GetSettingValue(ModuleConstants.Settings.General.NewNumberTemplate.Name, ModuleConstants.Settings.General.NewNumberTemplate.DefaultValue.ToString());
var numberTemplate = store.Settings.GetValue<string>(ModuleConstants.Settings.General.NewNumberTemplate);

if (paymentPlan != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public virtual async Task SaveSubscriptionsAsync(Subscription[] subscriptions)
if (string.IsNullOrEmpty(subscription.Number))
{
var store = await _storeService.GetNoCloneAsync(subscription.StoreId, StoreResponseGroup.StoreInfo.ToString());
var numberTemplate = store?.Settings.GetSettingValue(ModuleConstants.Settings.General.NewNumberTemplate.Name, ModuleConstants.Settings.General.NewNumberTemplate.DefaultValue.ToString());
var numberTemplate = store?.Settings.GetValue<string>(ModuleConstants.Settings.General.NewNumberTemplate);
subscription.Number = _uniqueNumberGenerator.GenerateNumber(numberTemplate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ angular.module('virtoCommerce.subscriptionModule')
};

if (blade.currentEntity.id) {
newBlade.refreshCallback = function () {
newBlade.refreshCallback = function (orderBlade, orderBladeCriteria) {
var criteria = {
subscriptionIds: [blade.currentEntity.id]
subscriptionIds: [blade.currentEntity.id],
sort: orderBladeCriteria.sort,
skip: orderBladeCriteria.skip,
take: orderBladeCriteria.take
};

return orders.search(criteria);
Expand All @@ -27,4 +30,18 @@ angular.module('virtoCommerce.subscriptionModule')
}
};

function refresh() {
$scope.ordersCount = '...';

var countSearchCriteria = {
subscriptionIds: [blade.entityNode.id],
take: 0
};

orders.search(countSearchCriteria, function (data) {
$scope.ordersCount = data.totalCount;
});
}

refresh();
}]);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="gridster-cnt" ng-click="openBlade()">
<div class="gridster-cnt" ng-click="openBlade()">
<div class="cnt-inner">
<div class="list-count">{{blade.currentEntity.customerOrders ? blade.currentEntity.customerOrders.length : '...'}}</div>
<div class="list-count">{{ordersCount | number:0}}</div>
<div class="list-t">{{'subscription.widgets.subscription-orders.title' | translate}}</div>
</div>
</div>
6 changes: 3 additions & 3 deletions src/VirtoCommerce.SubscriptionModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<id>VirtoCommerce.Subscription</id>
<version>3.402.0</version>
<version-tag />
<platformVersion>3.400.0</platformVersion>
<platformVersion>3.447.0</platformVersion>
<dependencies>
<dependency id="VirtoCommerce.Core" version="3.400.0" />
<dependency id="VirtoCommerce.Customer" version="3.400.0" />
<dependency id="VirtoCommerce.Notifications" version="3.400.0" />
<dependency id="VirtoCommerce.Orders" version="3.400.0" />
<dependency id="VirtoCommerce.Orders" version="3.426.2" />
<dependency id="VirtoCommerce.Store" version="3.400.0" />
</dependencies>
<title>Subscriptions</title>
Expand All @@ -31,4 +31,4 @@
<group>commerce</group>
</groups>
<useFullTypeNameInSwagger>false</useFullTypeNameInSwagger>
</module>
</module>

0 comments on commit 2e1250d

Please sign in to comment.