Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class='flex-container'>
  <form id='form'>
    <fieldset>
      <legend id='legend' class="line-height-one extra-bold sixtyfour-px">
        How much can you
        <br> save with divvy?
      </legend>
      <br>
      <br>
      <input class='twentyeight-px' type='text' id='number-of-employees' placeholder="Number of employees" />
      <label for='number-of-employees' class='sixteen-px bold'>
        Number of employees
      </label>
      <br>
      <input class='twentyeight-px' type='text' id="number-of-spenders" placeholder='Number of spenders' />
      <label class='bold'>
        Number of spenders
      </label>
      <br>
      <input oninput='dollarSyntax()' class='twentyeight-px' value='' type='text' id='monthly-credit-card-spend' placeholder='Monthly credit card spend' />
      <label class='bold'>
        Monthly credit card spend
      </label>
      <br>
      <button class='twenty-px' type='submit' id='sbtbtn' onclick="on(); realCashBackFunction(); return false;">
        Show me the money
      </button>
    </fieldset>
  </form>
  
</div>

<div   class='flex-container' id='results'>
  <div class='results-mobile-box'>
    <div onclick='off();' id='close-modal'>&larr;</div>
  <h1 id='saving-you'   class='extra-bold sixtyfour-px'>Divvy could be saving you:</h1>
  <p id='savings-with-divvy' class='extra-bold onefourtyfour-px'></p>
     <span id="per-year"  class='extra-bold fourtyeight-px'>PER YEAR</span><br>  
    <div class='row'>
    <span class='twentyfour-px col-6 extra-bold'> HARD COST SAVINGS </span> <span class='twentyfour-px col-6 extra-bold'> SOFT COST SAVINGS </span>
    </div>
        <div class='row'>
    <span id='hard-cost-savings' class='fourtyeight-px col-6 h2 extra-bold'>  </span> <span id='soft-cost-savings' class='fourtyeight-px col-6 h2 extra-bold'> </span>
    </div>
    <br><br>
    <p  class='fourtyeight-px'>That's like getting <span id="total-cashback" class='extra-bold'> </span> cash back.</p><br><br>
    <a href="https://getdivvy.com/demo/"><button type='button'>GET A DEMO</button></a><br>
    <br>
    <br>
    <a  href='https://getdivvy.com/real-cash-back/infographic/' id='breakdown'><span style="font-weight: 400">Want a breakdown of the numbers? Go here</span> </a>
  </div>    
  
  

</div>
              
            
!

CSS

              
                body {
  font-family: "Open Sans", sans-serif;
}
per-year{
     margin-top: -40px;
}
#breakdown{
  font-size: 28px;
  font-family: "Open Sans", sans-serif;
  color: white;
  
}
#saving-you{
  transform: translate(0, 50px);
}
#savings-with-divvy{
  transform: translate(0, 40px);
}
#close-modal{
      position: absolute;
    left: 5%;
    top: 25px;
  font-size: 72px;
  cursor: pointer;
}
fieldset {
}
.flex-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8f8f8;
  height: 100vh;
}
input:focus + label {
  color: #6857b2;
  visibility: visible;
}

input:placeholder-shown + label {
  opacity: 0;
/*   transform: translateY(1rem); */
}
input {
  width: 100%;
  font-weight: 800;
  background: transparent;
  border: none;
  border-bottom: 1px solid #bdbdbd;
  font-size: 1.5em;
}
input:focus{
    outline: none;
/* label:not(:focus) {
  color: #000000; */
}
label {
  transform: translate(0, -70px);
  opacity: 1;
  color: #000;
}
input:focus {
  color: #6857b2;
}

input::placeholder {
  font-weight: 400;
}
input:focus::placeholder {
  color: #6857b2;
}
button {
  background-color: #6857b2;
  color: white;
  border-radius: 100px;
  text-transform: uppercase;
  font-size: 1.5em;
  font-weight: 600;
  padding: 16px 32px;
  cursor: pointer;
  
}
button:disabled {
  background-color: darkgray;
}
.extra-bold {
  font-weight: 800;
}
.bold {
  font-weight: 700;
}
.line-height-one {
  line-height: 1;
}

