+
+ Cartão de Visita Digital - Este QR Code criará um cartão de visita digital.
+ Quando escaneado, oferecerá para salvar seus contatos automaticamente.
+
+
+
+
+
+ Informações Essenciais
+
+
+
+
+
+
+
Nome é obrigatório
+
+
+
+
+
+
+
+ Apenas números (DDD + número)
+
Telefone celular é obrigatório
+
+
+
+
+
+
Email válido é obrigatório
+
+
+
+
+
+
+
+ Informações Adicionais (Opcionais)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Apenas números (DDD + número)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Preview do Cartão
+
+
+
+
BEGIN:VCARD
+VERSION:3.0
+Preencha os campos acima para ver o preview...
+END:VCARD
+
+
+
+
+
diff --git a/wwwroot/js/qr-speed-generator.js b/wwwroot/js/qr-speed-generator.js
index a657960..ed32cef 100644
--- a/wwwroot/js/qr-speed-generator.js
+++ b/wwwroot/js/qr-speed-generator.js
@@ -367,13 +367,35 @@ class QRRapidoGenerator {
validateForm() {
const qrType = document.getElementById('qr-type').value;
- const qrContent = document.getElementById('qr-content').value.trim();
if (!qrType) {
this.showError('Selecione o tipo de QR code');
return false;
}
+ // Special validation for VCard
+ if (qrType === 'vcard') {
+ try {
+ if (window.vcardGenerator) {
+ const errors = window.vcardGenerator.validateVCardData();
+ if (errors.length > 0) {
+ this.showError(errors.join(' '));
+ return false;
+ }
+ return true;
+ } else {
+ this.showError('VCard generator não está disponível');
+ return false;
+ }
+ } catch (error) {
+ this.showError('Erro na validação do VCard: ' + error.message);
+ return false;
+ }
+ }
+
+ // Normal validation for other types
+ const qrContent = document.getElementById('qr-content').value.trim();
+
if (!qrContent) {
this.showError('Digite o conteúdo do QR code');
return false;
@@ -388,9 +410,35 @@ class QRRapidoGenerator {
}
collectFormData() {
+ const type = document.getElementById('qr-type').value;
const quickStyle = document.querySelector('input[name="quick-style"]:checked')?.value || 'classic';
const styleSettings = this.getStyleSettings(quickStyle);
+ // Handle VCard type
+ if (type === 'vcard') {
+ if (window.vcardGenerator) {
+ const vcardContent = window.vcardGenerator.getVCardContent();
+ return {
+ data: {
+ type: 'vcard', // Keep as vcard type for tracking
+ content: vcardContent,
+ quickStyle: quickStyle,
+ primaryColor: document.getElementById('primary-color').value || (styleSettings.primaryColor || '#000000'),
+ backgroundColor: document.getElementById('bg-color').value || (styleSettings.backgroundColor || '#FFFFFF'),
+ size: parseInt(document.getElementById('qr-size').value),
+ margin: parseInt(document.getElementById('qr-margin').value),
+ cornerStyle: document.getElementById('corner-style')?.value || 'square',
+ optimizeForSpeed: true,
+ language: this.currentLang
+ },
+ isMultipart: false,
+ endpoint: '/api/QR/GenerateRapid'
+ };
+ } else {
+ throw new Error('VCard generator não está disponível');
+ }
+ }
+
// Check if logo is selected for premium users
const logoUpload = document.getElementById('logo-upload');
const hasLogo = logoUpload && logoUpload.files && logoUpload.files[0];
@@ -597,8 +645,28 @@ class QRRapidoGenerator {
updateContentHints() {
const type = document.getElementById('qr-type')?.value;
const hintsElement = document.getElementById('content-hints');
+ const vcardInterface = document.getElementById('vcard-interface');
+ const contentTextarea = document.getElementById('qr-content');
+
if (!hintsElement || !type) return;
+ // Show/hide VCard interface based on type
+ if (type === 'vcard') {
+ if (vcardInterface) vcardInterface.style.display = 'block';
+ if (contentTextarea) {
+ contentTextarea.style.display = 'none';
+ contentTextarea.removeAttribute('required');
+ }
+ hintsElement.textContent = 'Preencha os campos acima para criar seu cartão de visita digital';
+ return; // Skip normal hints for VCard
+ } else {
+ if (vcardInterface) vcardInterface.style.display = 'none';
+ if (contentTextarea) {
+ contentTextarea.style.display = 'block';
+ contentTextarea.setAttribute('required', 'required');
+ }
+ }
+
const hints = {
'pt-BR': {
'url': 'Ex: https://www.exemplo.com.br',
@@ -999,7 +1067,7 @@ class QRRapidoGenerator {
const alert = document.createElement('div');
alert.className = `alert alert-${type} alert-dismissible fade show`;
alert.innerHTML = `
- ${message}
+