mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-08 13:53:38 +02:00
Add notification center button and fix stat-card/activity board loading
This commit is contained in:
@@ -125,7 +125,7 @@ app.controller('createEmailAccount', function ($scope, $http) {
|
||||
app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -135,7 +135,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
$scope.showEmailDetails = function () {
|
||||
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.emailLoading = true;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -170,7 +170,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
|
||||
|
||||
$scope.emailDetails = false;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -180,7 +180,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
|
||||
} else {
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -195,7 +195,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -211,7 +211,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
|
||||
$scope.deleteEmailAccountFinal = function () {
|
||||
|
||||
$scope.emailLoading = false;
|
||||
$scope.emailLoading = true;
|
||||
|
||||
|
||||
var url = "/email/submitEmailDeletion";
|
||||
@@ -239,7 +239,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
|
||||
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = false;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -250,7 +250,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
|
||||
} else {
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = false;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -267,7 +267,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.emailDetails = true;
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.canNotDelete = true;
|
||||
$scope.successfullyDeleted = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -298,7 +298,7 @@ app.controller('deleteEmailAccount', function ($scope, $http) {
|
||||
/* Java script code to create account */
|
||||
app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false;
|
||||
$scope.emailDetails = true;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -307,7 +307,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
|
||||
$scope.showEmailDetails = function () {
|
||||
|
||||
$scope.emailLoading = false;
|
||||
$scope.emailLoading = true; // Show loading while fetching
|
||||
$scope.emailDetails = true;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -341,7 +341,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
$scope.emails = JSON.parse(response.data.data);
|
||||
|
||||
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false; // Hide loading on success
|
||||
$scope.emailDetails = false;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -350,7 +350,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
|
||||
|
||||
} else {
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false; // Hide loading on error
|
||||
$scope.emailDetails = true;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -364,7 +364,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false; // Hide loading on connection error
|
||||
$scope.emailDetails = true;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -378,7 +378,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
|
||||
$scope.changePassword = function () {
|
||||
|
||||
$scope.emailLoading = false;
|
||||
$scope.emailLoading = true; // Show loading while changing password
|
||||
|
||||
|
||||
var url = "/email/submitPasswordChange";
|
||||
@@ -409,7 +409,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
if (response.data.passChangeStatus == 1) {
|
||||
|
||||
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false; // Hide loading on success
|
||||
$scope.emailDetails = true;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = false;
|
||||
@@ -419,7 +419,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
$scope.passEmail = email;
|
||||
|
||||
} else {
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false; // Hide loading on error
|
||||
$scope.emailDetails = false;
|
||||
$scope.canNotChangePassword = false;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -436,7 +436,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.emailLoading = true;
|
||||
$scope.emailLoading = false; // Hide loading on connection error
|
||||
$scope.emailDetails = false;
|
||||
$scope.canNotChangePassword = true;
|
||||
$scope.passwordChanged = true;
|
||||
@@ -482,7 +482,7 @@ app.controller('changeEmailPassword', function ($scope, $http) {
|
||||
app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -492,7 +492,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.fetchKeys = function () {
|
||||
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -522,7 +522,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
if (response.data.keysAvailable === 1) {
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = false;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -535,7 +535,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
|
||||
} else {
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -547,7 +547,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
} else {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = false;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -559,7 +559,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -573,7 +573,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.createDomainDKIMKeys = function () {
|
||||
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -600,7 +600,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
if (response.data.generateStatus === 1) {
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -613,7 +613,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
} else {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = false;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -625,7 +625,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.dkimError = true;
|
||||
$scope.dkimSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -646,7 +646,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openDKIMSuccessfullyInstalled = true;
|
||||
$scope.openDKIMInstallBox = true;
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
|
||||
|
||||
$scope.installOpenDKIM = function () {
|
||||
@@ -656,7 +656,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openDKIMSuccessfullyInstalled = true;
|
||||
$scope.openDKIMInstallBox = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
$scope.manageDKIMLoading = true;
|
||||
|
||||
url = "/email/installOpenDKIM";
|
||||
|
||||
@@ -682,7 +682,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openDKIMSuccessfullyInstalled = true;
|
||||
$scope.openDKIMInstallBox = false;
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
|
||||
getRequestStatus();
|
||||
|
||||
@@ -694,7 +694,7 @@ app.controller('dkimManager', function ($scope, $http, $timeout, $window) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.openDKIMSuccessfullyInstalled = true;
|
||||
$scope.openDKIMInstallBox = true;
|
||||
$scope.manageDKIMLoading = true;
|
||||
$scope.manageDKIMLoading = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -792,7 +792,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -803,7 +803,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -834,7 +834,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -843,7 +843,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
} else {
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = false;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -860,7 +860,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -886,7 +886,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.fetchCurrentForwardings = function () {
|
||||
|
||||
if($scope.forwardingOption == null || $scope.selectedEmail == null ){
|
||||
if ($scope.forwardingOption == null || $scope.selectedEmail == null) {
|
||||
$scope.forwardLoading = true;
|
||||
return 0;
|
||||
}
|
||||
@@ -934,7 +934,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
} else {
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = false;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -951,7 +951,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -1026,7 +1026,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -1042,7 +1042,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -1073,7 +1073,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -1084,7 +1084,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
} else {
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = false;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
@@ -1101,7 +1101,7 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -1122,12 +1122,12 @@ app.controller('emailForwarding', function ($scope, $http) {
|
||||
|
||||
app.controller('listEmails', function ($scope, $http) {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.cyberpanelLoading = false;
|
||||
$scope.emailsAccounts = true;
|
||||
$scope.mailConfigured = 1;
|
||||
|
||||
$scope.populateCurrentRecords = function () {
|
||||
$scope.cyberpanelLoading = false;
|
||||
$scope.cyberpanelLoading = true; // Show loading while fetching
|
||||
$scope.emailsAccounts = true;
|
||||
|
||||
url = "/email/fetchEmails";
|
||||
@@ -1147,7 +1147,7 @@ app.controller('listEmails', function ($scope, $http) {
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.cyberpanelLoading = false; // Hide loading when done
|
||||
|
||||
if (response.data.status === 1) {
|
||||
$scope.emailsAccounts = false;
|
||||
@@ -1175,7 +1175,7 @@ app.controller('listEmails', function ($scope, $http) {
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.cyberpanelLoading = false; // Hide loading on error
|
||||
$scope.emailsAccounts = true;
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
@@ -1186,9 +1186,13 @@ app.controller('listEmails', function ($scope, $http) {
|
||||
|
||||
};
|
||||
|
||||
$scope.confirmDeleteEmail = function (email) {
|
||||
$scope.emailToDelete = email;
|
||||
};
|
||||
|
||||
$scope.deleteEmailAccountFinal = function (email) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
$scope.cyberpanelLoading = true; // Show loading while deleting
|
||||
|
||||
var url = "/email/submitEmailDeletion";
|
||||
|
||||
@@ -1237,7 +1241,7 @@ app.controller('listEmails', function ($scope, $http) {
|
||||
|
||||
$scope.fixMailSSL = function (email) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
$scope.cyberpanelLoading = true; // Show loading while fixing SSL
|
||||
|
||||
var url = "/email/fixMailSSL";
|
||||
|
||||
@@ -1341,7 +1345,271 @@ app.controller('listEmails', function ($scope, $http) {
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.refreshDiskUsage = function () {
|
||||
if (!$scope.selectedDomain) {
|
||||
new PNotify({
|
||||
title: 'Warning!',
|
||||
text: 'Please select a domain first.',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
var url = "/email/refreshEmailDiskUsage";
|
||||
|
||||
var data = {
|
||||
domain: $scope.selectedDomain,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(refreshSuccess, refreshError);
|
||||
|
||||
function refreshSuccess(response) {
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
if (response.data.refreshStatus === 1) {
|
||||
// Refresh the email list to show updated disk usage
|
||||
$scope.populateCurrentRecords();
|
||||
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: response.data.message || 'Disk usage refreshed successfully.',
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.error_message || 'Failed to refresh disk usage.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function refreshError(response) {
|
||||
$scope.cyberpanelLoading = false;
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
/* Java script code for List Emails Ends here */
|
||||
|
||||
|
||||
/* Java script code for EmailLimitsNew */
|
||||
app.controller('EmailLimitsNew', function ($scope, $http) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = true;
|
||||
|
||||
|
||||
$scope.showEmailDetails = function () {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = true;
|
||||
|
||||
var url = "/email/getEmailsForDomain";
|
||||
|
||||
|
||||
var data = {
|
||||
domain: $scope.emailDomain
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
|
||||
$scope.emails = JSON.parse(response.data.data);
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = false;
|
||||
|
||||
} else {
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = false;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.notifyBox = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.selectForwardingEmail = function () {
|
||||
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = true;
|
||||
|
||||
// Given email to search for
|
||||
var givenEmail = $scope.selectedEmail;
|
||||
|
||||
for (var i = 0; i < $scope.emails.length; i++) {
|
||||
if ($scope.emails[i].email === givenEmail) {
|
||||
// Extract numberofEmails and duration
|
||||
var numberofEmails = $scope.emails[i].numberofEmails;
|
||||
var duration = $scope.emails[i].duration;
|
||||
|
||||
$scope.numberofEmails = numberofEmails;
|
||||
$scope.duration = duration;
|
||||
|
||||
// Use numberofEmails and duration as needed
|
||||
console.log("Number of emails:", numberofEmails);
|
||||
console.log("Duration:", duration);
|
||||
|
||||
// Break out of the loop since the email is found
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.SaveChanges = function () {
|
||||
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = true;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = true;
|
||||
|
||||
var url = "/email/SaveEmailLimitsNew";
|
||||
|
||||
|
||||
var data = {
|
||||
numberofEmails: $scope.numberofEmails,
|
||||
source: $scope.selectedEmail,
|
||||
duration: $scope.duration
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if (response.data.status === 1) {
|
||||
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = true;
|
||||
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Changes applied.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
$scope.showEmailDetails();
|
||||
} else {
|
||||
$scope.creationBox = false;
|
||||
$scope.emailDetails = false;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = false;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.notifyBox = false;
|
||||
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
$scope.forwardLoading = false;
|
||||
$scope.forwardError = true;
|
||||
$scope.forwardSuccess = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.notifyBox = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
/* Java script for EmailLimitsNew */
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
0
static/mailServer/vpsON.png
Executable file → Normal file
0
static/mailServer/vpsON.png
Executable file → Normal file
|
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 757 B |
0
static/mailServer/vpsOff.png
Executable file → Normal file
0
static/mailServer/vpsOff.png
Executable file → Normal file
|
Before Width: | Height: | Size: 667 B After Width: | Height: | Size: 667 B |
Reference in New Issue
Block a user