diff --git a/app/components/add-reimbursement/component.js b/app/components/add-reimbursement/component.js
index d151ba7..17d9c38 100644
--- a/app/components/add-reimbursement/component.js
+++ b/app/components/add-reimbursement/component.js
@@ -4,19 +4,37 @@ import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { A } from '@ember/array';
+import Reimbursement from 'kredits-web/models/reimbursement';
+import Expense from 'kredits-web/models/expense';
export default class AddReimbursementComponent extends Component {
@service kredits;
@tracked recipientId = null;
- @tracked title = "";
- @tracked total = "0";
+ @tracked title = '';
+ @tracked total = '0';
@tracked expenses = A([]);;
+ @tracked newExpense = Expense.create();
+
+ // TODO fetch/apply exchange rate to (W)BTC
+ currencies = [
+ { code: 'EUR' },
+ { code: 'USD' },
+ { code: 'GBP' }
+ ];
get typeofTotal() {
return typeof this.total;
}
+ get submitButtonEnabled() {
+ return this.expenses.length > 0;
+ }
+
+ get submitButtonDisabled() {
+ return !this.submitButtonEnabled;
+ }
+
@alias('kredits.contributorsSorted') contributors;
@action
diff --git a/app/components/add-reimbursement/template.hbs b/app/components/add-reimbursement/template.hbs
index 0c64b88..3dbb710 100644
--- a/app/components/add-reimbursement/template.hbs
+++ b/app/components/add-reimbursement/template.hbs
@@ -1,8 +1,3 @@
-
- Total: {{this.total}}
- Total type: {{this.typeofTotal}}
-
-
diff --git a/app/models/expense.js b/app/models/expense.js
new file mode 100644
index 0000000..cd050af
--- /dev/null
+++ b/app/models/expense.js
@@ -0,0 +1,43 @@
+import EmberObject, { computed } from '@ember/object';
+import moment from 'moment';
+import { A } from '@ember/array';
+
+export default EmberObject.extend({
+ title: null,
+ description: null,
+ currency: null,
+ amount: null,
+ date: null,
+ url: null,
+ tags: null,
+
+ init () {
+ this._super(...arguments);
+ this.setDefaultValues();
+ },
+
+ iso8601Date: computed('date', 'time', function() {
+ return this.time ? `${this.date}T${this.time}` : this.date;
+ }),
+
+ jsDate: computed('iso8601Date', function() {
+ return moment(this.iso8601Date).toDate();
+ }),
+
+ setDefaultValues () {
+ this.set('defaultDate', moment().startOf('hour').toDate());
+ this.setProperties({
+ title: '',
+ description: '',
+ currency: 'EUR',
+ amount: 0,
+ date: this.defaultDate,
+ url: null,
+ tags: A([])
+ });
+ },
+
+ serialize () {
+ return JSON.stringify(this);
+ }
+});
diff --git a/app/models/reimbursement.js b/app/models/reimbursement.js
index f074c30..1d5ee03 100644
--- a/app/models/reimbursement.js
+++ b/app/models/reimbursement.js
@@ -26,7 +26,6 @@ export default EmberObject.extend({
init () {
this._super(...arguments);
- if (isEmpty(this.details)) this.set('details', {});
},
iso8601Date: computed('date', 'time', function() {
diff --git a/app/styles/_forms.scss b/app/styles/_forms.scss
index ec11982..443ab72 100644
--- a/app/styles/_forms.scss
+++ b/app/styles/_forms.scss
@@ -3,10 +3,16 @@ section#add-contribution,
section#add-contribution,
section#add-item, // TODO use for all forms for adding data
section#signup {
-
form {
+ h3 {
+ font-size: 1.5rem;
+ font-weight: normal;
+ margin-top: 2em;
+ margin-bottom: 1em;
+ }
p {
+ font-size: 1.2rem;
margin-bottom: 1.5rem;
&.mg-bottom-md {
@@ -14,6 +20,7 @@ section#signup {
}
&.label {
+ font-size: 1rem;
margin-bottom: .5rem;
}
@@ -33,6 +40,19 @@ section#signup {
opacity: 0.7;
}
+ fieldset {
+ border: none;
+
+ &.horizontal {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ grid-gap: 2rem;
+
+ label {
+ }
+ }
+ }
+
input[type=text], select {
width: 100%;
padding: 1rem;
@@ -41,6 +61,7 @@ section#signup {
background-color: rgba(22, 21, 40, 0.3);
color: #fff;
font-size: 1.2rem;
+ font-weight: normal;
transition: border-color 0.1s linear;
&:focus, &.valid {
@@ -111,7 +132,5 @@ section#signup {
color: #fff;
}
}
-
}
-
}