<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="price-box">
<div class="row">
<div class="col-sm-6">
<form class="form-horizontal form-pricing" role="form">
<div class="price-slider">
<h4 class="great">Amount</h4>
<span>Minimum Php 15,000 is required</span>
<div class="col-sm-12">
<div id="slider_amirol2"></div>
</div>
</div>
<div class="price-slider">
<h4 class="great">Duration</h4>
<span>Please choose one</span>
<div class="btn-group btn-group-justified">
<div class="btn-group btn-group-lg">
<button type="button" class="btn btn-primary btn-lg btn-block month2 active-month selected-month" id='12'>12 Months</button>
</div>
</div>
</div>
<div class="price-slider">
<h4 class="great">Term</h4>
<span>Please choose one</span>
<input name="sliderVal" type="hidden" id="sliderVal2" value='0' readonly="readonly" />
<input name="month" type="hidden" id="month2" value='12' readonly="readonly" />
<input name="term" type="hidden" id="term2" value='semimonthly' readonly="readonly" />
<div class="btn-group btn-group-justified">
<div class="btn-group btn-group-lg">
<button type="button" class="btn btn-primary btn-lg btn-block term2 active-term selected-term" id='semimonthly'>Semi-Monthly</button>
</div>
<!-- <div class="btn-group btn-group-lg">
<button type="button" class="btn btn-primary btn-lg btn-block term" id='monthly' disabled>Monthly</button>
</div>
<div class="btn-group btn-group-lg">
<button type="button" class="btn btn-primary btn-lg btn-block term" id='weekly' disabled>Weekly</button>
</div> -->
</div>
</div>
</div>
<div class="col-sm-6">
<div class="price-form">
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label for="amount_amirol" class="control-label">Interest (Php): </label>
<span class="help-text">On top of borrowed amount</span>
</div>
<div class="col-sm-6">
<input type="hidden" id="amount_amirol" class="form-control">
<!-- <p class="price lead" id="total"></p> -->
<input class="price lead" name="totalprice" type="text" id="p_interest" disabled="disabled" style="" />
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label for="amount_amirol" class="control-label">Total Repayment (Php): </label>
<span class="help-text">Amount that you need to pay</span>
</div>
<div class="col-sm-6">
<input type="hidden" id="amount_amirol" class="form-control">
<!-- <p class="price lead" id="total"></p> -->
<input class="price lead" name="totalprice" type="text" id="p_total" disabled="disabled" style="" />
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label for="amount_amirol" class="control-label">Monthly (Php): </label>
<span class="help-text">Payable every Month</span>
</div>
<div class="col-sm-6">
<input type="hidden" id="amount_amirol" class="form-control">
<!-- <p class="price lead" id="total12"></p> -->
<input class="price lead" name="totalprice12" type="text" id="p_total12" disabled="disabled" style="" />
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<label for="amount_amirol" class="control-label">Semi-Monthly (Php): </label>
<span class="help-text">Payable every 2 weeks</span>
</div>
<div class="col-sm-6">
<input type="hidden" id="amount_amirol" class="form-control">
<!-- <p class="price lead" id="total52"></p> -->
<input class="price lead" name="totalprice52" type="text" id="p_total52" disabled="disabled" style="" />
</div>
</div>
</div>
<div style="margin-top:30px"></div>
<hr class="style">
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-primary btn-lg btn-block">Apply Now <span class="glyphicon glyphicon-chevron-right"></span></button>
<button type="submit" class="btn btn-success btn-lg btn-block">Client Login <span class="glyphicon glyphicon-chevron-right"></span></button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
body {
padding-top: 60px;
}
.price-box {
margin: 0 auto;
background: #E9E9E9;
border-radius: 10px;
padding: 40px 15px;
/*width: 500px;*/
}
.ui-widget-content {
border: 1px solid #bdc3c7;
background: #e1e1e1;
color: #222222;
margin-top: 4px;
}
.ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 7.2em;
height: 2.7em;
cursor: default;
margin: 0 -40px auto !important;
text-align: center;
line-height: 30px;
color: #FFFFFF;
font-size: 12px;
}
.ui-slider .ui-slider-handle .glyphicon {
color: #FFFFFF;
margin: 0 1px;
font-size: 11px;
opacity: 0.7;
}
.ui-corner-all {
border-radius: 20px;
}
.ui-slider-horizontal .ui-slider-handle {
top: -.9em;
}
.ui-state-default,
.ui-widget-content .ui-state-default {
border: 1px solid #f9f9f9;
background: #3498db;
}
.ui-slider-horizontal .ui-slider-handle {
margin-left: -0.5em;
}
.ui-slider .ui-slider-handle {
cursor: pointer;
}
.ui-slider a,
.ui-slider a:focus {
cursor: pointer;
outline: none;
}
.price, .lead p {
font-weight: 600;
font-size: 32px;
display: inline-block;
line-height: 60px;
border:0;
width: 245px;
}
h4.great {
background: #00ac98;
margin: 0 0 25px -60px;
padding: 7px 15px;
color: #ffffff;
font-size: 18px;
font-weight: 600;
border-radius: 5px;
display: inline-block;
-moz-box-shadow: 2px 4px 5px 0 #ccc;
-webkit-box-shadow: 2px 4px 5px 0 #ccc;
box-shadow: 2px 4px 5px 0 #ccc;
}
.total {
border-bottom: 1px solid #7f8c8d;
/*display: inline;
padding: 10px 5px;*/
position: relative;
padding-bottom: 20px;
}
.total:before {
content: "";
display: inline;
position: absolute;
left: 0;
bottom: 5px;
width: 100%;
height: 3px;
background: #7f8c8d;
opacity: 0.5;
}
.price-slider {
margin-bottom: 70px;
}
.price-slider span {
font-weight: 200;
display: inline-block;
color: #7f8c8d;
font-size: 13px;
}
.form-pricing {
background: #ffffff;
padding: 20px;
border-radius: 4px;
}
.price-form {
background: #ffffff;
margin-bottom: 10px;
padding: 20px;
border: 1px solid #eeeeee;
min-height: 520px;
border-radius: 4px;
/*-moz-box-shadow: 0 5px 5px 0 #ccc;
-webkit-box-shadow: 0 5px 5px 0 #ccc;
box-shadow: 0 5px 5px 0 #ccc;*/
}
.form-group {
margin-bottom: 0;
}
.form-group span.price {
font-weight: 200;
display: inline-block;
color: #7f8c8d;
font-size: 14px;
}
.help-text {
display: block;
margin-top: -10px;
margin-bottom: 10px;
color: #737373;
/*position: absolute;*/
/*margin-left: 20px;*/
font-weight: 200;
/*text-align: right;*/
width: 188px;
}
.price-form label {
font-weight: 200;
font-size: 21px;
}
img.payment {
display: block;
margin-left: auto;
margin-right: auto
}
.ui-slider-range-min {
background: #2980b9;
}
.active-month,
.active-term {
background: #3276b1;
}
/* HR */
hr.style {
margin-top: 0;
border: 0;
border-bottom: 1px dashed #ccc;
background: #999;
}
// JavaScript Document
var p2 = {
0: "15K",
1: "20K",
2: "25K",
3: "30K",
4: "35K",
5: "40K",
6: "45K",
7: "50K",
8: "55K",
9: "60K",
10: "65K",
11: "70K",
12: "75K",
13: "80K",
14: "85K",
15: "90K",
16: "95K",
17: "100K",
18: "105K",
19: "110K",
20: "115K",
21: "120K",
22: "125K",
23: "130K",
24: "135K",
25: "140K",
26: "145K",
27: "150K",
28: "155K",
29: "160K",
30: "165K",
31: "170K",
32: "175K",
33: "180K",
34: "185K",
35: "190K",
36: "195K",
37: "200K",
38: "205K",
39: "210K",
40: "215K",
41: "220K",
42: "225K",
43: "230K",
44: "235K",
45: "240K",
46: "245K",
47: "250K",
};
var t2 = {
0: "15000",
1: "20000",
2: "25000",
3: "30000",
4: "35000",
5: "40000",
6: "45000",
7: "50000",
8: "55000",
9: "60000",
10: "65000",
11: "70000",
12: "75000",
13: "80000",
14: "85000",
15: "90000",
16: "95000",
17: "100000",
18: "105000",
19: "110000",
20: "115000",
21: "120000",
22: "125000",
23: "130000",
24: "135000",
25: "140000",
26: "145000",
27: "150000",
28: "155000",
29: "160000",
30: "165000",
31: "170000",
32: "175000",
33: "180000",
34: "185000",
35: "190000",
36: "195000",
37: "200000",
38: "205000",
39: "210000",
40: "215000",
41: "220000",
42: "225000",
43: "230000",
44: "235000",
45: "240000",
46: "245000",
47: "250000",
}
var obj2 = {
'12' : {
'semimonthly' : '1.84',
'monthly' : '1.28',
'weekly' : '1.2'
},
};
$(document).ready(function() {
$("#p_total").val("15000");
$("#slider_amirol2").slider({
range: "min",
animate: true,
min: 0,
max: 47,
step: 1,
slide:
function(event, ui)
{
update2(1,ui.value); //changed
calcualtePrice2(ui.value);
}
});
$('.month2').on('click',function(event) {
var id = $(this).attr('id');
$('.month2').removeClass('selected-month');
$(this).addClass('selected-month');
$(".month2").removeClass("active-month");
$(this).addClass("active-month");
$('#month2').val(id);
calcualtePrice2()
});
$('.term2').on('click',function(event) {
var id = $(this).attr('id');
$('.term2').removeClass('selected-term');
$(this).addClass('selected-term');
$(".term2").removeClass("active-term");
$(this).addClass("active-term");
$('#term2').val(id);
calcualtePrice2()
});
update2();
calcualtePrice2();
});
function update2(slider,val) {
if(undefined === val) val = 0;
var amount = p2[val];
$('#sliderVal2').val(val);
$('#slider_amirol2 a').html('<label><span class="glyphicon glyphicon-chevron-left"></span> '+amount+' <span class="glyphicon glyphicon-chevron-right"></span></label>');
}
function calcualtePrice2(val){
if(undefined === val)
val = $('#sliderVal2').val();
var month = $('#month2').val();
var term = obj2[month][$('#term2').val()];
var totalPrice = t2[val]*term;
$("#p_total").val(totalPrice.toFixed(2));
$("#p_total12").val(Math.round((totalPrice)/month).toFixed(2));
$("#p_total52").val(Math.round((totalPrice)/month/2).toFixed(2));
$("#p_interest").val((totalPrice.toFixed(2)-t2[val]).toFixed(2));
}