Skip to content

Commit

Permalink
VCST-1467: copy order ID and copy Number (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksavosteev authored Jul 3, 2024
1 parent 3982f20 commit 59eb2da
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
"total": "Total",
"currency": "Currency",
"store": "Store",
"created": "Created"
"created": "Created",
"copy-id": "Copy ID",
"copy-number": "Copy number"
},
"placeholders": {
"select-filter": "Select filter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
}
};

$scope.copy = function (text) {
var copyElement = document.createElement("span");
copyElement.appendChild(document.createTextNode(text));
copyElement.id = 'tempCopyToClipboard';
angular.element(document.body.append(copyElement));

var range = document.createRange();
range.selectNode(copyElement);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);

document.execCommand('copy');
window.getSelection().removeAllRanges();
copyElement.remove();
};

$scope.deleteList = function (list) {
var dialog = {
id: "confirmDeleteItem",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@
<div class="table-wrapper" ng-init="setGridOptions('customerOrder-list-grid', getGridOptions())">
<div ui-grid="gridOptions" ui-grid-auto-resize ui-grid-save-state ui-grid-selection ui-grid-resize-columns ui-grid-move-columns ui-grid-pinning ui-grid-height></div>
<ul class="menu __context" role="menu" id="cor_menu">
<li class="menu-item" ng-click='selectNode(contextMenuEntity)'>
<i class="menu-ico fa fa-edit"></i> {{'platform.commands.manage' | translate}}
</li>
<li class="menu-item" ng-if='!blade.hideDelete' ng-click='deleteList([contextMenuEntity])' va-permission="order:delete">
<i class="menu-ico fas fa-trash-alt"></i> {{'platform.commands.delete' | translate}}
</li>
<li class="menu-item" ng-click='selectNode(contextMenuEntity)'>
<i class="menu-ico fa fa-edit"></i> {{'platform.commands.manage' | translate}}
</li>
<li class="menu-item" ng-click='copy(contextMenuEntity.id)'>
<i class="menu-ico fa fa-copy"></i> {{'orders.blades.customerOrder-list.labels.copy-id' | translate}}
</li>
<li class="menu-item" ng-click='copy(contextMenuEntity.number)'>
<i class="menu-ico fa fa-copy"></i> {{'orders.blades.customerOrder-list.labels.copy-number' | translate}}
</li>
<li class="menu-item" ng-if='!blade.hideDelete' ng-click='deleteList([contextMenuEntity])' va-permission="order:delete">
<i class="menu-ico fas fa-trash-alt"></i> {{'platform.commands.delete' | translate}}
</li>
</ul>
</div>
</div>
Expand Down

0 comments on commit 59eb2da

Please sign in to comment.