-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65b735c
commit 3125c91
Showing
1 changed file
with
36 additions
and
35 deletions.
There are no files selected for viewing
71 changes: 36 additions & 35 deletions
71
src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-list-widget.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
angular.module('virtoCommerce.orderModule') | ||
.controller('virtoCommerce.orderModule.customerOrderListWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', 'virtoCommerce.orderModule.order_res_customerOrders', | ||
function ($scope, bladeNavigationService, customerOrders) { | ||
var blade = $scope.widget.blade; | ||
.controller('virtoCommerce.orderModule.customerOrderListWidgetController', | ||
['$scope', 'platformWebApp.bladeNavigationService', 'virtoCommerce.orderModule.order_res_customerOrders', | ||
function ($scope, bladeNavigationService, customerOrders) { | ||
var blade = $scope.widget.blade; | ||
|
||
var searchCriteria = {}; | ||
if (blade.currentEntity) { | ||
if (blade.currentEntity.memberType === "Organization") { | ||
searchCriteria.organizationId = blade.currentEntityId; | ||
} | ||
else { | ||
var account = _.first(blade.currentEntity.securityAccounts) | ||
if (account) { | ||
searchCriteria.customerId = account.id; | ||
var searchCriteria = {}; | ||
if (blade.currentEntity) { | ||
if (blade.currentEntity.memberType === "Organization") { | ||
searchCriteria.organizationId = blade.currentEntityId; | ||
} | ||
else { | ||
var account = _.first(blade.currentEntity.securityAccounts) | ||
if (account) { | ||
searchCriteria.customerId = account.id; | ||
} | ||
} | ||
} | ||
} | ||
|
||
function refresh() { | ||
$scope.ordersCount = '...'; | ||
function refresh() { | ||
$scope.ordersCount = '...'; | ||
|
||
var countSearchCriteria = { | ||
responseGroup: "Default", | ||
take: 0 | ||
}; | ||
var countSearchCriteria = { | ||
responseGroup: "Default", | ||
take: 0 | ||
}; | ||
|
||
angular.extend(countSearchCriteria, searchCriteria); | ||
angular.extend(countSearchCriteria, searchCriteria); | ||
|
||
customerOrders.search(countSearchCriteria, function (data) { | ||
$scope.ordersCount = data.totalCount; | ||
}); | ||
} | ||
customerOrders.search(countSearchCriteria, function (data) { | ||
$scope.ordersCount = data.totalCount; | ||
}); | ||
} | ||
|
||
$scope.openBlade = function () { | ||
var newBlade = { | ||
id: 'orders', | ||
title: 'orders.blades.customerOrder-list.title', | ||
searchCriteria: searchCriteria, | ||
controller: 'virtoCommerce.orderModule.customerOrderListController', | ||
template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-list.tpl.html' | ||
$scope.openBlade = function () { | ||
var newBlade = { | ||
id: 'orders', | ||
title: 'orders.blades.customerOrder-list.title', | ||
searchCriteria: searchCriteria, | ||
controller: 'virtoCommerce.orderModule.customerOrderListController', | ||
template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-list.tpl.html' | ||
}; | ||
bladeNavigationService.showBlade(newBlade, blade); | ||
}; | ||
bladeNavigationService.showBlade(newBlade, blade); | ||
}; | ||
|
||
refresh() | ||
}]); | ||
refresh() | ||
}]); |