/* Hide HTML5 Up and Down arrows. */
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
 
input[type="number"] {
    -moz-appearance: textfield;
}
#results {
  overflow:scroll;
  text-align: center;
  position: fixed; /* Sit on top of the page content */
  display: none; /* Hidden by default */
  width: 100%; /* Full width (cover the whole page) */
  height: 100vh; /* Full height (cover the whole page) */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #b2f0ea; /* Black background with opacity */
  z-index: 2; /* Specify a stack order in case you're using a different order for other elements */
   /* Add a pointer on hover */
  color: white;
}
 .onefourtyfour-px {
    font-size: 144px;
  }
  .sixtyfour-px {
    font-size: 64px;
  }
  .fourtyeight-px{
    font-size: 48px;
  }
.twentyeight-px{
  font-size: 28px;
}
  .twentyfour-px {
    font-size: 24px;
  }
  .twenty-px {
    font-size: 20px;
  }
  .sixteen-px {
    font-size: 16px;
  }

@media (max-width: 575.98px) { 
  form {
    width: 85%;
  }
  #legend {
    text-align: left;
    margin-bottom: 20%;
    font-size: 1.8em;
    line-height: 1.2;
  }
  #sbtbtn {
    margin-top: 20%;
  }
   br { content: ' '; }
  body {
/*     text-align: center; */
  }
  input {
    padding: 0px 10px 0px 10px;
  }
  .results-mobile-box {
    padding-top: 20px;
    width: 100vw;
/*     height: 600px; */
  }
 .onefourtyfour-px {
    font-size: 2em;
  }
  .sixtyfour-px {
    font-size: 1.5em;
  }
  .fourtyeight-px{
    font-size: 1.6em;
  }
.twentyeight-px{
  font-size: 1.5em;
}
  .twentyfour-px {
    font-size: 1.4em;
  }
  .twenty-px {
    font-size: 1.2em;
  }
  .sixteen-px {
    font-size: 1em;
  }
} 

@media (min-width: 576px) {  }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) {  }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) {  }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) {  }






              
            
!

JS

              
                // DisableSubmitUntilFormIsFilled

$(document).ready(function() {
  function formatNumber(string) {
    let nonNumsRemoved = string.replace(/[^\d]+/g, '');
    const formatter = new Intl.NumberFormat("en-US", {
      style: "currency",
      currency: "USD",
      minimumFractionDigits: 0
    });
    return formatter.format(nonNumsRemoved)
  }
  $(function() {
    $("#sbtbtn").attr("disabled", "disabled");
  });
  $("input").keyup(function() {
    if (
      $("#number-of-employees").val() != "" &&
      $("#number-of-spenders").val() != "" &&
      $("#monthly-credit-card-spend").val() != ""
    ) {
      $("#sbtbtn").removeAttr("disabled");
    } else {
      $("#sbtbtn").attr("disabled", "disabled");
    }
  });
$("#number-of-employees").keyup(function(){
  let numEmp = $("#number-of-employees").val()
  numEmp = formatNumber(numEmp).replace('$', '')
  $("#number-of-employees:text").val(numEmp)
})
$( "#monthly-credit-card-spend" ).keyup(function() {
  let userMonthlySpend = $("#monthly-credit-card-spend").val()
  let inputVal = formatNumber(userMonthlySpend);
  $('#monthly-credit-card-spend:text').val(inputVal)
});
  $( "#number-of-spenders" ).keyup(function() {
  let numOfSpenders = $("#number-of-spenders").val()
  let inputVal = formatNumber(numOfSpenders ).replace('$', '');
  $('#number-of-spenders:text').val(inputVal)
});

});

