new workflow
This commit is contained in:
@@ -58,8 +58,9 @@
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
button:disabled {
|
||||
background-color: #aaa;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.cost {
|
||||
font-weight: bold;
|
||||
@@ -71,6 +72,15 @@
|
||||
border-radius: 6px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
.confirmation {
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
padding: 40px;
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
color: #333;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -110,18 +120,17 @@ When it’s time for your annual renewal, you will receive a reminder email with
|
||||
</div>
|
||||
|
||||
<div class="submit-section">
|
||||
<button type="submit">Upgrade</button>
|
||||
<div class="cost" id="cost">$0,00</div>
|
||||
<button type="submit" id="submitBtn" disabled>Upgrade</button>
|
||||
<div class="cost" id="cost">$0.00</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const uuid = params.get("uuid");
|
||||
// document.getElementById("uuidDisplay").textContent = uuid ? uuid.toLowerCase() : "-";
|
||||
|
||||
const webhookUrl = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/0c8536be-d175-4740-8e78-123159193b23";
|
||||
const webhookPost = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/3709b60f-935e-43e4-834a-5060a40182dd";
|
||||
const webhookPost = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4projects.com/webhook/3709b60f-935e-43e4-834a-5060a40182dd";
|
||||
|
||||
async function loadData() {
|
||||
if (!uuid) {
|
||||
@@ -135,16 +144,13 @@ const webhookPost = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4p
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ uuid }) // send uuid in request body
|
||||
body: JSON.stringify({ uuid })
|
||||
});
|
||||
|
||||
if (!res.ok) throw new Error("Failed to fetch data");
|
||||
const data = await res.json();
|
||||
|
||||
// Save original data globally
|
||||
window.originalData = data;
|
||||
|
||||
// Save prices globally
|
||||
window.prices = data.prices || {
|
||||
git: 10,
|
||||
domain: 1,
|
||||
@@ -153,7 +159,6 @@ const webhookPost = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4p
|
||||
hddUnit: 10
|
||||
};
|
||||
|
||||
// Fill form fields
|
||||
document.getElementById("git").checked = data.git || false;
|
||||
document.getElementById("domains").value = data.domains || 1;
|
||||
document.getElementById("backupSlots").value = data.backupSlots || 2;
|
||||
@@ -166,11 +171,9 @@ const webhookPost = "https://002-001-5dd6e535-4d1c-46bc-9bd9-42ad4bc5f082.odoo4p
|
||||
console.error(err);
|
||||
alert("Error loading data.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function calculateCost() {
|
||||
function calculateCost() {
|
||||
if (!window.originalData || !window.prices) return;
|
||||
|
||||
const domains = parseInt(document.getElementById("domains").value) || 0;
|
||||
@@ -199,7 +202,10 @@ function calculateCost() {
|
||||
extraHDDUnits * window.prices.hddUnit;
|
||||
|
||||
document.getElementById("cost").textContent = `$${cost.toFixed(2)}`;
|
||||
}
|
||||
|
||||
// Enable/disable button based on cost
|
||||
document.getElementById("submitBtn").disabled = cost <= 0;
|
||||
}
|
||||
|
||||
document.querySelectorAll("input").forEach(input => {
|
||||
input.addEventListener("input", calculateCost);
|
||||
@@ -214,7 +220,7 @@ function calculateCost() {
|
||||
backupSlots: parseInt(document.getElementById("backupSlots").value),
|
||||
workers: parseInt(document.getElementById("workers").value),
|
||||
hdd: parseInt(document.getElementById("hdd").value),
|
||||
cost: parseInt(document.getElementById("cost").value)
|
||||
cost: document.getElementById("cost").textContent.replace('$','')
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -224,7 +230,14 @@ function calculateCost() {
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
if (!res.ok) throw new Error("Failed to submit data");
|
||||
alert("Upgrade submitted successfully!");
|
||||
|
||||
// Replace page content with confirmation message
|
||||
document.body.innerHTML = `
|
||||
<div class="confirmation">
|
||||
<h2>✅ Your upgrade request has been sent</h2>
|
||||
<p>Please check your email for confirmation.</p>
|
||||
</div>
|
||||
`;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
alert("Error submitting form.");
|
||||
|
||||
Reference in New Issue
Block a user