hosting form view modified
This commit is contained in:
parent
c2b5c62014
commit
87327d028a
8 changed files with 324 additions and 204 deletions
|
|
@ -1,73 +1,76 @@
|
|||
(function($){
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
|
||||
$(window).load(function(){
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
_initOs();
|
||||
|
||||
});
|
||||
|
||||
$(window).resize(function(){
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function _initOs(){
|
||||
|
||||
|
||||
$('.os-circle').click(function(event){
|
||||
$('.os-circle').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
var idTemplate = $(this).data('id');
|
||||
$('input[name=vm_template_id]').val(idTemplate);
|
||||
});
|
||||
$('.config-box').click(function(event){
|
||||
$('.config-box').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
var idConfig = $(this).data('id');
|
||||
var price = $(this).data('price');
|
||||
$('input[name=configuration]').val(idConfig);
|
||||
$('.container-button').fadeIn();
|
||||
$('#priceValue').text(price);
|
||||
});
|
||||
|
||||
$('.owl-carousel').owlCarousel({
|
||||
items:4,
|
||||
nav: true,
|
||||
margin:30,
|
||||
responsiveClass:true,
|
||||
navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1,
|
||||
nav:true
|
||||
},
|
||||
600:{
|
||||
items:2,
|
||||
nav:true
|
||||
},
|
||||
768:{
|
||||
items:3,
|
||||
nav:true
|
||||
},
|
||||
990:{
|
||||
items:4,
|
||||
nav:true
|
||||
}
|
||||
var cardPricing = {
|
||||
'cpu': {
|
||||
'id': 'coreValue',
|
||||
'value': 1,
|
||||
'min': 1,
|
||||
'max': 48,
|
||||
'interval': 1
|
||||
},
|
||||
'ram': {
|
||||
'id': 'ramValue',
|
||||
'value': 2,
|
||||
'min': 2,
|
||||
'max': 200,
|
||||
'interval': 1
|
||||
},
|
||||
'storage': {
|
||||
'id': 'storageValue',
|
||||
'value': 10,
|
||||
'min': 10,
|
||||
'max': 2000,
|
||||
'interval': 10
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
};
|
||||
|
||||
function _initPricing() {
|
||||
_fetchPricing();
|
||||
|
||||
$('.fa-minus.left').click(function(event) {
|
||||
var data = $(this).data('minus');
|
||||
|
||||
if (cardPricing[data].value > cardPricing[data].min) {
|
||||
cardPricing[data].value = Number(cardPricing[data].value) - cardPricing[data].interval;
|
||||
}
|
||||
_fetchPricing();
|
||||
});
|
||||
$('.fa-plus.right').click(function(event) {
|
||||
var data = $(this).data('plus');
|
||||
if (cardPricing[data].value < cardPricing[data].max) {
|
||||
cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval;
|
||||
}
|
||||
_fetchPricing();
|
||||
});
|
||||
|
||||
$('.input-price').change(function() {
|
||||
var data = $(this).attr("name");
|
||||
cardPricing[data].value = $('input[name=' + data + ']').val();
|
||||
_fetchPricing();
|
||||
});
|
||||
}
|
||||
|
||||
function _fetchPricing() {
|
||||
Object.keys(cardPricing).map(function(element) {
|
||||
//$('#'+cardPricing[element].id).val(cardPricing[element].value);
|
||||
$('input[name=' + element + ']').val(cardPricing[element].value);
|
||||
});
|
||||
_calcPricing();
|
||||
}
|
||||
|
||||
function _calcPricing() {
|
||||
var total = (cardPricing['cpu'].value * 5) + (2 * cardPricing['ram'].value) + (0.6 * cardPricing['storage'].value);
|
||||
total = parseFloat(total.toFixed(2));
|
||||
|
||||
$("#total").text(total);
|
||||
$('input[name=total]').val(total);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
_initPricing();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
|
|
|
|||
73
hosting/static/hosting/js/createvm_old.js
Normal file
73
hosting/static/hosting/js/createvm_old.js
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
(function($){
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
|
||||
$(window).load(function(){
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
_initOs();
|
||||
|
||||
});
|
||||
|
||||
$(window).resize(function(){
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function _initOs(){
|
||||
|
||||
|
||||
$('.os-circle').click(function(event){
|
||||
$('.os-circle').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
var idTemplate = $(this).data('id');
|
||||
$('input[name=vm_template_id]').val(idTemplate);
|
||||
});
|
||||
$('.config-box').click(function(event){
|
||||
$('.config-box').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
var idConfig = $(this).data('id');
|
||||
var price = $(this).data('price');
|
||||
$('input[name=configuration]').val(idConfig);
|
||||
$('.container-button').fadeIn();
|
||||
$('#priceValue').text(price);
|
||||
});
|
||||
|
||||
$('.owl-carousel').owlCarousel({
|
||||
items:4,
|
||||
nav: true,
|
||||
margin:30,
|
||||
responsiveClass:true,
|
||||
navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1,
|
||||
nav:true
|
||||
},
|
||||
600:{
|
||||
items:2,
|
||||
nav:true
|
||||
},
|
||||
768:{
|
||||
items:3,
|
||||
nav:true
|
||||
},
|
||||
990:{
|
||||
items:4,
|
||||
nav:true
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue