282 lines
9.4 KiB
HTML
282 lines
9.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Welcome to Wellnuo</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background-color: #f0f2f5; /* Color matching the logo's edge */
|
|
font-family: Arial, sans-serif;
|
|
}
|
|
.email-container {
|
|
max-width: 600px;
|
|
margin: 20px auto;
|
|
background-color: #ffffff;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
|
}
|
|
.header {
|
|
text-align: center;
|
|
padding: 20px;
|
|
background-color: #f0f2f5;
|
|
}
|
|
.header img {
|
|
max-width: 150px;
|
|
}
|
|
.content {
|
|
padding: 20px 30px;
|
|
}
|
|
.content h1 {
|
|
color: #333333;
|
|
}
|
|
.content p {
|
|
color: #555555;
|
|
line-height: 1.6;
|
|
}
|
|
.credentials, .devices-section {
|
|
margin: 20px 0;
|
|
padding: 15px;
|
|
background-color: #f9f9f9;
|
|
border-left: 4px solid #007bff;
|
|
}
|
|
.credentials p {
|
|
margin: 5px 0;
|
|
}
|
|
.device-row {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
flex-wrap: wrap;
|
|
}
|
|
.device-label {
|
|
flex: 1;
|
|
min-width: 100px;
|
|
font-weight: bold;
|
|
}
|
|
.device-inputs {
|
|
flex: 3;
|
|
display: flex;
|
|
gap: 10px;
|
|
}
|
|
.device-inputs select, .device-inputs input {
|
|
padding: 8px;
|
|
border: 1px solid #cccccc;
|
|
border-radius: 4px;
|
|
width: calc(50% - 5px);
|
|
}
|
|
.submit-button-container {
|
|
text-align: center;
|
|
margin-top: 20px;
|
|
}
|
|
.submit-button {
|
|
background-color: #007bff;
|
|
color: #ffffff;
|
|
padding: 12px 25px;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
.submit-button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
.links {
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
}
|
|
.links a {
|
|
display: inline-block;
|
|
margin: 5px 10px;
|
|
color: #007bff;
|
|
text-decoration: none;
|
|
}
|
|
.links a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.footer {
|
|
text-align: center;
|
|
padding: 20px;
|
|
font-size: 12px;
|
|
color: #999999;
|
|
}
|
|
.message-area {
|
|
text-align: center;
|
|
padding: 10px;
|
|
margin-bottom: 15px;
|
|
}
|
|
.message-area .success {
|
|
color: green;
|
|
}
|
|
.message-area .error {
|
|
color: red;
|
|
}
|
|
.message-area .loading {
|
|
color: #007bff;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="email-container">
|
|
<div class="header">
|
|
<img src="https://wellnua.com/wellnuo/WellnuoLogo_1.png" alt="Wellnuo Logo">
|
|
</div>
|
|
<div class="content">
|
|
<h1>Welcome, {first_name}!</h1>
|
|
<p>Thank you for joining Wellnuo. We are excited to have you on board. Your account has been successfully created after you have approved our disclaimer.</p>
|
|
|
|
<div class="credentials">
|
|
<p><strong>First Name:</strong> {first_name}</p>
|
|
<p><strong>Last Name:</strong> {last_name}</p>
|
|
<p><strong>Username:</strong> {user_name}</p>
|
|
<p><strong>Password:</strong> {password}</p>
|
|
</div>
|
|
|
|
<div class="devices-section">
|
|
<h3>Your Devices</h3>
|
|
<p>Please provide a location and a brief description for each of your devices below.</p>
|
|
<div id="message-area" class="message-area"></div>
|
|
<form id="device-form">
|
|
{devices_html}
|
|
<div class="submit-button-container">
|
|
<button type="button" class="submit-button" onclick="submitForm()">Submit Information</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="links">
|
|
<h3>Access Wellnuo</h3>
|
|
<a href="https://wellnua.com/wellnuo/WellNuoAppV4.apk">Android App</a> |
|
|
<a href="https://react.eluxnetworks.net/login">Mobile Web (PWA)</a> |
|
|
<a href="https://portal.eluxnetworks.net/login">Desktop Web App</a> |
|
|
<a href="https://eluxnetworks.net/function/well-api">Advanced Desktop Web App</a>
|
|
</div>
|
|
</div>
|
|
<div class="footer">
|
|
<p>© 2025 Wellnuo. All rights reserved.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function showLoading(message) {
|
|
const messageArea = document.getElementById('message-area');
|
|
messageArea.innerHTML = `<p class="loading">${message}</p>`;
|
|
}
|
|
|
|
function showSuccess(message) {
|
|
const messageArea = document.getElementById('message-area');
|
|
messageArea.innerHTML = `<p class="success">${message}</p>`;
|
|
}
|
|
|
|
function showError(message) {
|
|
const messageArea = document.getElementById('message-area');
|
|
messageArea.innerHTML = `<p class="error">${message}</p>`;
|
|
}
|
|
|
|
function clearMessages() {
|
|
const messageArea = document.getElementById('message-area');
|
|
messageArea.innerHTML = '';
|
|
}
|
|
|
|
const baseURL = window.location.origin;
|
|
//const api_url = `${baseURL}/function/well-api`;
|
|
const api_url = `https://eluxnetworks.net/function/well-api`;
|
|
|
|
async function SendToServer(formData) {
|
|
console.log(formData.toString());
|
|
try {
|
|
const response = await fetch(api_url, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
mode: 'no-cors',
|
|
body: formData.toString()
|
|
});
|
|
|
|
if (response.ok) {
|
|
const text = await response.text();
|
|
console.log(text);
|
|
try {
|
|
const data = JSON.parse(text);
|
|
return data;
|
|
} catch {
|
|
const data = {
|
|
ok: 0
|
|
};
|
|
return data;
|
|
}
|
|
} else {
|
|
console.log(await response.json());
|
|
const data = {
|
|
ok: 0
|
|
};
|
|
return data;
|
|
}
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
return { ok: 0 };
|
|
}
|
|
}
|
|
|
|
async function submitForm() {
|
|
showLoading("Submitting form...");
|
|
|
|
const firstName = "{first_name}";
|
|
const lastName = "{last_name}";
|
|
const username = "{user_name}";
|
|
const password = "{password}";
|
|
const email = ""; // Assuming email is not directly available in this form context
|
|
const devicesData = [];
|
|
const deviceElements = document.querySelectorAll('.device-row');
|
|
deviceElements.forEach(deviceElement => {
|
|
const deviceId = deviceElement.dataset.deviceId;
|
|
const location = deviceElement.querySelector('select').value;
|
|
const description = deviceElement.querySelector('input').value;
|
|
devicesData.push({
|
|
id: deviceId,
|
|
location: location,
|
|
description: description
|
|
});
|
|
});
|
|
|
|
try {
|
|
const formData = new URLSearchParams();
|
|
formData.append('function', "devices_locations_update");
|
|
formData.append('user_name', username);
|
|
formData.append('password', password);
|
|
formData.append('devices', JSON.stringify(devicesData));
|
|
formData.append('Date', new Date().toISOString());
|
|
|
|
const data = await SendToServer(formData);
|
|
|
|
clearMessages();
|
|
|
|
if (data.ok == 1) {
|
|
showSuccess("User account created successfully! All devices are available and assigned.");
|
|
// Optionally disable the form elements after successful submission
|
|
document.querySelectorAll('#device-form select, #device-form input, #device-form button').forEach(el => el.disabled = true);
|
|
return true;
|
|
} else {
|
|
if (data.error) {
|
|
showError(data.error);
|
|
} else {
|
|
showError("Failed to submit form. Please try again.");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} catch (error) {
|
|
clearMessages();
|
|
showError("Network error occurred. Please check your connection and try again.");
|
|
console.error("Submit error:", error);
|
|
return false;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |