123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- $(document).ready(function() {
- let subscriptionData = localStorage.getItem("subscription-data") ? JSON.parse(localStorage.getItem("subscription-data")) : null;
-
-
- data.cores = subscriptionData.blockDetails.cores;
- data.ram = subscriptionData.blockDetails.ram;
- data.storage = subscriptionData.blockDetails.storage;
- data.transfer = subscriptionData.blockDetails.transfer;
-
- blockValue = subscriptionData.currentBlock;
-
- subscriptionType = subscriptionData.subscriptionType;
-
- data.totalCost = subscriptionData.totalCost
-
- toggleSwitch = subscriptionData.toggleSwitch
-
- console.log(toggleSwitch)
-
-
- changeHtmlData();
- $("#auth-block-input").change(function(){
-
- let blockInp=$(this).val();
- if(blockInp==0 || blockInp >= 100) return;
-
- blockValue = blockInp;
- data.cores=4*blockInp;
- data.ram =4*blockInp;
- data.storage =512*blockInp;
- data.transfer = 8*blockInp;
-
- changeHtmlData();
-
- })
- });
- // toggleswitch
- // $('#order-summary-toggle-switch').change(function() {
- console.log('change event')
- console.log($('#order-summary-toggle-switch'))
-
- $('#order-summary-toggle-switch').change(function() {
- blockValue = $("#auth-block-input").val();
- if(blockValue == 0) return;
-
- if(this.checked) {
- subscriptionType = "yearly";
- }else{
- subscriptionType = "monthly";
- }
-
- changeTotalCost();
- });
- $(".status-check.nav-pills .nav-link").click(function() {
- // $(".status-check.nav-pills .nav-link").find('input[type=radio]').prop('checked',false);
- $(".status-check.nav-pills .nav-link.active").find('input[type=radio]').prop('checked',true);
- });
- $(".status-label").click(function() {
- // $(".status-label").find('input[type=radio]').prop('checked',false);
- // $(".status-label").find('input[type=radio]').prop('checked',true);
- });
- // change total-cost-order-summery
- function changeTotalCost() {
- blockValue = $("#auth-block-input").val();
- if(blockValue == 0) return;
-
- if(!totalCost[blockValue]) return;
-
- $("#subscription-cost").html(totalCost[blockValue].total[subscriptionType]);
-
- changeServerPricing(blockValue);
- }
-
- // new-input-changes
- function changeHtmlData() {
- $("#auth-block-input").val(blockValue);
- $("#data-cores").html(data.cores);
- $("#data-ram").html(data.ram);
- $("#data-storage").html(data.storage);
- $("#data-transfer").html(data.transfer);
- $("#data-subscription-type").html(subscriptionType);
- $("#subscription-cost").html(totalCost[blockValue].total[subscriptionType]);
- // toggle-switch
- if (toggleSwitch == true){
- $('#order-summary-toggle-switch').prop('checked',true);
- }
- }
|