diff --git a/expenses_claim/forms.py b/expenses_claim/forms.py index e616ab6..df29290 100644 --- a/expenses_claim/forms.py +++ b/expenses_claim/forms.py @@ -5,11 +5,12 @@ from string import ascii_uppercase class ExpensesClaim(forms.Form): - """Expenses claim form""" + """Expenses claim form.""" name = forms.CharField(label='Nimi', max_length=100) iban = forms.CharField(label='IBAN', max_length=100) - amount = forms.DecimalField(label='Summa', decimal_places=2) + email = forms.EmailField(label='Sähköposti', max_length=100) + amount = forms.DecimalField(label='Yhteensä', decimal_places=2) def clean_iban(self): """Validate IBAN.""" diff --git a/expenses_claim/static/claim_form/css/base.css b/expenses_claim/static/claim_form/css/base.css new file mode 100644 index 0000000..8ef0d30 --- /dev/null +++ b/expenses_claim/static/claim_form/css/base.css @@ -0,0 +1,169 @@ +* { + margin: 0; + padding: 0; +} + +.heading { + padding: 20px 10px; + text-align: center; +} + +.claim-form { + display: flex; + flex-direction: column; + align-items: center; + width: 100% +} + +.form { + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 10px 20px; + width: 60%; +} + +.table { + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: space-between; + padding: 20px 10px; +} + +.scrollarea { + display: flex; + flex-direction: column; + justify-content: flex-start; + overflow-y: scroll; +} + +.tablerow { + display: flex; + flex-direction: row; + justify-content: space-between; + flex-wrap: wrap; + padding: 10px 5px; +} + +.fieldscolumn { + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: flex-end; +} + +.fieldsrow { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + align-items: stretch; + padding: 5px 10px; +} + +.submit { + align-self: center; + width: 30%; + margin: 20px 10px; +} + +.imageupload > input { + display: none; +} + +.fieldsrow > div { + margin: 10px 20px; +} + +.fieldscolumn > div { + margin: 10px 20px; +} + + +.fieldscolumn > div > label { + margin-right: 20px; +} + +.money > input { + width: 100px; +} + +#addreceipt { + height: 40px; +} + +#total { + display: flex; + flex-direction: row; + justify-content: flex-end; + padding: 20px 10px; +} + +#receiptslist { + height: 20rem; +} + +#info2 { + justify-content: flex-end; +} + +#textbox > textarea { + align-self: flex-end; +} + +#id_iban { + width: 18rem; +} + + +.fieldscolumn > #textbox > textarea { + height: 8rem; + width: 18rem; +} + + +@media only screen and (max-width: 768px) { + .heading { + font-size: 18px; + padding: 5px 5px; + } + + h1.heading { + visibility: hidden; + height: 0px; + } + + .table { + padding: 5px 5px + } + + #total { + justify-content: center; + } + + .fieldsrow { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-around; + padding: 5px 5px + } + + #receiptslist { + width: 12rem; + } +} + +@media only screen and (max-height: 741px) { + #receiptslist { + height: 17rem; + } +} + +@media only screen and (max-height: 569px) { + #receiptslist { + height: 10rem; + } +} \ No newline at end of file diff --git a/expenses_claim/static/claim_form/js/addReceipt.js b/expenses_claim/static/claim_form/js/addReceipt.js new file mode 100644 index 0000000..3f75614 --- /dev/null +++ b/expenses_claim/static/claim_form/js/addReceipt.js @@ -0,0 +1,27 @@ +function addReceipt(event) { + event.preventDefault(); + var receipts = document.getElementById("receiptslist"); + var div2append = document.createElement("div"); + var newrow = receipts.appendChild(div2append); + newrow.classList.add("tablerow"); + + div2append = document.createElement("div"); + var div1 = newrow.appendChild(div2append); + div1.classList.add("imageupload"); + div2append = document.createElement("div"); + var div2 = newrow.appendChild(div2append); + div2.classList.add("desc"); + div2append = document.createElement("div"); + var div3 = newrow.appendChild(div2append); + div3.classList.add("money"); + + var file = document.getElementById("newreceipt"); + var desc = document.getElementById("adddescription"); + var sum = document.getElementById("addsum"); + div1.appendChild(file.cloneNode(true)); + div2.appendChild(document.createTextNode(desc.value)); + div3.appendChild(document.createTextNode(sum.value)); + + var total = document.getElementById("totalsum"); + total.value = Number(total.value) + Number(sum.value); +} \ No newline at end of file diff --git a/expenses_claim/templates/base.html b/expenses_claim/templates/base.html new file mode 100644 index 0000000..444fd2e --- /dev/null +++ b/expenses_claim/templates/base.html @@ -0,0 +1,19 @@ +{% extends "project.html" %} + +{% load static %} +{% load i18n %} + +{% block styles %} + + +{% endblock styles %} + +{% block body %} + +