diff --git a/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html b/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html index 58ab845..1395869 100644 --- a/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html +++ b/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html @@ -4281,16 +4281,12 @@ var wpcf7 = { // Map requirements to available storage options let reqIndex = 0; - console.log("Total options:", options.length); - console.log("Options by type:", options.map(o => ({id: o.id, type: o.type, label: o.label}))); options.forEach(opt => { let selectedValId = null; - console.log(`Processing option ${opt.id}: type=${opt.type}, label=${opt.label}`); if (opt.type === 'storage' && reqIndex < storageReqs.length) { const req = storageReqs[reqIndex]; - console.log(` Requirement ${reqIndex}: ${req.qty}x ${req.spec}`); let bestMatch = null; let bestScore = 0; @@ -4300,51 +4296,40 @@ var wpcf7 = { const valText = val.text.toLowerCase(); const reqSpec = req.spec.toLowerCase(); - console.log(` Checking value: ${val.text} (ID: ${val.id})`); - - // Check capacity match + // Check capacity match (exact match required) const valCap = valText.match(/(\d+(?:\.\d+)?)\s*tb/i); const reqCap = reqSpec.match(/(\d+(?:\.\d+)?)\s*tb/i); if (valCap && reqCap && valCap[1] === reqCap[1]) { score += 100; - console.log(` ✓ Capacity match: ${valCap[1]}TB`); } // Check brand match - if (valText.includes('crucial') && reqSpec.includes('crucial')) { - score += 50; - console.log(` ✓ Brand match: Crucial`); - } - if (valText.includes('kioxia') && reqSpec.includes('kioxia')) { - score += 50; - console.log(` ✓ Brand match: Kioxia`); - } + if (valText.includes('crucial') && reqSpec.includes('crucial')) score += 50; + if (valText.includes('kioxia') && reqSpec.includes('kioxia')) score += 50; + if (valText.includes('samsung') && reqSpec.includes('samsung')) score += 50; // Check model match - if (valText.includes('t705') && reqSpec.includes('t705')) { - score += 50; - console.log(` ✓ Model match: T705`); - } - if (valText.includes('cm7') && reqSpec.includes('cm7')) { - score += 50; - console.log(` ✓ Model match: CM7`); - } + if (valText.includes('t705') && reqSpec.includes('t705')) score += 50; + if (valText.includes('cm7') && reqSpec.includes('cm7')) score += 50; - console.log(` Score: ${score}`); if (score > bestScore) { bestScore = score; bestMatch = val; } }); - console.log(` Best match for ${opt.id}: score=${bestScore}`); - if (bestMatch && bestScore > 100) { + if (bestMatch && bestScore >= 100) { selectedValId = bestMatch.id; preselected[opt.id] = selectedValId; - console.log(`✓ Storage option ${opt.id} (${opt.label}): selected ${selectedValId} (${bestMatch.text})`); reqIndex++; } else { - console.log(`✗ No suitable match found for ${opt.id}`); + // If no match found, try to use URL preselected value + if (preselected[opt.id]) { + const urlMatch = opt.values.find(v => v.id === preselected[opt.id]); + if (urlMatch) { + selectedValId = preselected[opt.id]; + } + } } } else if (opt.type !== 'storage' && preselected[opt.id]) { // Use preselected IDs for non-storage options @@ -4898,9 +4883,6 @@ var wpcf7 = { // Fill slots based on storage requirements if (storageRequirements && storageRequirements.length > 0) { - console.log("Pre-filling storage with requirements:", storageRequirements); - console.log("Initial configIds before pre-filling:", configIds); - // Clear storageSelection to start fresh storageSelection = {}; @@ -4965,8 +4947,7 @@ var wpcf7 = { } }); - console.log("Final storageSelection:", storageSelection); - console.log("Final configIds after pre-filling:", configIds); + } } } else { // Pre-set configState for custom servers @@ -5469,25 +5450,18 @@ var wpcf7 = { const urlObj = new URL(selectedServer.orderUrl); const params = urlObj.searchParams; - console.log("Building Instant Order URL - ConfigIds:", configIds); - console.log("Building Instant Order URL - Storage Selection:", storageSelection); - // Update only the configuration options that are tracked in configIds Object.entries(configIds).forEach(([id, val]) => { if (id && val) { // WHMCS format: configoption[123] params.set(`configoption[${id}]`, val); - console.log(`Setting configoption[${id}] = ${val}`); } }); // Ensure billing cycle is enforced params.set('billingcycle', 'monthly'); - const finalUrl = urlObj.toString(); - console.log("Final Instant Order URL:", finalUrl); - - return finalUrl; + return urlObj.toString(); } catch (e) { console.error("Error building instant URL:", e); return selectedServer.orderUrl;