add a log time button to the timelogging widget

pull/7996/head
ulferts 5 years ago
parent f23d41f1b4
commit 3b9a4205f4
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 6
      frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass
  2. 8
      frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
  3. 10
      frontend/src/app/modules/calendar/te-calendar/te-calendar.template.html

@ -90,3 +90,9 @@
padding-right: 5px
font-weight: bold
.te-calendar--create-button
float: right
margin-right: 0
margin-top: 4px
height: 34px

@ -83,6 +83,10 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
protected memoizedTimeEntries:{start:Date, end:Date, entries:Promise<CollectionResource<TimeEntryResource>>};
protected memoizedCreateAllowed:boolean = false;
public text = {
logTime: this.i18n.t('js.button_log_time')
};
constructor(readonly states:States,
readonly timeEntryDm:TimeEntryDmService,
readonly $state:StateService,
@ -311,6 +315,10 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
});
}
public addEventToday() {
this.addEvent(moment(new Date()));
}
private addEvent(date:Moment) {
if (!this.memoizedCreateAllowed) {
return;

@ -2,6 +2,16 @@
<div class="te-calendar--container loading-indicator--location"
[attr.data-indicator-name]="'table'"
style="position: relative">
<button class="button te-calendar--create-button"
[attr.aria-label]="text.logTime"
(click)="addEventToday()">
<op-icon icon-classes="button--icon icon-log_time"></op-icon>
<span class="button--text"
[textContent]="text.logTime"
aria-hidden="true"></span>
</button>
<full-calendar #ucCalendar
[editable]="calendarEditable"
[eventLimit]="calendarEventLimit"

Loading…
Cancel
Save