1 Selecione uma data e hora
2 Coloque seus dados
3 Pagamento
Você escolheu um serviço imediato
Carregando agenda..
Selecione o período para a chegada do prestador
Obs: No caso de condomínios não deixe de consultar as regras de acesso aos prestadores.
Insira suas informações
'; }); } else { // remove os valores sem desconto document.querySelectorAll('del.valor-sem-desconto').forEach(function(element) { element.remove(); }); } } // resumo 1 – coluna à direita (desktop) let resumo1Container = document.querySelector("#infoDescontoAplicado"); let resumo1 = (resumo1Container) ? resumo1Container.innerHTML : ''; let temResumo1 = (resumo1Container) ? true : false; // resumo 2 – junto dos campos (desktop + mobile) let resumo2Container = document.querySelector(".desconto-checkout"); let resumo2 = (resumo2Container) ? resumo2Container.innerHTML : ''; let temResumo2 = (resumo2Container) ? true : false; // discounts let discounts = []; document.querySelectorAll(".njt_checkout_order .cart-discount").forEach(function(discount) { let label = discount.querySelector('th').innerText.replace('Cupom: ', ''); let value = parseFloat( discount.querySelector('td .amount').innerText.replace('R$', '').replace(',', '.') ); discounts.push({label, value}); }); discounts = discounts.sort(function(a, b) { return b.value - a.value }); // maior -> menor // cupons let cupons = []; discounts.forEach(cupom => { cupons.push( cupom.label ); }); let temCupom = (cupons.length) ? true : false; let cupom = cupons.join(' + '); // cartão let cartaoContainer = document.querySelector(".njt_checkout_order .fee th"); let cartao = (cartaoContainer) ? cartaoContainer.innerText : ''; let cartaoPorto = (cartao) ? true : false; //validaCartaoPorto(cartao); // mensagens if(cartaoPorto && temCupom) { resumo1 = 'Cartão Porto Bank + ' + cupom; resumo2 = 'Desconto aplicado: Cartão Porto Bank + ' + cupom; } else if(cartaoPorto) { resumo1 = 'Cartão Porto Bank
*Só é possível utilizar 1 desconto por compra, prevalecendo o desconto maior.'; resumo2 = 'Desconto aplicado: Cartão Porto Bank
*Só é possível utilizar 1 desconto por compra, prevalecendo o desconto maior.'; } else if(temCupom) { resumo1 = cupom + '
*Só é possível utilizar 1 desconto por compra, prevalecendo o desconto maior.'; resumo2 = 'Desconto aplicado: ' + cupom + '
*Só é possível utilizar 1 desconto por compra, prevalecendo o desconto maior.'; } else { resumo1 = ''; resumo2 = '*Para receber o desconto Cartão Porto Bank, preencha os dados do seu cartão.'; } if(temResumo1) { resumo1Container.innerHTML = resumo1; if(resumo1) { document.querySelector('#descontoAplicado').style.display = 'block'; } else { document.querySelector('#descontoAplicado').style.display = 'none'; } try { document.querySelector('#desconto-porto').style.display = 'none'; document.querySelector('#cupomDesconto').style.display = 'none'; } catch(err) { console.warn(err); } } if(temResumo2) { resumo2Container.innerHTML = resumo2; } //console.log({temCupom, cupom, cartao, cartaoPorto, temResumo1, resumo1, temResumo2, resumo2}); } // Refresh order review function refreshOrderReview() { // Order review original $('.njt_checkout_order').hide(); // Define cancel date $('.woocommerce-privacy-policy-text').html(''); var splitHour = $('#horario_agendamento').val().split("-")[0]; var calcHour = parseFloat(splitHour) - 2; var dataAtual = $('#data_agendamento').val().split('/'); var horaCancelamento= new Date(dataAtual[2] + '-' + dataAtual[1] + '-' + dataAtual[0] + ' ' + splitHour + ':00'); // removendo 2 horas do tempo inicial horaCancelamento.setHours(horaCancelamento.getHours() - 2); var infoHora = (horaCancelamento.getHours() < 10) ? '0'+horaCancelamento.getHours() : horaCancelamento.getHours(); var infoMinuto = (horaCancelamento.getMinutes() < 10) ? '0'+horaCancelamento.getMinutes() : horaCancelamento.getMinutes(); var infoDia = (horaCancelamento.getDate() < 10) ? '0'+horaCancelamento.getDate() : horaCancelamento.getDate(); var infoMes = horaCancelamento.getMonth() + 1; infoMes = (infoMes < 10) ? '0'+infoMes : infoMes; var dateCancel = infoHora + ':'+ infoMinuto + ' do dia ' + infoDia + '/'+ infoMes + '/' + horaCancelamento.getFullYear(); $('.cancelamento-data-final').html(dateCancel); // In checkout var peopleCheckout = Math.floor(Math.random() * 6) + 1; // Order review $('.woocommerce-privacy-policy-text').append( '
'+
'
');
// Order Review - Price
//$('.resumo-valor').html($('.order-total .woocommerce-Price-amount').html());
//var valor_total = $('#pfaz_payment-installments option').html().split('1x de ').join('');
var valor_total_container = $('#pfaz_payment-installments option').html();
var valor_total = (valor_total_container) ? valor_total_container.split('1x de ').join('') : 'R$0,00';
$('.resumo-valor').html( valor_total );
$('#valorProduto').html( valor_total );
// Order Review - Product
//$('.resumo-produto').html($('.cart_item .product-name').html().split(' ')[0]);
$('.resumo-produto').html( $('.item-resumo-finalizar strong').eq(0).text().trim() );
// Order Review - Date
$('.resumo-agendamento').html($('#data_agendamento').val() + ' às ' + $('#horario_agendamento').val());
// Order Review - Coupon
if ($("#billing_cupom").val().length > 0) {
//$(''+
'
'+
'Resumo
'+ 'Você escolheu o serviço: No dia
'+ ''+
'
'+
'Apenas
' + peopleCheckout + ' pessoas estão finalizando com a mesma oferta
'+ 'Desconto aplicado: ' + $("#billing_cupom").val() + '
').insertAfter('.resumo-valor'); $('#infoCupomDesconto').html( $("#billing_cupom").val() ); //$(".desconto-checkout").hide(); $("#desconto-porto").hide(); } // se houver, mostra os descontos aplicados mostraDescontoAplicado(); // Politic Privacy $('.checkout-politica-privacidade').remove(); $('Eu concordo com as condições da reserva, termos gerais e política de privacidade ao fazer esta reserva.
').insertAfter('#place_order'); } // Prosseguir $(document).ready(function () { // Formata botão $('.servico-indisponivel').remove(); $("input[name='checkout_next_step']").removeClass("button alt yith-wcms-button next"); $("input[name='checkout_next_step']").addClass("bt-prosseguir"); $("input[name='checkout_next_step']").val('Prosseguir, estamos quase terminando'); // Inicia serviços buscaDatasAgenda(); $('#billing_postcode').val(readCookie('psf_cep')); searchCep($("#billing_postcode").val(), 'billing_address_1', 'billing_neighborhood', 'billing_city', 'billing_state', 'billing_uf'); }); $(window).on("load", function () { // Step 1 $(".step1").click(function () { // Fecha tudo e abre agenda if ($('.bt-prosseguir-disabled').length == 0) { $('.checkout-dados').hide(); $('.checkout-pagamento').hide(); $('.checkout-agenda').show(); } }); // Step 2 $(".step2").click(function () { // Fecha tudo e abre dados if ($('.bt-prosseguir-disabled').length == 0) { $('#billing_cupom_field').show(); $('.checkout-title, #billing_type_field, #billing_company_field, #billing_cnpj_field, #billing_inscricao_estadual_field, #billing_inscricao_municipal_field, #billing_first_name_field, #billing_last_name_field, #billing_email_field, #billing_cpf_field, #billing_phone_field, #terms_opt_out_marketing_field, #terms_privacy_field').show(); // ativa os campos relacionados ao tipo de pessoa [física, jurídica] // necessário porque a manipulação dos campos interfere no funcionamento normal do form let checked = $('#billing_type_field [name="billing_type"]:checked').val(); $('#billing_type_field [name="billing_type"]').prop('checked', false); $('#billing_type_' + checked ).click(); $('#label_title_endereco_field, #billing_postcode_field, #billing_address_1_field, #billing_number_field, #billing_address_2_field, #billing_neighborhood_field, #billing_city_field, #billing_state_field, #billing_uf_field').hide(); $('.bt-dados1').show(); $('.bt-dados2').hide() $('.checkout-pagamento').hide(); $('.checkout-agenda').hide(); $('.checkout-dados').show(); } }); // Step 3 $(".step3").click(function () { // Fecha tudo e abre pagamento if ($('.bt-prosseguir-disabled').length == 0) { $('.checkout-dados, .checkout-agenda').hide(); $('.checkout-pagamento').show(); } }); // Prosseguir $(".bt-agenda a").click(function () { // Fecha Agenda e abre Dados if ($('.bt-prosseguir-disabled').length == 0) { $('#billing_cupom_field').show(); $('.checkout-title, #billing_type_field, #billing_company_field, #billing_cnpj_field, #billing_inscricao_estadual_field, #billing_inscricao_municipal_field, #billing_first_name_field, #billing_last_name_field, #billing_email_field, #billing_cpf_field, #billing_phone_field, #terms_opt_out_marketing_field, #terms_privacy_field').show(); // ativa os campos relacionados ao tipo de pessoa [física, jurídica] // necessário porque a manipulação dos campos interfere no funcionamento normal do form let checked = $('#billing_type_field [name="billing_type"]:checked').val(); $('#billing_type_field [name="billing_type"]').prop('checked', false); $('#billing_type_' + checked ).click(); $('#label_title_endereco_field, #billing_postcode_field, #billing_address_1_field, #billing_number_field, #billing_address_2_field, #billing_neighborhood_field, #billing_city_field, #billing_state_field, #billing_uf_field').hide(); $('.checkout-agenda').hide(); $('.checkout-dados').show(); $('.bt-dados1').show(); $('.bt-dados2').hide(); // Steps $('.step1').removeClass('ativo'); $('.step1').addClass('passado-ativo'); $('.step2').addClass('ativo'); scrollTopGo('body'); // Refresh order review refreshOrderReview(); // on schedule $.post(ajaxurl, { action: "on_schedule", date: $('#billing_data_agendamento').val(), time: $('#billing_hora_agendamento').val(), }) .done(function (response) { const data = JSON.parse(response); //console.log('onSchedule', data); if(data.updated) { $("body").trigger("update_checkout"); } }) .fail(function (error) { console.warn(error); }); } }); // Prosseguir $(".bt-dados1 a").click(function () { // Fecha Agenda e abre Dados if ($('.bt-prosseguir-disabled').length == 0) { handleSubmit(); async function handleSubmit() { const isValid = await customValidation.doValidateFields('checkout-dados-pessoais'); if (isValid === true) { // Return $('#billing_cupom_field').show(); $('.checkout-title, #billing_type_field, #billing_company_field, #billing_cnpj_field, #billing_inscricao_estadual_field, #billing_inscricao_municipal_field, #billing_first_name_field, #billing_last_name_field, #billing_email_field, #billing_cpf_field, #billing_phone_field, #billing_cupom_field, #terms_opt_out_marketing_field, #terms_privacy_field').hide(); $('#label_title_endereco_field, #billing_postcode_field, #billing_address_1_field, #billing_number_field, #billing_address_2_field, #billing_neighborhood_field, #billing_city_field, #billing_state_field, #billing_uf_field').show(); $('.bt-dados1').hide(); $('.bt-dados2').show(); // Steps $('.step1').removeClass('ativo'); $('.step1').addClass('passado-ativo'); $('.place-order button').text('Prosseguir'); // Go to top scrollTopGo('body'); // LGPD Update Consent lgpdUpdateConsent(); //checkout log steps let data = { 'nome': $('#billing_first_name').val(), 'sobre-nome': $('#billing_last_name').val(), 'cpf': $('#billing_cpf').val(), 'email': $('#billing_email').val(), 'telefone': $('#billing_phone').val(), 'voucher': $('#billing_cupom').val(), 'marketing': !$('#terms_opt_out_marketing').is(':checked') } checkout_steps(data,2); // sendPlanilhaDados(); sendSheet(); } } } }); // Prosseguir $(".bt-dados2 a").click(function () { // Fecha Agenda e abre Dados if ($('.bt-prosseguir-disabled').length == 0) { handleSubmit(); async function handleSubmit() { const isValid = await customValidation.doValidateFields('checkout-endereco'); if (isValid === true) { $('#billing_cupom_field').show(); // Return $('.bt-dados1').show(); $('.bt-dados2').hide(); $('.checkout-title, #billing_type_field, #billing_company_field, #billing_cnpj_field, #billing_inscricao_estadual_field, #billing_inscricao_municipal_field, #billing_first_name_field, #billing_last_name_field, #billing_email_field, #billing_cpf_field, #billing_phone_field, #billing_cupom_field, #terms_opt_out_marketing_field, #terms_privacy_field').show(); $('#label_title_endereco_field, #billing_postcode_field, #billing_address_1_field, #billing_number_field, #billing_address_2_field, #billing_neighborhood_field, #billing_city_field, #billing_state_field, #billing_uf_field').hide(); $('.checkout-dados').hide(); $('.checkout-pagamento').show(); // Steps $('.step2').removeClass('ativo'); $('.step2').addClass('passado-ativo'); $('.step3').addClass('ativo'); $('.place-order button').text('Pronto, conclua seu pedido'); // Go to top scrollTopGo('body'); //checkout log steps let data = { 'cep': $('#billing_postcode').val(), 'logradouro': $('#billing_address_1').val(), 'numero': $('#billing_number').val(), 'complemento': $('#billing_address_2').val(), 'bairro': $('#billing_neighborhood').val(), 'cidade': $('#billing_city').val(), 'estado': $('#billing_state').val(), } checkout_steps(data,3); } } } }); // CEP $("#billing_postcode").change(function () { searchCep($("#billing_postcode").val(), 'billing_address_1', 'billing_neighborhood', 'billing_city', 'billing_state', 'billing_uf'); }); // On click submit document.querySelector('form[name="checkout"]').addEventListener('submit', function(event) { // console.log('submit'); handleSubmit(event); async function handleSubmit(event) { const form = event.target; const resubmit = event => { form.dispatchEvent(new Event('submit', { 'bubbles': true, 'cancelable': true })); } // verifica se já foi validado: form[data-validated] const isValidated = (form?.dataset.validated === 'true'); // se não validado if(isValidated !== true) { // bloqueia default/propagation event.preventDefault(); event.stopImmediatePropagation(); // verifica validade dos campos const isValid = await customValidation.doValidateFields('checkout-pagamento'); // console.log('submit:validity', {isValidated, isValid}); // adiciona data-validated ao form form.dataset.validated = isValid; // se válido if(isValid === true) resubmit(); return; } // se validado... // verifica se há reserva de agenda let hasReserveKey = reserve_key ? true : false; // console.log({hasReserveKey}); const notice = Swal.mixin({ // toast: true, icon: 'info', confirmButtonColor: '#00aeef', showCloseButton: false, allowOutsideClick: false, allowEscapeKey: false, }); if(!hasReserveKey) { try { // bloqueia default/propagation event.preventDefault(); event.stopImmediatePropagation(); // exibe mensagem notice.fire({ icon: 'info', text: 'Reservando agenda...', showConfirmButton: false, }); // tenta reservar agenda const retry = await getReserveKey({ ...getReserveKeyPayload() }); // conseguiu reservar agenda? if(!retry) throw new Error('Ocorreu um erro na reserva de agenda.') // exibe mensagem de sucesso notice.fire({ icon: 'success', text: 'Agenda reservada!', confirmButtonText: 'Concluir pedido' }).then(props => { // se confirmar, resumbit if(props.isConfirmed) resubmit(); }); } catch(error) { // exibe mensagem de erro notice.fire({ icon: 'warning', text: 'Não foi possível garantir a reserva de agenda para o serviço que você selecionou.', confirmButtonText: 'Tentar novamente', }).then(props => { // se confirmar, reload if(props.isConfirmed) window.location.reload(); }); } } $('#place_order').text('Processando pagamento...'); //checkout log steps checkout_steps(null,4); } }, true); });Detalhes de cobrança
Endereço de onde será o serviço
Ao continuar, você está ciente de que a Porto irá coletar e tratar seus dados pessoais de acordo com a nossa Política de Privacidade e Termos de Uso.
Conclua sua reserva
Cancelamento grátis até
A cobrança só será efetuada após a execução do serviço
Produto | Total |
---|---|
Subtotal | R$0,00 |
Total | R$0,00 |