From 47220643370031bc30ca017b69bea7dfc6e6601c Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Mon, 28 Sep 2020 11:04:37 +0200 Subject: [PATCH] WIP expense items --- app/components/add-reimbursement/component.js | 22 +++- app/components/add-reimbursement/template.hbs | 107 +++++++++++------- app/models/expense.js | 43 +++++++ app/models/reimbursement.js | 1 - app/styles/_forms.scss | 25 +++- 5 files changed, 152 insertions(+), 46 deletions(-) create mode 100644 app/models/expense.js 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}} -

-