Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: New Facebook Application Form
- * */
- get_header();
- ?>
- <!-- Facebook Pixel Code -->
- <script>
- !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
- n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
- n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
- t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
- document,'script','//connect.facebook.net/en_US/fbevents.js');
- fbq('init', '1010965415591183');
- fbq('track', 'PageView');
- </script>
- <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1010965415591183&ev=PageView&noscript=1"/></noscript>
- <!-- End Facebook Pixel Code -->
- <!-- -->
- <script>
- // ViewContent
- // Track key page views (ex: product page, landing page or article)
- fbq('track', 'ViewContent');
- </script>
- <!-- Google Code for Adwords search lead Conversion Page -->
- <script type="text/javascript">
- /* <![CDATA[ */
- var google_conversion_id = 944786030;
- var google_conversion_language = "en";
- var google_conversion_format = "3";
- var google_conversion_color = "ffffff";
- var google_conversion_label = "aVCbCMiIo18Q7pTBwgM";
- var google_remarketing_only = false;
- /* ]]> */
- </script>
- <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
- </script>
- <noscript>
- <div style="display:inline;">
- <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/944786030/?label=aVCbCMiIo18Q7pTBwgM&guid=ON&script=0"/>
- </div>
- </noscript>
- <!-- end google code for adwords-->
- <!-- Add css for the action form -->
- <script src="<?php echo get_template_directory_uri(); ?>/js/modernizr.custom.js"></script>
- <style type="text/css"></style>
- <?php while ( have_posts() ) : the_post(); ?>
- <style>
- @font-face {
- font-weight: normal;
- font-style: normal;
- font-family: 'icomoon';
- src:url('<?php echo get_template_directory_uri(); ?>/fonts/icomoon/icomoon.eot?-9heso');
- src:url('<?php echo get_template_directory_uri(); ?>/fonts/icomoon/icomoon.eot?#iefix-9heso') format('embedded-opentype'),
- url('<?php echo get_template_directory_uri(); ?>/fonts/icomoon/icomoon.woff?-9heso') format('woff'),
- url('<?php echo get_template_directory_uri(); ?>/fonts/icomoon/icomoon.ttf?-9heso') format('truetype'),
- url('<?php echo get_template_directory_uri(); ?>/fonts/icomoon/icomoon.svg?-9heso#icomoon') format('svg');
- }
- .simform {
- position: relative;
- margin: 0 auto 20px;
- padding: 0 0 0.5em;
- max-width: 860px;
- width: 100%;
- text-align: left;
- font-size: 2.5em;
- }
- .simform .submit {
- display: none;
- }
- /* Question list style */
- .simform ol {
- margin: 0;
- padding: 0;
- list-style: none;
- position: relative;
- -webkit-transition: height 0.4s;
- transition: height 0.4s;
- }
- .simform ol:before {
- content: '';
- background-color: rgba(0,0,0,0.5);
- position: absolute;
- left: 0;
- bottom: 0;
- width: 100%;
- height: 1.35em;
- min-height: 40px;
- border: solid thin #b9062c;
- }
- .questions li {
- z-index: 100;
- position: relative;
- visibility: hidden;
- height: 0;
- -webkit-transition: visibility 0s 0.4s, height 0s 0.4s;
- transition: visibility 0s 0.4s, height 0s 0.4s;
- }
- .questions li.current,
- .no-js .questions li {
- visibility: visible;
- height: auto;
- -webkit-transition: none;
- transition: none;
- }
- /* Labels */
- .questions li > span {
- display: block;
- overflow: hidden;
- }
- .questions li > span label {
- display: block;
- -webkit-transition: -webkit-transform 0.4s;
- transition: transform 0.4s;
- -webkit-transform: translateY(-100%);
- transform: translateY(-100%);
- }
- .questions li.current > span label,
- .no-js .questions li > span label {
- -webkit-transition: none;
- transition: none;
- -webkit-transform: translateY(0);
- transform: translateY(0);
- }
- .show-next .questions li.current > span label {
- -webkit-animation: moveUpFromDown 0.4s both;
- animation: moveUpFromDown 0.4s both;
- }
- @-webkit-keyframes moveUpFromDown {
- from { -webkit-transform: translateY(100%); }
- to { -webkit-transform: translateY(0); }
- }
- @keyframes moveUpFromDown {
- from { -webkit-transform: translateY(100%); transform: translateY(100%); }
- to { -webkit-transform: translateY(0); transform: translateY(0); }
- }
- /* Input field */
- .questions input, .questions select {
- display: block;
- margin: 0.3em 0 0 0;
- padding: 0em 1em 0.1em 0.5em;
- width: calc(100% - 2em);
- border: none;
- background: transparent;
- color: rgba(255,255,255,1);
- font-size: 0.8em;
- line-height: 1;
- opacity: 0;
- -webkit-transition: opacity 0.3s;
- transition: opacity 0.3s;
- height: 1.5em;
- min-height: 40px;
- outline-offset: 0px
- }
- .questions .current input,
- .no-js .questions input, .questions .current select, .no-js .questions select{
- opacity: 1;
- }
- .questions input:focus,
- .simform button:focus, .questions select:focus {
- outline: none;
- }
- /* Next question button */
- .next {
- position: absolute;
- right: 0;
- bottom: 20%; /* padding-bottom of form plus progress bar height */
- display: block;
- padding: 0;
- width: 1.5em;
- height: 2em;
- border: none;
- background: none;
- color: rgba(185, 6, 44, 0.5);
- text-align: center;
- opacity: 0;
- z-index: 100;
- cursor: pointer;
- -webkit-transition: -webkit-transform 0.3s, opacity 0.3s;
- transition: transform 0.3s, opacity 0.3s;
- -webkit-transform: translateX(-20%);
- transform: translateX(-20%);
- pointer-events: visible;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
- }
- .next:hover {
- color: #b9062c;
- display: block !important;
- }
- .next::after {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- content: "\e600";
- text-transform: none;
- font-weight: normal;
- font-style: normal;
- font-variant: normal;
- font-family: 'icomoon';
- line-height: 2;
- speak: none;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- .next.show {
- opacity: 1;
- -webkit-transform: translateX(0);
- transform: translateX(0);
- pointer-events: auto;
- }
- /* Progress bar */
- .simform .progress {
- width: 0%;
- height: 0.15em;
- background: rgba(0,0,0,0.3);
- -webkit-transition: width 0.4s ease-in-out;
- transition: width 0.4s ease-in-out;
- }
- .simform .progress::before {
- position: absolute;
- top: auto;
- width: 100%;
- height: inherit;
- background: rgba(0,0,0,0.05);
- content: '';
- }
- /* Number indicator */
- .simform .number {
- position: absolute;
- right: 0;
- overflow: hidden;
- margin: 0.4em 0;
- width: 3em;
- font-weight: 700;
- font-size: 0.4em;
- }
- .simform .number:after {
- position: absolute;
- left: 50%;
- content: '/';
- opacity: 0.4;
- -webkit-transform: translateX(-50%);
- transform: translateX(-50%);
- }
- .simform .number span {
- float: right;
- width: 40%;
- text-align: center;
- }
- .simform .number .number-current {
- float: left;
- }
- .simform .number-next {
- position: absolute;
- left: 0;
- }
- .simform.show-next .number-current {
- -webkit-transition: -webkit-transform 0.4s;
- transition: transform 0.4s;
- -webkit-transform: translateY(-100%);
- transform: translateY(-100%);
- }
- .simform.show-next .number-next {
- -webkit-animation: moveUpFromDown 0.4s both;
- animation: moveUpFromDown 0.4s both;
- }
- /* Error and final message */
- .simform .error-message,
- .simform .final-message {
- position: absolute;
- visibility: hidden;
- opacity: 0;
- -webkit-transition: opacity 0.4s;
- transition: opacity 0.4s;
- }
- .simform .error-message {
- padding: 0.4em 3.5em 0 0;
- width: 100%;
- color: rgba(255, 0, 0, 0.7);
- font-style: italic;
- font-size: 0.4em;
- }
- .final-message {
- top: 50%;
- left: 0;
- /*padding: 0.5em;*/
- width: 100%;
- text-align: center;
- -webkit-transform: translateY(-50%);
- transform: translateY(-50%);
- }
- .error-message.show,
- .final-message.show {
- visibility: visible;
- opacity: 1;
- }
- .final-message.show {
- -webkit-transition-delay: 0.5s;
- transition-delay: 0.5s;
- font-size: 20px;
- color: #b9062c;
- }
- /* Final hiding of form / showing message */
- .simform-inner.hide {
- visibility: hidden;
- opacity: 0;
- -webkit-transition: opacity 0.3s, visibility 0s 0.3s;
- transition: opacity 0.3s, visibility 0s 0.3s;
- }
- /* No JS Fallback */
- .no-js .simform {
- font-size: 1.75em;
- }
- .no-js .questions li {
- padding: 0 0 2em;
- }
- .no-js .simform .submit {
- display: block;
- float: right;
- padding: 10px 20px;
- border: none;
- background: rgba(0,0,0,0.3);
- color: rgba(0,0,0,0.4);
- }
- .no-js .simform .controls {
- display: none;
- }
- /* Remove IE clear cross */
- input[type=text]::-ms-clear {
- display: none;
- }
- /* Adjust form for smaller screens */
- @media screen and (max-width: 44.75em) {
- .simform {
- font-size: 1.8em;
- }
- }
- @media screen and (max-width: 33.5625em) {
- .simform {
- font-size: 1.2em;
- }
- }
- .advert{
- position:relative;
- min-height: 350px;
- }
- #calc-banner{
- /*max-width: 300px;*/
- /* float: right;
- position: absolute;
- top: 10px;
- right: 50px;*/
- margin: 20px 5px;
- padding: 5px 10px;
- border-radius: 4px;
- background-color: rgba(255,255,255,.6);
- }
- .ad-loanCalculator{
- /*color :#fff;*/
- }
- h2.call {
- margin-top: 20px;
- margin-bottom: 10px;
- color: #b9062c;
- }
- .earn{
- margin-top: 20px;
- margin-bottom: 10px;
- /*color: #b9062c;*/
- }
- .ad-loanCalculator .title{
- }
- .ad-loanCalculator label{
- /*font-size: 22px;*/
- font-weight: normal;
- }
- select#ltenure > option {
- color: #000;
- }
- .centit {
- text-align: center;
- border-top: 3px solid #b9062c;
- padding: 20px 0px;
- border-bottom: #7e6f73 3px solid;
- }
- #naira{
- font-size: 17px;
- }
- </style>
- <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <section class="insideBanner apply advert"
- <?php
- if( has_post_thumbnail() && ! post_password_required() ):
- ?>
- style=" background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>')"
- <?php endif; ?> >
- <div class="container">
- <div class="row">
- <section class="ad-loanCalculator padtop col-md-offset-7 col-md-5" >
- <div id="calc-banner">
- <div id="to-latter-hide">
- <h2 class="call">No collateral or guarantor?<br />No wahala!</h2>
- <b>Fill out the form below and receive a loan quote now!</b>
- <br />
- <?php echo (is_mobile())? '<br />' : '' ?>
- </div>
- <div class="final-message">
- </div>
- <form id="theform">
- <div class="row">
- <div class="form-group col-sm-6">
- <label for="firstname" class="earn">What is your net monthly pay?</label>
- <input id="income" name="income" required class="form-control" type="number" placeholder="1000000" />
- </div>
- <div class="form-group col-sm-6">
- <label for="fullname" class="earn">How much do you want?</label>
- <input id="loanamount" name="loanamount" required class="form-control" type="number" step="10000" min="40000" max="1000000" placeholder="1000000" />
- </div>
- </div>
- <div class="row">
- <div class="form-group col-sm-6">
- <label for="firstname" class="required">How long do you want it for?</label>
- <select id="ltenure" name="loantenure" required class="form-control">
- <option value="3">3 months</option>
- <option value="6">6 months</option>
- <option value="9">9 months</option>
- <option value="12">12 months</option>
- </select>
- </div>
- <div class="form-group col-sm-6">
- <label for="fullname" class="required">What is your first name?</label>
- <input required style="padding-top:0 !important;margin-top:0px !important;" class="form-control" id="fname" name="fname" type="text" placeholder="John"/>
- </div>
- </div>
- <div class="row">
- <div class="form-group col-sm-6">
- <label for="firstname" class="required">What's your last name?</label>
- <input id="lname" name="lname" type="text" required class="form-control" placeholder="Doe"/>
- </div>
- <div class="form-group col-sm-6">
- <label for="fullname" class="required">What's your email address?</label>
- <input id="memail" name="memail" type="email" required class="form-control" placeholder="jdoe@domain.com"/>
- </div>
- </div>
- <div class="row">
- <div class="form-group col-sm-12">
- <button id="send-quote" class="btn btn-warning btn-lg form-control" style="font-size: 19px !important; padding-top : 5px;" type="submit">Get quote</button>
- </div>
- </div>
- </form>
- </div>
- </section>
- <div>
- </div>
- </section>
- </article>
- <?php endwhile; ?>
- <script src="<?php echo get_template_directory_uri(); ?>/js/classie.js"></script>
- <?php get_footer(); ?>
- <script>
- $("#theform").submit(function(e){
- $("#theform").validate();
- var ad_source = <?php echo json_encode($_GET['ad_source']); ?>;
- var ad_name = <?php echo json_encode($_GET['ad_name']); ?>;
- var gclsrc = <?php echo json_encode($_GET['gclsrc']); ?>;
- ad_source = ad_source? ad_source : 'N/A';
- ad_name = ad_name? ad_name : 'N/A';
- gclsrc = gclsrc ? gclsrc : 'N/A';
- var loanamount = $('#loanamount').val();
- var loantenure = $('#ltenure').val();
- var income = $('#income').val();
- var memail = $('#memail').val();
- var fname = $('#fname').val();
- var lname = $('#lname').val();
- if(loanamount == '' || loantenure == '' || repayment == '' || memail == '' || fname == '' || lname == ''){
- return false;
- }
- var mname = fname+" "+lname;
- var allowed = getMaxLoan(income);
- var calcs = calculateLoan(loanamount,loantenure);
- var ncalcs = calculateLoan(allowed.amount,allowed.tenor);
- var repayment = calcs.repayment;
- var monthlyrepayment = calcs.mrepayment;
- var ser = 'ad_source='+ad_source+'&ad_name='+ad_name+'&gclsrc='+gclsrc+'&firstname='+fname+'&surname='+lname+'&email='+memail+'&loanamount='+loanamount+'&loantenor='+loantenure;
- var text = "";
- console.log(allowed)
- console.log(loanamount)
- if(allowed.amount< 40000) {
- text = "ad-res-less";
- }else if(allowed.amount > loanamount)
- {
- text = "ad-res-same";
- }else if(allowed.amount == loanamount){
- text = "ad-res-more";
- }
- if(income < 22900)
- text = "ad-inelligible";
- sendMail(text);
- function template(html){
- var message = {
- "key": "-Vv9KY8xtLEJJEgyKnv5Dg",
- "template_name": html,
- "template_content": [
- {
- "name": "example name",
- "content": "example content"
- }
- ],
- "message": {
- "subject": "Welcome to One Credit",
- "from_email": "customer@one-cred.com",
- "from_name": "One Credit",
- "to": [
- {
- "email": memail,
- "name": mname,
- "type": "to"
- }
- ],
- "merge": true,
- "merge_language": "handlebars",
- "global_merge_vars": [
- {
- "name": "fullname",
- "content": mname
- },
- {
- "name": "loantenor",
- "content": loantenure
- },
- {
- "name": "loanamount",
- "content": addCommas(loanamount)
- },
- {
- "name": "salary",
- "content": addCommas(income)
- },
- {
- "name": "mrepayment",
- "content": addCommas(monthlyrepayment)
- },
- {
- "name": "applylink",
- "content": "http://www.one-cred.com/apply/?regid="+memail+"&fname="+fname+"&lname="+lname+"&ad_source="+ad_source+"&ad_name="+ad_name+"&gclsrc="+gclsrc+"&pay="+loanamount+"&duration="+loantenure,
- },
- {
- "name": "aloanamount",
- "content": addCommas(allowed.amount)
- },
- {
- "name": "aloantenor",
- "content": allowed.tenor
- },
- {
- "name": "amrepayment",
- "content": addCommas(ncalcs.mrepayment)
- },
- ]
- }
- }
- return message;
- }
- function sendMail(text){
- var message = template(text);
- $.ajax({
- url: "https://mandrillapp.com/api/1.0/messages/send-template.json",
- method: "POST",
- dataType : 'json',
- data:message,
- success : function(res){
- $('#theform').addClass( 'hide' );
- if(res[0].status == "sent"){
- // CompleteRegistration
- // Track when a registration form is completed (ex. complete subscription, sign up for a service)
- fbq('track', 'CompleteRegistration');
- $('.final-message' ).html('<h1 style="color:#b9062c;">Please check your email for your quote.</h1>');
- $('.final-message' ).addClass( 'show' );
- $('#to-latter-hide' ).addClass('invisible');
- $.post('../app/users/updateuserfront/',ser,function(data){
- //console.log(data);
- });
- }
- },
- error:function(err){
- console.log(err);
- $('#theform').removeClass( 'hide' );
- $('#to-latter-hide' ).removeClass('invisible');
- alert('Invalid data, Please refresh the page and try again.');
- }
- });
- }
- e.preventDefault();
- return false;
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement