kassa-counter / index.html
Fridrix's picture
undefined - Initial Deployment
58c7050 verified
<!DOCTYPE html>
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Касовий калькулятор</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary-color: #007AFF;
--background-color: #F5F7F9;
--card-background: #FFFFFF;
--text-color: #1D1D1F;
--border-color: #E5E5E7;
--shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
--success-color: #34C759;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
body {
background-color: var(--background-color);
color: var(--text-color);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
background: linear-gradient(135deg, #F5F7F9 0%, #E4E8EC 100%);
}
.container {
width: 100%;
max-width: 900px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 2.5rem;
opacity: 0;
animation: fadeIn 0.8s ease forwards;
}
h1 {
font-weight: 600;
font-size: 2.5rem;
margin-bottom: 0.5rem;
letter-spacing: -0.5px;
background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.subtitle {
color: #86868B;
font-size: 1.1rem;
margin-top: 0.5rem;
}
.calculator {
background-color: var(--card-background);
border-radius: 20px;
padding: 2.5rem;
box-shadow: var(--shadow);
transform: translateY(20px);
opacity: 0;
animation: slideUp 0.6s ease 0.3s forwards;
position: relative;
overflow: hidden;
}
.calculator::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 5px;
background: linear-gradient(90deg, #007AFF, #34C759, #FF9500, #FF2D55);
opacity: 0.8;
}
.denominations-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
.denomination {
display: flex;
flex-direction: column;
transition: transform 0.3s ease;
}
.denomination:hover {
transform: translateY(-5px);
}
label {
font-size: 0.95rem;
margin-bottom: 0.7rem;
color: #86868B;
font-weight: 500;
display: flex;
align-items: center;
}
label i {
margin-right: 8px;
color: var(--primary-color);
}
.input-container {
position: relative;
display: flex;
align-items: center;
}
.input-container::before {
content: '₴';
position: absolute;
left: 15px;
color: #86868B;
font-weight: 500;
z-index: 1;
}
input {
padding: 1rem 1rem 1rem 2.2rem;
border: 1.5px solid var(--border-color);
border-radius: 14px;
font-size: 1.1rem;
transition: all 0.3s ease;
outline: none;
width: 100%;
font-weight: 500;
}
input:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}
.result {
text-align: center;
padding: 2.5rem;
background: linear-gradient(135deg, #007AFF 0%, #5E5CE6 100%);
border-radius: 18px;
color: white;
margin-top: 2rem;
transform: scale(0.95);
opacity: 0;
animation: scaleIn 0.5s ease 0.8s forwards;
box-shadow: 0 10px 30px rgba(0, 122, 255, 0.3);
position: relative;
overflow: hidden;
}
.result::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
opacity: 0.3;
}
.result-label {
font-size: 1.1rem;
margin-bottom: 0.8rem;
opacity: 0.9;
letter-spacing: 0.5px;
position: relative;
display: inline-block;
}
.total-amount {
font-size: 3.5rem;
font-weight: 700;
letter-spacing: -1px;
position: relative;
display: inline-block;
}
.currency {
font-size: 2rem;
font-weight: 600;
margin-left: 0.3rem;
opacity: 0.9;
}
.reset-btn {
background: rgba(255, 255, 255, 0.2);
border: none;
color: white;
padding: 0.8rem 1.5rem;
border-radius: 12px;
font-weight: 500;
margin-top: 1.5rem;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.reset-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideUp {
from {
transform: translateY(20px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes scaleIn {
from {
transform: scale(0.95);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.pulse {
animation: pulse 0.6s ease;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.03); }
100% { transform: scale(1); }
}
.bill-change {
animation: billChange 0.5s ease;
}
@keyframes billChange {
0% { background-color: transparent; }
50% { background-color: rgba(0, 122, 255, 0.1); }
100% { background-color: transparent; }
}
@media (max-width: 768px) {
body {
padding: 1.5rem;
}
.calculator {
padding: 1.8rem;
}
.denominations-grid {
grid-template-columns: repeat(2, 1fr);
gap: 1.2rem;
}
.total-amount {
font-size: 2.8rem;
}
h1 {
font-size: 2.2rem;
}
}
@media (max-width: 480px) {
.denominations-grid {
grid-template-columns: 1fr;
}
.total-amount {
font-size: 2.5rem;
}
h1 {
font-size: 1.8rem;
}
.result {
padding: 1.8rem;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Касовий калькулятор</h1>
<p class="subtitle">Введіть кількість банкнот кожного номіналу в гривнях</p>
</header>
<div class="calculator">
<div class="denominations-grid">
<div class="denomination">
<label for="bill1000"><i class="fas fa-money-bill-wave"></i> 1000 ₴</label>
<div class="input-container">
<input type="number" id="bill1000" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill500"><i class="fas fa-money-bill-wave"></i> 500 ₴</label>
<div class="input-container">
<input type="number" id="bill500" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill200"><i class="fas fa-money-bill-wave"></i> 200 ₴</label>
<div class="input-container">
<input type="number" id="bill200" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill100"><i class="fas fa-money-bill-wave"></i> 100 ₴</label>
<div class="input-container">
<input type="number" id="bill100" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill50"><i class="fas fa-money-bill-wave"></i> 50 ₴</label>
<div class="input-container">
<input type="number" id="bill50" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill20"><i class="fas fa-money-bill-wave"></i> 20 ₴</label>
<div class="input-container">
<input type="number" id="bill20" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill10"><i class="fas fa-money-bill-wave"></i> 10 ₴</label>
<div class="input-container">
<input type="number" id="bill10" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill5"><i class="fas fa-money-bill-wave"></i> 5 ₴</label>
<div class="input-container">
<input type="number" id="bill5" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill2"><i class="fas fa-money-bill-wave"></i> 2 ₴</label>
<div class="input-container">
<input type="number" id="bill2" min="0" value="0" class="bill-input">
</div>
</div>
<div class="denomination">
<label for="bill1"><i class="fas fa-money-bill-wave"></i> 1 ₴</label>
<div class="input-container">
<input type="number" id="bill1" min="0" value="0" class="bill-input">
</div>
</div>
</div>
<div class="result">
<p class="result-label">Загальна сума</p>
<div class="total-amount"><span id="total">0</span><span class="currency"></span></div>
<button class="reset-btn" id="resetBtn"><i class="fas fa-refresh"></i> Очистити</button>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const billInputs = document.querySelectorAll('.bill-input');
const totalElement = document.getElementById('total');
const resetBtn = document.getElementById('resetBtn');
const resultSection = document.querySelector('.result');
// Номиналы купюр
const denominations = {
bill1000: 1000,
bill500: 500,
bill200: 200,
bill100: 100,
bill50: 50,
bill20: 20,
bill10: 10,
bill5: 5,
bill2: 2,
bill1: 1
};
// Функция для расчета общей суммы
function calculateTotal() {
let total = 0;
billInputs.forEach(input => {
const billValue = denominations[input.id];
const billCount = parseInt(input.value) || 0;
total += billValue * billCount;
// Анимация при изменении значения
if (input.value > 0) {
input.parentElement.parentElement.classList.add('bill-change');
setTimeout(() => {
input.parentElement.parentElement.classList.remove('bill-change');
}, 500);
}
});
// Форматирование числа с пробелами
totalElement.textContent = total.toLocaleString('uk-UA');
// Анимация изменения общей суммы
resultSection.classList.add('pulse');
setTimeout(() => {
resultSection.classList.remove('pulse');
}, 600);
}
// Слушатели событий для всех полей ввода
billInputs.forEach(input => {
input.addEventListener('input', calculateTotal);
input.addEventListener('focus', function() {
this.parentElement.parentElement.style.transform = 'translateY(-5px)';
});
input.addEventListener('blur', function() {
this.parentElement.parentElement.style.transform = 'translateY(0)';
});
});
// Кнопка сброса
resetBtn.addEventListener('click', function() {
billInputs.forEach(input => {
input.value = '0';
});
calculateTotal();
// Анимация кнопки
this.classList.add('pulse');
setTimeout(() => {
this.classList.remove('pulse');
}, 600);
});
// Инициализация расчета
calculateTotal();
});
</script>
</body>
</html>