From db96101082301bf56cd0abde8616fcc3e6e92168 Mon Sep 17 00:00:00 2001
From: tonyco97 <tonyco97.tc@gmail.com>
Date: Tue, 18 Feb 2025 18:10:52 +0100
Subject: [PATCH] feat: new post api for physical reconfiguration

---
 freepbx/wizard-ui/app/scripts/i18n/locale-en.json      |  3 ++-
 freepbx/wizard-ui/app/scripts/i18n/locale-it.json      |  1 +
 .../app/scripts/services/provisioning/phoneservice.js  | 10 ++++++++++
 .../app/views/configurations/preferences.html          |  4 ++--
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/freepbx/wizard-ui/app/scripts/i18n/locale-en.json b/freepbx/wizard-ui/app/scripts/i18n/locale-en.json
index a5372504e..e6c8dd5f4 100644
--- a/freepbx/wizard-ui/app/scripts/i18n/locale-en.json
+++ b/freepbx/wizard-ui/app/scripts/i18n/locale-en.json
@@ -171,5 +171,6 @@
   "extension left": "extension left",
   "privacy message notification": "The recording, possession, reproduction, communication or dissemination of telephone conversations outside of the cases permitted by law represents an offense. It is advisable to check that all the protections provided for by the Workers' Statute and the Privacy Code and the relevant applicable regulations have been adopted before activating this functionality.",
   "Warning": "Warning",
-  "Syncing message": "Users are syncing. Wait for the process to complete."
+  "Syncing message": "Users are syncing. Wait for the process to complete.",
+  "Reboot": "Reboot"
 }
diff --git a/freepbx/wizard-ui/app/scripts/i18n/locale-it.json b/freepbx/wizard-ui/app/scripts/i18n/locale-it.json
index 06469a340..d590d530c 100644
--- a/freepbx/wizard-ui/app/scripts/i18n/locale-it.json
+++ b/freepbx/wizard-ui/app/scripts/i18n/locale-it.json
@@ -687,6 +687,7 @@
   "Select model": "Seleziona il modello",
   "Add with copy/paste": "Aggiungi con copia/incolla",
   "Reboot": "Riavvio",
+  "Reconfigure": "Riconfigura",
   "Enable delayed reboot": "Abilita riavvio ritardato",
   "Reboot time": "Ora riavvio",
   "Select all": "Seleziona tutti",
diff --git a/freepbx/wizard-ui/app/scripts/services/provisioning/phoneservice.js b/freepbx/wizard-ui/app/scripts/services/provisioning/phoneservice.js
index be1e41900..6cc5b2f80 100644
--- a/freepbx/wizard-ui/app/scripts/services/provisioning/phoneservice.js
+++ b/freepbx/wizard-ui/app/scripts/services/provisioning/phoneservice.js
@@ -106,6 +106,16 @@ angular.module('nethvoiceWizardUiApp')
       });
     }
 
+    this.setPhoneReconfigure = function (reconfiguretData) {
+      return $q(function (resolve, reject) {
+        RestService.post('/phones/reconfigure', reconfiguretData).then(function (res) {
+          resolve(res);
+        }, function (err) {
+          reject(err);
+        });
+      });
+    }
+
     this.deletePhoneDelayedReboot = function (rebootCancelMacs) {
       return $q(function (resolve, reject) {
         RestService.deleteWithContentTypeJson('/phones/reboot', rebootCancelMacs).then(function (res) {
diff --git a/freepbx/wizard-ui/app/views/configurations/preferences.html b/freepbx/wizard-ui/app/views/configurations/preferences.html
index 68cf3de04..f15977c48 100644
--- a/freepbx/wizard-ui/app/views/configurations/preferences.html
+++ b/freepbx/wizard-ui/app/views/configurations/preferences.html
@@ -227,9 +227,9 @@ <h1 class="control-label centered" for="textInput-markup">{{'Users Configuration
                         uib-popover="{{!device.registered ? 'cant_reboot_not_registered' : '' | translate}}">
                         <button
                           class="btn btn-default"
-                          ng-click="rebootDevice(device)"
+                          ng-click="reconfigureDevice(device)"
                           ng-disabled="!device.registered">
-                          {{ 'Reboot' | translate }}
+                          {{ 'Reconfigure' | translate }}
                         </button>
                       </div>
                       <span ng-if="device.rebootInAction == 'ok'" class="pficon vertical-sub pficon-ok fz-18 ml-5 mt-3"></span>