fixed modal

This commit is contained in:
Hassan Hashmi
2024-01-09 15:03:59 +05:00
parent 1cdd52ca1b
commit e3ec2f0cdf
3 changed files with 111 additions and 50 deletions

View File

@@ -229,11 +229,11 @@ newapp.controller('createWebsiteV2', function ($scope, $http, $timeout, $window)
});
var FurlDeleteWP;
function DeleteWPNow(url) {
function DeleteWPNowV2(url) {
FurlDeleteWP = url;
}
function FinalDeleteWPNow() {
function FinalDeleteWPNowV2() {
window.location.href = FurlDeleteWP;
}
@@ -443,30 +443,7 @@ newapp.controller('listWebsitesV2', function ($scope, $http) {
});
var modalDeleteWPList = document.getElementById('deleteWPList');
var openDeleteWPList = document.getElementById('openDeleteWPList');
var closeDeleteWPList = document.getElementById('closeDeleteWPList');
// Function to open the modal
function openModalDeleteWPList() {
modalDeleteWPList.style.display = 'block';
}
// Function to close the modal
function closeModelDeleteWPList() {
modalDeleteWPList.style.display = 'none';
}
// Event listeners for opening and closing the modal
openDeleteWPList.addEventListener('click', openModalDeleteWPList);
closeDeleteWPList.addEventListener('click', closeModelDeleteWPList);
// Close the modal if the user clicks outside of it
window.addEventListener('click', function (event) {
if (event.target === modalDeleteWPList) {
closeModal();
}
});
newapp.controller('websitePagesV2', function ($scope, $http, $timeout, $window) {
@@ -2904,6 +2881,11 @@ newapp.controller('suspendWebsiteControlV2', function ($scope, $http) {
newapp.controller('deleteWebsiteControlV2', function ($scope, $http) {
$("#deleteLoading").hide();
$("#websiteDeleteFailure").hide();
$("#websiteDeleteSuccess").hide();
$("#deleteWebsiteButton").hide();
$scope.deleteWebsite = function () {
@@ -3396,8 +3378,45 @@ newapp.controller('listWebsitesV2', function ($scope, $http) {
});
var create_staging_domain_check = 1;
function create_staging_checkbox_function() {
try {
var checkBox = document.getElementById("Create_Staging_Check");
// Get the output text
// If the checkbox is checked, display the output text
if (checkBox.checked == true) {
create_staging_domain_check = 0;
document.getElementById('Website_Create_Test_Domain').style.display = "block";
document.getElementById('Website_Create_Own_Domain').style.display = "none";
} else {
document.getElementById('Website_Create_Test_Domain').style.display = "none";
document.getElementById('Website_Create_Own_Domain').style.display = "block";
create_staging_domain_check = 1;
}
} catch (e) {
}
// alert(domain_check);
}
newapp.controller('WPsiteHomeV2', function ($scope, $http, $timeout, $compile, $window) {
new PNotify({
title: 'Operation Failed!',
text: 'hanbokjnjdknvjfsnkjg habbi',
type: 'error'
});
var CheckBoxpasssword = 0;
$scope.wordpresshomeloading = true;
@@ -4897,14 +4916,19 @@ function closeModalAutoupdateConfiguration() {
}
// Event listeners for opening and closing the modal
openAutoupdateConfiguration.addEventListener('click', openModalAutoupdateConfiguration);
closeAutoupdateConfiguration.addEventListener('click', closeModalAutoupdateConfiguration);
if (openAutoupdateConfiguration && closeAutoupdateConfiguration) {
openAutoupdateConfiguration.addEventListener('click', openModalAutoupdateConfiguration);
closeAutoupdateConfiguration.addEventListener('click', closeModalAutoupdateConfiguration);
}
// Close the modal if the user clicks outside of it
window.addEventListener('click', function (event) {
if (event.target === modalAutoupdateConfiguration) {
closeModal();
}
document.addEventListener('DOMContentLoaded', function () {
window.addEventListener('click', function (event) {
if (event.target === modalAutoupdateConfiguration) {
closeModal();
}
});
});
var modalSecurity = document.getElementById('security');
var openSecurity = document.getElementById('openSecurity');
@@ -4920,9 +4944,13 @@ function closeModalSecurity() {
modalSecurity.style.display = 'none';
}
if (openSecurity && closeSecurity) {
// Your code here
openSecurity.addEventListener('click', openModalSecurity);
closeSecurity.addEventListener('click', closeModalSecurity);
}
// Event listeners for opening and closing the modal
openSecurity.addEventListener('click', openModalSecurity);
closeSecurity.addEventListener('click', closeModalSecurity);
// Close the modal if the user clicks outside of it
window.addEventListener('click', function (event) {
@@ -4932,7 +4960,7 @@ window.addEventListener('click', function (event) {
});
function showTab(tabId,tabColour) {
function showTab(tabId, tabColour) {
// Hide all tabs
var tabs = document.getElementsByClassName('tab-content');
for (var i = 0; i < tabs.length; i++) {

View File

@@ -71,29 +71,57 @@
</th>
<th class="w-52 pt-2 font-semibold text-sm">
<div class="flex items-center justify-center">
<button id="openDeleteWPList"
onclick="DeleteWPNow('{% url 'ListWPSitesV2' %}?DeleteID={{ sub.id }}')"
class="bg-orange-500 hover:bg-orange-700 text-white font-bold py-2 px-4 rounded">
<button data-modal-target="Deletewpsite" data-modal-toggle="Deletewpsite"
class="block text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
type="button" onclick="DeleteWPNowV2('{% url 'ListWPSitesV2' %}?DeleteID={{ sub.id }}')">
Delete
</button>
<div id="deleteWPList" class="fixed inset-0 bg-black bg-opacity-50 hidden">
<div class="flex items-center justify-center h-full">
<div class="bg-white p-8 rounded max-w-md">
<h2 class="text-lg font-bold mb-4">Delete WordPress
Site</h2>
<p>Do You want to delete this site ?</p>
<button onclick="FinalDeleteWPNow()"
class="mt-4 bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">
Delete
</button>
<button id="closeDeleteWPList"
class="mt-4 bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded">
Cancel
<div id="popup-modal" tabindex="-1"
class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative p-4 w-full max-w-md max-h-full">
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<button type="button" data-modal-toggle="Deletewpsite"
class="absolute top-3 end-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white"
data-modal-hide="popup-modal">
<svg class="w-3 h-3" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
</svg>
<span class="sr-only">Close modal</span>
</button>
<div class="p-4 md:p-5 text-center">
<svg class="mx-auto mb-4 text-gray-400 w-12 h-12 dark:text-gray-200"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2"
d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
</svg>
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">
Are you sure you want to
delete this WordPress site?</h3>
<button data-modal-hide="Deletewpsite" type="button"
data-modal-toggle="Deletewpsite" onclick="FinalDeleteWPNowV2()"
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center me-2">
Yes, I'm sure
</button>
<button data-modal-hide="Deletewpsite" type="button"
data-modal-toggle="Deletewpsite"
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">
No, cancel
</button>
</div>
</div>
</div>
</div>
</div>
</th>

View File

@@ -38,7 +38,11 @@
class="bg-orange-500 px-3 py-4 rounded-lg text-xl font-semibold text-white">
Delete Website
</button>
</div>
<div class="mt-3">
<hr>
</div>
@@ -53,6 +57,7 @@
<div id="websiteDeleteFailure" class="text-red-500 font-semibold">
<p>{% trans "Cannot delete website, Error message: " %} {$ errorMessage $}</p>
</div>
<br>
<div id="websiteDeleteSuccess" class="text-green-500 font-semibold">
<p>{% trans "Website" %} <strong>{$ deletedWebsite $}</strong> {% trans "Successfully Deleted." %}
</p>