$(document).ready(function(){ $('#main .row #sidebar').after('

Perguntas frequentes

'); if($('#formProposta').length){ // $('#produto-resumo button.confirm b').text('') } }); if(typeof EdPO == 'object'){ var FORM = { endpoint:'https://editor.print-one.com.br/api/personalizacao/', key:'', texts:{}, models:['PTC','MDRT 3','MDRT 4','MDRT 3 PTC','MDRT 4 PTC','MDRT Member','MDRT Court','MDRT Member PTC','MDRT Court PTC'], content:{ $:$('

Preencha o formulário abaixo.

'), style:{ 'width':'25%', 'float':'left', 'background-color':'#424242', 'border-right':'1px solid #000', 'position':'relative' } }, $submitBtn:{ $:'', style:{ 'background':'#00c853', 'border':'none', 'text-tranform':'uppercase', 'text-align':'center', 'width':'100%', 'padding':'20px', 'font-size':'18px', 'color':'#FFF' } }, $form:'', $editor:$('#'+EdPO.config.iframe), label:{ $:$(''), style:{ 'display':'block', 'color':'#FFF', } }, input:{ $:$(''), style:{ 'color':'#FFF', 'display':'block', 'margin-bottom':'15px', 'width':'100%', 'background-color':'transparent', 'border':'none', 'border-bottom':'2px solid #26a69a', 'box-shadow':'none', 'padding':'7px 0px' } }, select:{ $:$(''), style:{ 'color':'#FFF', 'display':'block', 'margin-bottom':'15px', 'width':'100%', 'background-color':'transparent', 'border':'none', 'border-bottom':'2px solid #26a69a', 'box-shadow':'none', 'padding':0, 'height':36 } }, masks:{ 'Telefone':{ meiomask:{ type:'fixed', mask:'(nn) nnnn-nnnn', autoTab:false, }, }, 'Celular':{ meiomask:{ type:'fixed', mask:'(nn) nnnnn-nnnn', autoTab:false, }, }, }, init:function(){ FORM.getTexts(); }, qrcode:false, getTexts:function(){ $.ajax({ url:FORM.endpoint+EdPO.config.model, type:'GET', dataType:'json', data:{ key:EdPO.config.key }, success:function(data){ FORM.texts = data.personalizacao[0].texts; FORM.form(); } }); }, form:function(){ FORM.$editor = $('#'+EdPO.config.iframe); FORM.$editor.css({ 'width':'75%' }); for(var i in FORM.texts){ text = FORM.texts[i]; name = text.match.charAt(0).toUpperCase() + text.match.substr(1); $input = FORM.input.$.attr({'id':'input-'+i,'name':name}).css(FORM.input.style).clone().data({layer:text.name,match:'#'+text.match+'#',name:name}).attr({'required':'required'}); v = FORM.hasData(name); if(v !== false){ $input.val(v.replace).data({'match':r.match}); } if(typeof FORM.masks[name] == 'object'){ $input.setMask(FORM.masks[name].meiomask); } $label = FORM.label.$.text(name).attr({'for':'input-'+i}).css(FORM.label.style).clone(); if(name == 'Email' || name == 'E-mail'){ $input.attr('type','email'); } FORM.content.$.find('.card-body').append($label); FORM.content.$.find('.card-body').append($input); } FORM.content.$.find('.card-head').css({ position:'absolute', padding:'22px 15px', width:'100%', top:0, 'border-bottom':'1px solid #000' }); FORM.content.$.find('.card-body').css({ position:'absolute', top:64, bottom:110, padding:'15px', width:'100%', 'overflow-y':'auto' }); FORM.content.$.find('.card-footer').css({ position:'absolute', padding:'15px', width:'100%', bottom:0, height:110, 'background-color':'#212121' }); FORM.content.$.height(FORM.$editor.height()); FORM.content.$.css(FORM.content.style); FORM.content.$.insertBefore(FORM.$editor); FORM.$submitBtn.$ = $('#btn-put-data-on-model'); FORM.$submitBtn.$.css(FORM.$submitBtn.style); FORM.$form = $('#submit-form-to-editor'); FORM.$form.submit(function(e){ e.preventDefault(); FORM.apply(); }); // FORM.$form.submit(); }, vcard:{ data:{ 'key':'B28752184046517F27738FA6CC739F84E84670EC5EF0A4F71B2E9D942EFE2458', 'width':2000, }, endpoint:'http://developer.brochura.com.br/pergraf/qrcode/api/vcard', }, apply:function(){ FORM.$form.find('input').each(function(index,input){ FORM.vcard.data[$(this).data().name.toLowerCase()] = $(this).val(); EdPO.replaceTextLayer($(this).data().layer,$(this).data().match,$(this).val()); $(this).data().match = $(this).val(); }); // EdPO.setImageLayer('qrcode',{'url':'https://cdn-images-1.medium.com/max/1200/0*zPG9dqz508rmRR70.','position':'contain'}) $.ajax({ url: FORM.vcard.endpoint, type: 'POST', dataType: 'json', data: FORM.vcard.data, crossDomain:true, success:function(data){ EdPO.setImageLayer('qrcode',{'url':data.url,'position':'contain'}) }, error:function(data){ console.log(data); }, }); }, hasData:function(match){ r = false; if(Object.keys(EdPO.config.texts).length > 0){ for(var i in EdPO.config.texts){ t = EdPO.config.texts[i]; if(t.match == '#'+match.toLowerCase()+'#'){ r = t; break; } } } return r; } } } $(function(){ if(typeof EdPO == 'object'){ if(EdPO.config.model == 1246){ EdPO.ready = function(){ FORM.init(); } } } });