// function dollarSyntax(userMonthlySpend) {
//     document.getElementById("monthly-credit-card-spend").innerHTML = userMonthlySpend;
//   console.log(userMonthlySpend)
// };
$( "#sbtbtn" ).click(function() {
  $( "#results" ).fadeIn( "slow", function() {
    // Animation complete
  });
});
function realCashBackFunction() {
  // format the currency
  const formatter = new Intl.NumberFormat("en-US", {
    style: "currency",
    currency: "USD",
  });

  // user variables
  let numberOfEmployees = parseInt(document.getElementById("number-of-employees").value.replace(/[^\d]+/g, ''));
  let numberOfSpenders = parseInt(document.getElementById("number-of-spenders").value.replace(/[^\d]+/g, ''));
  let monthlyCreditCardSpend = parseInt(document.getElementById("monthly-credit-card-spend").value.replace(/[^\d]+/g, ''));

  //dynamic variables
    let lossToFraud = 0;
        if(monthlyCreditCardSpend < 20000) {
          lossToFraud = 0;
        }else {
          lossToFraud = numberOfEmployees * 230;
        }

    let costOfExpenseManagementSoftware = numberOfSpenders * 10 * 12;

    let excessOrWastefulSaasProducts = 0;
        // if(numberOfEmployees <= 25 ) {
        //   excessOrWastefulSaasProducts = 10000;
        // }else if (numberOfEmployees <= 50 ) {
        //   excessOrWastefulSaasProducts = 20000;
        // }else if (numberOfEmployees <= 75 ) {
        //   excessOrWastefulSaasProducts = 40000;
        // }else if (numberOfEmployees <= 100 ) {
        //   excessOrWastefulSaasProducts = 80000;
        // }else if (numberOfEmployees <= 200) {
        //   excessOrWastefulSaasProducts = 460000
        // } else {
        //   excessOrWastefulSaasProducts = 134 * (numberOfEmployees - 200) + 460000;
        // }
  console.log(excessOrWastefulSaasProducts)
    //     if (numberOfEmployees < 100) {
    //     excessOrWastefulSaasProducts = 0;
    // } else if (numberOfEmployees <= 200) {
    //     excessOrWastefulSaasProducts = 460000;
    // } else {
    //     excessOrWastefulSaasProducts = 134 * (numberOfEmployees - 200) + 460000;
    // }

    let travelSavings = numberOfSpenders * 321 * 12 * 0.2;

    let cashbackWithDivvy = monthlyCreditCardSpend * 0.00 * 12;
    let timeSpentWithManualExpenseReports = 0;
        if( monthlyCreditCardSpend < 5000) {
          timeSpentWithManualExpenseReports = 0;
        } else {
          timeSpentWithManualExpenseReports = numberOfSpenders * 2 * 12 * 38.72; 
        }
  

    let savingsWithDivvy =
    lossToFraud +
    costOfExpenseManagementSoftware +
    excessOrWastefulSaasProducts +
    travelSavings +
    cashbackWithDivvy +
    timeSpentWithManualExpenseReports;

    let totalCashback = (savingsWithDivvy / (monthlyCreditCardSpend * 12)) * 100;
  console.log(totalCashback)
     if (totalCashback > 12.01) {
       totalCashback = Math.floor(Math.random() * 10.69 + 10.01  )
     }

    let hardCostSavings =
        lossToFraud +
        costOfExpenseManagementSoftware +
        excessOrWastefulSaasProducts +
        cashbackWithDivvy;

    let softCostSavings = 
        travelSavings + 
        timeSpentWithManualExpenseReports;

  // DISPLAY VARIABLES

  document.getElementById("savings-with-divvy").innerHTML = formatter.format(
    savingsWithDivvy 
  );
  document.getElementById("total-cashback").innerHTML =
    totalCashback.toFixed(2) + "%";
  document.getElementById("hard-cost-savings").innerHTML = formatter.format(
    hardCostSavings
  );
  document.getElementById("soft-cost-savings").innerHTML = formatter.format(
    softCostSavings
  );
  document.getElementById("results").style.visibility = "visible";
}
function on() {
  document.getElementById("results").style.display = "flex";
}

function off() {
  document.getElementById("results").style.display = "none";
}








              
            
!
999px

Console