Presentes personalizados para empresas
Peça uma proposta para a sua empresa
Diga-nos o que procura, a quantidade aproximada e o orçamento
disponível. Analisamos as suas necessidades e preparamos uma
proposta personalizada para a sua empresa.
Ver presentes personalizados
Proposta à medida
Adaptada ao orçamento
Maquete para aprovação
Encomendas empresariais
Conte-nos o que procura
Não precisa de ter todos os detalhes definidos.
Preencha o que já sabe e ajudamo-lo a encontrar
a solução mais adequada.
não produzir um formulário,
mostramos um fallback em vez de deixar a página partida.
*/
if (!nativeForm) {
if (customUI) {
customUI.style.display = 'none';
}
if (errorBox) {
errorBox.style.display = 'block';
}
return;
}
/* =======================================================
ENCONTRAR CAMPOS NATIVOS
======================================================= */
var nativeName =
nativeForm.querySelector(
'input[name="contact[name]"]'
);
var nativeEmail =
nativeForm.querySelector(
'input[name="contact[email]"]'
);
var nativePhone =
nativeForm.querySelector(
'input[name="contact[phone]"]'
);
var nativeMessage =
nativeForm.querySelector(
'textarea[name="contact[message]"]'
);
var nativeSubmit =
nativeForm.querySelector(
'input[type="submit"], button[type="submit"]'
);
/*
Estes quatro elementos são essenciais.
*/
if (
!nativeName ||
!nativeEmail ||
!nativeMessage ||
!nativeSubmit
) {
if (customUI) {
customUI.style.display = 'none';
}
if (errorBox) {
errorBox.style.display = 'block';
}
return;
}
/* =======================================================
CONFIGURAR CAMPOS NATIVOS
======================================================= */
nativeName.classList.add('quote-input');
nativeName.required = true;
nativeName.setAttribute(
'autocomplete',
'name'
);
nativeEmail.classList.add('quote-input');
nativeEmail.required = true;
nativeEmail.setAttribute(
'autocomplete',
'email'
);
if (nativePhone) {
nativePhone.classList.add('quote-input');
nativePhone.setAttribute(
'autocomplete',
'tel'
);
}
nativeMessage.classList.add(
'quote-textarea'
);
nativeMessage.required = true;
nativeMessage.setAttribute(
'placeholder',
'Se desejar, acrescente aqui qualquer informação adicional.'
);
nativeSubmit.classList.add(
'quote-submit'
);
if (
nativeSubmit.tagName.toLowerCase() === 'input'
) {
nativeSubmit.value =
'Pedir proposta';
} else {
nativeSubmit.textContent =
'Pedir proposta';
}
/* =======================================================
COLOCAR O NOSSO LAYOUT DENTRO DO FORM NATIVO
======================================================= */
customUI.style.display = 'block';
nativeForm.insertBefore(
customUI,
nativeForm.firstChild
);
/* =======================================================
MOVER INPUTS NATIVOS PARA AS POSIÇÕES CORRETAS
======================================================= */
document
.getElementById('quote-native-name-slot')
.appendChild(nativeName);
document
.getElementById('quote-native-email-slot')
.appendChild(nativeEmail);
if (nativePhone) {
document
.getElementById('quote-native-phone-slot')
.appendChild(nativePhone);
}
document
.getElementById('quote-native-message-slot')
.appendChild(nativeMessage);
document
.getElementById('quote-native-submit-slot')
.appendChild(nativeSubmit);
/* =======================================================
PRODUTOS
======================================================= */
var productSelect =
document.getElementById('quote-product');
var selectedProductBox =
document.getElementById(
'quote-selected-product'
);
var selectedProductName =
document.getElementById(
'quote-selected-name'
);
var selectedProductImage =
document.getElementById(
'quote-selected-image'
);
var selectedProductImageWrapper =
document.getElementById(
'quote-selected-product-image'
);
/* =======================================================
LER ?produto=...
======================================================= */
var urlParameters =
new URLSearchParams(
window.location.search
);
var productParameter =
urlParameters.get('produto');
if (
productParameter &&
productSelect
) {
var productFound = false;
for (
var i = 0;
i < productSelect.options.length;
i++
) {
if (
productSelect.options[i].value ===
productParameter
) {
productSelect.selectedIndex = i;
productFound = true;
break;
}
}
/*
Se por algum motivo o produto já não estiver
na categoria, não impedimos o formulário.
*/
if (!productFound) {
var fallbackOption =
document.createElement('option');
fallbackOption.value =
productParameter;
fallbackOption.text =
productParameter
.replace(/-/g, ' ')
.replace(/\b\w/g, function(letter) {
return letter.toUpperCase();
});
fallbackOption.setAttribute(
'data-name',
fallbackOption.text
);
productSelect.insertBefore(
fallbackOption,
productSelect.firstChild
);
productSelect.selectedIndex = 0;
}
}
/* =======================================================
MOSTRAR PRODUTO SELECIONADO
======================================================= */
function updateSelectedProduct() {
if (!productSelect) {
return;
}
var option =
productSelect.options[
productSelect.selectedIndex
];
if (
!option ||
!option.value ||
option.value === 'outro'
) {
selectedProductBox
.classList
.remove('is-visible');
return;
}
var productName =
option.getAttribute('data-name') ||
option.text;
var productImage =
option.getAttribute('data-image') ||
'';
selectedProductName.textContent =
productName;
if (productImage) {
selectedProductImage.src =
productImage;
selectedProductImage.alt =
productName;
selectedProductImageWrapper
.style
.display = 'block';
} else {
selectedProductImageWrapper
.style
.display = 'none';
}
selectedProductBox
.classList
.add('is-visible');
}
updateSelectedProduct();
if (productSelect) {
productSelect.addEventListener(
'change',
updateSelectedProduct
);
}
/* =======================================================
UTILITÁRIOS
======================================================= */
function fieldValue(id) {
var element =
document.getElementById(id);
if (
!element ||
!element.value ||
element.value.trim() === ''
) {
return '';
}
return element.value.trim();
}
function selectedText(selectId) {
var element =
document.getElementById(selectId);
if (
!element ||
element.selectedIndex < 0
) {
return '';
}
return element
.options[element.selectedIndex]
.text
.replace(/\s+/g, ' ')
.trim();
}
/* =======================================================
CRIAR MENSAGEM NATURAL ANTES DO ENVIO
======================================================= */
/*
Capture = true garante que os nossos dados são preparados
antes dos outros listeners associados ao formulário.
*/
nativeForm.addEventListener(
'submit',
function () {
var company =
fieldValue('quote-company');
var quantity =
fieldValue('quote-quantity');
var budget =
selectedText('quote-budget');
var recipient =
selectedText('quote-recipient');
var occasion =
selectedText('quote-occasion');
var drink =
selectedText('quote-drink');
var date =
fieldValue('quote-date');
var location =
fieldValue('quote-location');
var logoLink =
fieldValue('quote-logo-link');
var originalNotes =
nativeMessage.value.trim();
var personalizationElement =
document.querySelector(
'input[name="quote-personalization"]:checked'
);
var personalization =
personalizationElement
? personalizationElement.value
: '';
var productName =
selectedText('quote-product');
/* ===============================================
MENSAGEM EM LINGUAGEM NATURAL
=============================================== */
var messageParts = [];
messageParts.push(
'Olá, gostaria de pedir uma proposta para a empresa ' +
company + '.'
);
if (quantity) {
messageParts.push(
'Pretendemos aproximadamente ' +
quantity +
' unidades.'
);
}
if (
productName &&
productName !==
'Ainda não sei — quero sugestões'
) {
messageParts.push(
'O produto ou solução de interesse é: ' +
productName +
'.'
);
} else {
messageParts.push(
'Ainda não temos um produto específico definido e gostaríamos de receber sugestões.'
);
}
if (
budget &&
budget !== 'Ainda não definido'
) {
messageParts.push(
'O orçamento previsto é ' +
budget +
' por unidade.'
);
}
if (
recipient &&
recipient !== 'Selecione'
) {
messageParts.push(
'A oferta destina-se a ' +
recipient.toLowerCase() +
'.'
);
}
if (
occasion &&
occasion !== 'Selecione'
) {
messageParts.push(
'A ocasião é ' +
occasion +
'.'
);
}
if (
drink &&
drink !==
'Sem preferência — quero sugestões'
) {
messageParts.push(
'Temos preferência por ' +
drink +
'.'
);
}
if (personalization) {
if (
personalization ===
'Quero aconselhamento'
) {
messageParts.push(
'Gostaríamos também de aconselhamento relativamente à personalização.'
);
} else {
messageParts.push(
'A personalização pretendida é ' +
personalization.toLowerCase() +
'.'
);
}
}
if (date) {
messageParts.push(
'A data pretendida é ' +
date +
'.'
);
}
if (location) {
messageParts.push(
'O local de entrega previsto é ' +
location +
'.'
);
}
if (logoLink) {
messageParts.push(
'Ficheiro ou referência: ' +
logoLink
);
}
if (originalNotes) {
messageParts.push(
'Informação adicional: ' +
originalNotes
);
}
messageParts.push(
'Obrigado.'
);
nativeMessage.value =
messageParts.join(' ');
},
true
);
});