New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#VP-2481 add shipment item select #157
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3ca4940
#VP-2481
kostyrin e36bf3a
#VP-2481 fix save changes
kostyrin 371189a
Merge remote-tracking branch 'remotes/origin/dev' into feature/3.0.0/…
kostyrin e30f082
#VP-2481 fix when add new Shipment
kostyrin 7b02409
Merge branch 'dev' into feature/3.0.0/VP-2481-add-shipment-item-select
akak1977 d18c999
Merge branch 'dev' into feature/3.0.0/VP-2481-add-shipment-item-select
akak1977 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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
66 changes: 66 additions & 0 deletions
66
src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items-select.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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
angular.module('virtoCommerce.orderModule') | ||
.controller('virtoCommerce.orderModule.orderItemSelectController', ['$scope', 'platformWebApp.bladeUtils', | ||
function ($scope, bladeUtils) { | ||
var blade = $scope.blade; | ||
var bladeNavigationService = bladeUtils.bladeNavigationService; | ||
|
||
if (!blade.title) { | ||
blade.title = "Select Order items..."; | ||
} | ||
|
||
$scope.options = angular.extend({ | ||
showCheckingMultiple: true, | ||
allowCheckingItem: true, | ||
selectedItemIds: [], | ||
gridColumns: [] | ||
}, blade.options); | ||
|
||
blade.refresh = function () { | ||
$scope.items = angular.copy(blade.orderItems); | ||
_.each($scope.items, function (item) { | ||
item.quantityOnShipment = item.quantity; | ||
}); | ||
|
||
if ($scope.options.onItemsLoaded) { | ||
$scope.options.onItemsLoaded($scope.items); | ||
} | ||
|
||
blade.isLoading = false; | ||
}; | ||
|
||
blade.toolbarCommands = [ | ||
{ | ||
name: "orders.commands.add-item", icon: 'fa fa-plus', | ||
executeMethod: function (blade) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
var selectedItems = _.map(_.where($scope.items, {selected: true}), function(item) { | ||
return { lineItemId: item.id, lineItem: item, quantity: item.quantityOnShipment }; | ||
}); | ||
_.each(selectedItems, function (item) { | ||
blade.currentEntity.items.push(item); | ||
yecli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
bladeNavigationService.closeBlade(blade); | ||
}, | ||
canExecuteMethod: function () { | ||
return _.any($scope.items, function (x) { return x.selected; }); | ||
}, | ||
permission: blade.updatePermission | ||
}, | ||
{ | ||
name: "platform.commands.remove", icon: 'fa fa-trash-o', | ||
executeMethod: function () { | ||
var lineItems = blade.currentEntity.items; | ||
blade.currentEntity.items = _.difference(lineItems, _.filter(lineItems, function (x) { return x.selected })); | ||
blade.recalculateFn(); | ||
$scope.pageSettings.totalItems = blade.currentEntity.items.length; | ||
}, | ||
canExecuteMethod: function () { | ||
return _.any(blade.currentEntity.items, function (x) { return x.selected; }); | ||
}, | ||
permission: blade.updatePermission | ||
} | ||
]; | ||
|
||
blade.refresh(); | ||
|
||
}]); |
55 changes: 55 additions & 0 deletions
55
src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items-select.tpl.html
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<div class="blade-content __xlarge-wide"> | ||
<div class="blade-inner"> | ||
<div class="inner-block"> | ||
<form name="orderForm" novalidate></form> | ||
<div class="table-wrapper"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th class="table-col __product-control"> | ||
<label class="form-control __checkbox"> | ||
<input type="checkbox" ng-model="blade.selectedAll" ng-change="checkAll(blade.selectedAll)" /> | ||
<span class="check"></span> | ||
</label> | ||
</th> | ||
<th class="table-col __proudct-img"></th> | ||
<th class="table-col">{{ 'orders.blades.customerOrder-items.labels.item' | translate }}</th> | ||
<th class="table-col">{{ 'orders.blades.customerOrder-items.labels.quantity' | translate }}</th> | ||
<th class="table-col">{{ 'orders.blades.customerOrder-items.labels.available' | translate }}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr class="table-item" ng-repeat="data in items" ng-class="{'__selected': $index === blade.selectedNodeId}" ng-click='blade.selectedNodeId = $index'> | ||
<td class="table-col"> | ||
<label class="form-control __checkbox"> | ||
<input type="checkbox" ng-model="data.selected"> | ||
<span class="check"></span> | ||
</label> | ||
</td> | ||
<td class="table-col"> | ||
<div class="product-img"> | ||
<div class="image" style="background-image: url({{data.imageUrl}})" ng-if="data.imageUrl" ng-click="openItemDetail(data)"></div> | ||
<i class="table-ico fa fa-image" ng-if="!data.imageUrl" /> | ||
</div> | ||
</td> | ||
<td class="table-col"> | ||
<span ng-class="{'error': data.avail <= 0}">{{data.name}}</span> | ||
</td> | ||
<td class="table-col"> | ||
<div class="form-input __mini __inline"> | ||
<div class="form-input __mini __number"> | ||
<input smart-float num-type="integer" required ng-model="data.quantityOnShipment" ng-model-options="{ updateOn: 'blur' }" ng-change="blade.recalculateFn()" id="quantity{{$index}}" focus-on="quantity{{$index}}"> | ||
</div> | ||
</div> | ||
</td> | ||
<td class="table-col"> | ||
<span ng-class="{'error': data.avail <= 0}">{{(data.quantity || 0) | number:0}}</span> | ||
</td> | ||
|
||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ angular.module('virtoCommerce.orderModule') | |
openAddEntityWizard(); | ||
}, | ||
canExecuteMethod: function () { | ||
return false; | ||
return blade.currentEntity.operationType === 'Shipment'; | ||
}, | ||
permission: blade.updatePermission | ||
}, | ||
|
@@ -61,5 +61,43 @@ angular.module('virtoCommerce.orderModule') | |
}); | ||
}; | ||
|
||
function openAddEntityWizard() { | ||
var options = { | ||
checkItemFn: function (listItem, isSelected) { | ||
if (isSelected) { | ||
if (_.all(selectedProducts, function (x) { return x.id != listItem.id; })) { | ||
selectedProducts.push(listItem); | ||
} | ||
} | ||
else { | ||
selectedProducts = _.reject(selectedProducts, function (x) { return x.id == listItem.id; }); | ||
} | ||
} | ||
}; | ||
var newBlade = { | ||
id: "OrderItemsSelect", | ||
currentEntity: blade.currentEntity, | ||
orderItems: blade.parentBlade.parentBlade.currentEntity.items, | ||
title: "orders.blades.catalog-items-select.title", | ||
controller: 'virtoCommerce.orderModule.orderItemSelectController', | ||
template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-items-select.tpl.html', | ||
options: options, | ||
breadcrumbs: [], | ||
toolbarCommands: [ | ||
{ | ||
name: "orders.commands.add-selected", icon: 'fa fa-plus', | ||
executeMethod: function (blade) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
//addProductsToOrder(selectedProducts); | ||
selectedProducts.length = 0; | ||
bladeNavigationService.closeBlade(blade); | ||
}, | ||
canExecuteMethod: function () { | ||
return selectedProducts.length > 0; | ||
} | ||
}] | ||
}; | ||
bladeNavigationService.showBlade(newBlade, $scope.blade); | ||
} | ||
|
||
blade.refresh(); | ||
}]); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you test these scenarios to be confident that you don't introduce regress bugs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, there is no scenario - save new order with the new shipment with items.
How to do it? Without exists LineItemId?
there are no links with Order.LineItemId.
Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'LineItemId', table 'VirtoCommerce3.dbo.OrderShipmentItem'; column does not allow nulls. INSERT fails.
@akak1977 saving new shipment - fixed