From 0d3c35d11288dab9f77c4d42d36e3f92b6af0bb9 Mon Sep 17 00:00:00 2001 From: Konstantin Savosteev Date: Tue, 2 Jul 2024 13:03:04 +0200 Subject: [PATCH] feat: copy order ID and copy Number --- .../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 @@