From 59eb2dae56cbc976c4527e0436eb9141c96d2f28 Mon Sep 17 00:00:00 2001 From: Konstantin Savosteev Date: Wed, 3 Jul 2024 17:55:53 +0200 Subject: [PATCH] VCST-1467: copy order ID and copy Number (#423) --- .../Localizations/en.VirtoCommerce.Orders.json | 4 +++- .../Scripts/blades/customerOrder-list.js | 16 ++++++++++++++++ .../Scripts/blades/customerOrder-list.tpl.html | 18 ++++++++++++------ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json index e3729eef..0bc2c699 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json @@ -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" diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.js b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.js index e0672474..cf8a9935 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.js +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.js @@ -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", diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.tpl.html b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.tpl.html index 1423da68..63ccb3cc 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.tpl.html +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-list.tpl.html @@ -22,12 +22,18 @@