Show dates in collapsed entries of confirmed reimbursements
This commit is contained in:
@@ -3,6 +3,7 @@ import { action } from '@ember/object';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import config from 'kredits-web/config/environment';
|
||||
import fmtDateLocalized from 'kredits-web/helpers/fmt-date-localized';
|
||||
|
||||
export default class ReimbursementItemComponent extends Component {
|
||||
@service kredits;
|
||||
@@ -10,9 +11,10 @@ export default class ReimbursementItemComponent extends Component {
|
||||
|
||||
constructor(owner, args) {
|
||||
super(owner, args);
|
||||
if (this.isUnconfirmed && !this.args.reimbursement.vetoed) {
|
||||
if (this.isUnconfirmed && !this.isVetoed) {
|
||||
this.showExpenseDetails = true;
|
||||
}
|
||||
console.debug(fmtDateLocalized);
|
||||
}
|
||||
|
||||
get ipfsGatewayUrl () {
|
||||
@@ -27,10 +29,32 @@ export default class ReimbursementItemComponent extends Component {
|
||||
return !this.isConfirmed;
|
||||
}
|
||||
|
||||
get isVetoed () {
|
||||
return this.args.reimbursement.vetoed;
|
||||
}
|
||||
|
||||
get showVetoButton () {
|
||||
return this.isUnconfirmed && this.kredits.currentUserIsCore;
|
||||
}
|
||||
|
||||
get showConfirmedIn () {
|
||||
return !this.isVetoed &&
|
||||
(this.showExpenseDetails || this.isUnconfirmed);
|
||||
}
|
||||
|
||||
get expenses () {
|
||||
return this.args.reimbursement.expenses;
|
||||
}
|
||||
|
||||
get expensesDateRange () {
|
||||
const dates = this.expenses.map(e => e.date).uniq().sort();
|
||||
let out = fmtDateLocalized.compute(dates.firstObject)
|
||||
if (dates.length > 1) {
|
||||
out += ' - ' + fmtDateLocalized.compute(dates.lastObject)
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@action
|
||||
toggleExpenseDetails () {
|
||||
this.showExpenseDetails = !this.showExpenseDetails;
|
||||
|
||||
Reference in New Issue
Block a user