Published
Edited
Apr 3, 2020
Insert cell
md`# Patēriņa kredīta kalkulators
Patēriņa kredīts ir ērts aizdevums plānotiem un arī negaidītiem izdevumiem, kas tiek izsniegts bez ķīlas, balstoties uz Jūsu ienākumiem!`

Insert cell
viewof loanAmount = text({
title: 'Aizņēmuma summa',
value: 500,
description: 'EUR',
})
Insert cell
viewof term = slider({
title: 'Termiņš',
min: 0,
max: 60,
step: 12,
value: 60,
format: ",",
description: 'mēneši',
})
Insert cell
viewof percentage = text({
title: 'Gada procentu likme',
value: 21.77,
description: '%',
})
Insert cell
{
var sum = calculateTotalPayment(percentage, term, loanAmount);
var monthlyPayment = sum/term;
monthlyPayment = monthlyPayment.toFixed(2);
return html`<b>Kopeja atmaksajama summa:${sum} EUR\n </b> <br>
<b>Ikmēneša maksājums:${monthlyPayment} EUR <b>`
}
Insert cell
function calculateTotalPayment(percentage, term, loanAmount){
percentage = percentage/12/100;
var sum = percentage * Math.pow(1 + percentage, term) / (Math.pow(1 + percentage, term) - 1) * loanAmount * term;
sum = sum.toFixed(2);
return sum;
}
Insert cell
import { text } from "@jashkenas/inputs";
Insert cell
import {slider} from "@jashkenas/inputs"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more