From 9a3f04d5499ba8010785f53ca927c832af3c8ee1 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 6 Apr 2025 21:44:40 +0500 Subject: [PATCH] move modal inside controller --- .../websiteFunctions/websiteFunctions.js | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index b408ece8c..e4d412c73 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -2734,14 +2734,13 @@ app.controller('listWebsites', function ($scope, $http, $window) { var settingMap = { 'search-indexing': 'searchIndex', 'debugging': 'debugging', - 'password-protection': 'passwordProtection', 'maintenance-mode': 'maintenanceMode' }; var data = { - wpID: wp.id, + siteId: wp.id, // Changed from wpID to siteId to match backend setting: setting, - value: wp[settingMap[setting]] ? 'enable' : 'disable' + value: wp[settingMap[setting]] ? 1 : 0 // Changed to use numeric values }; $http({ @@ -2769,7 +2768,7 @@ app.controller('listWebsites', function ($scope, $http, $window) { wp[settingMap[setting]] = !wp[settingMap[setting]]; // Revert the change new PNotify({ title: 'Error', - text: 'Failed to update setting.', + text: response.data.error_message || 'Failed to update setting.', type: 'error' }); } @@ -6352,9 +6351,9 @@ $scope.updateSetting = function(wp, setting) { }; var data = { - wpID: wp.id, + siteId: wp.id, // Changed from wpID to siteId to match backend setting: setting, - value: wp[settingMap[setting]] ? 'enable' : 'disable' + value: wp[settingMap[setting]] ? 1 : 0 // Changed to use numeric values }; $http({ @@ -10411,14 +10410,13 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind var settingMap = { 'search-indexing': 'searchIndex', 'debugging': 'debugging', - 'password-protection': 'passwordProtection', 'maintenance-mode': 'maintenanceMode' }; var data = { - wpID: wp.id, + siteId: wp.id, // Changed from wpID to siteId to match backend setting: setting, - value: wp[settingMap[setting]] ? 'enable' : 'disable' + value: wp[settingMap[setting]] ? 1 : 0 // Changed to use numeric values }; $http({ @@ -10446,7 +10444,7 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind wp[settingMap[setting]] = !wp[settingMap[setting]]; // Revert the change new PNotify({ title: 'Error', - text: 'Failed to update setting.', + text: response.data.error_message || 'Failed to update setting.', type: 'error' }); } @@ -10617,14 +10615,13 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind var settingMap = { 'search-indexing': 'searchIndex', 'debugging': 'debugging', - 'password-protection': 'passwordProtection', 'maintenance-mode': 'maintenanceMode' }; var data = { - wpID: wp.id, + siteId: wp.id, // Changed from wpID to siteId to match backend setting: setting, - value: wp[settingMap[setting]] ? 'enable' : 'disable' + value: wp[settingMap[setting]] ? 1 : 0 // Changed to use numeric values }; $http({ @@ -10652,7 +10649,7 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind wp[settingMap[setting]] = !wp[settingMap[setting]]; // Revert the change new PNotify({ title: 'Error', - text: 'Failed to update setting.', + text: response.data.error_message || 'Failed to update setting.', type: 'error' }); }