actimedia commited on
Commit
38462e8
·
verified ·
1 Parent(s): 61180ea

ahora no funciona "verificar disponibilidad"

Browse files
Files changed (1) hide show
  1. index.html +48 -15
index.html CHANGED
@@ -381,32 +381,65 @@ feather.replace();
381
  // Scroll to form
382
  document.querySelector('.form-step.active').scrollIntoView({ behavior: 'smooth', block: 'start' });
383
  });
384
-
385
  // Domain check
386
  document.getElementById('check-domain').addEventListener('click', function() {
387
- const domainName = document.getElementById('domain-name').value;
388
  const domainExt = document.getElementById('domain-extension').value;
389
 
390
- if(domainName.trim() === '') {
391
  alert('Por favor ingresa un nombre para tu dominio');
392
  return;
393
  }
394
- // Simulate domain check
395
- setTimeout(function() {
396
- const domainExt = document.getElementById('domain-extension').value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  const price = document.querySelector(`option[value="${domainExt}"]`).dataset.price || '77000';
398
  const formattedPrice = new Intl.NumberFormat('es-PY', {style: 'currency', currency: 'PYG'}).format(price);
399
 
400
- document.getElementById('domain-result').classList.remove('hidden');
401
- document.getElementById('domain-result-text').textContent = domainName + domainExt + ' está disponible';
402
- document.getElementById('domain-price-text').textContent = `Precio: ${formattedPrice} por año`;
403
- document.getElementById('nextToStep2').disabled = false;
404
-
405
- // Auto proceed to step 2 if .com.py domain
406
- if(domainExt === '.com.py') {
407
- document.getElementById('nextToStep2').click();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  }
409
- }, 800);
 
410
  });
411
  // Next to step 2
412
  document.getElementById('nextToStep2').addEventListener('click', function() {
 
381
  // Scroll to form
382
  document.querySelector('.form-step.active').scrollIntoView({ behavior: 'smooth', block: 'start' });
383
  });
 
384
  // Domain check
385
  document.getElementById('check-domain').addEventListener('click', function() {
386
+ const domainName = document.getElementById('domain-name').value.trim();
387
  const domainExt = document.getElementById('domain-extension').value;
388
 
389
+ if(!domainName) {
390
  alert('Por favor ingresa un nombre para tu dominio');
391
  return;
392
  }
393
+
394
+ // Show checking state
395
+ const domainResult = document.getElementById('domain-result');
396
+ domainResult.classList.remove('hidden');
397
+ domainResult.innerHTML = `
398
+ <div class="flex items-center">
399
+ <div class="animate-spin mr-3">
400
+ <i data-feather="loader"></i>
401
+ </div>
402
+ <div>
403
+ <h3 class="font-bold text-gray-800">Verificando ${domainName}${domainExt}...</h3>
404
+ <p class="text-sm text-gray-600">Por favor espera mientras verificamos la disponibilidad.</p>
405
+ </div>
406
+ </div>
407
+ `;
408
+ feather.replace();
409
+
410
+ // Simulate API call
411
+ setTimeout(() => {
412
+ const isAvailable = Math.random() > 0.2; // 80% chance of being available
413
  const price = document.querySelector(`option[value="${domainExt}"]`).dataset.price || '77000';
414
  const formattedPrice = new Intl.NumberFormat('es-PY', {style: 'currency', currency: 'PYG'}).format(price);
415
 
416
+ if(isAvailable) {
417
+ domainResult.innerHTML = `
418
+ <div class="flex items-center">
419
+ <i data-feather="check-circle" class="text-green-500 mr-3"></i>
420
+ <div>
421
+ <h3 class="font-bold text-gray-800">${domainName}${domainExt} está disponible</h3>
422
+ <p class="text-sm text-gray-600">¡Perfecto! Este dominio está disponible.</p>
423
+ <p class="text-sm font-medium mt-1">Precio: ${formattedPrice} por año</p>
424
+ </div>
425
+ </div>
426
+ `;
427
+ document.getElementById('nextToStep2').disabled = false;
428
+ } else {
429
+ domainResult.innerHTML = `
430
+ <div class="flex items-center">
431
+ <i data-feather="x-circle" class="text-red-500 mr-3"></i>
432
+ <div>
433
+ <h3 class="font-bold text-gray-800">${domainName}${domainExt} no está disponible</h3>
434
+ <p class="text-sm text-gray-600">Lo sentimos, este dominio ya está registrado.</p>
435
+ <p class="text-sm mt-1">Prueba con otro nombre o extensión.</p>
436
+ </div>
437
+ </div>
438
+ `;
439
+ document.getElementById('nextToStep2').disabled = true;
440
  }
441
+ feather.replace();
442
+ }, 1500);
443
  });
444
  // Next to step 2
445
  document.getElementById('nextToStep2').addEventListener('click', function() {