-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/162-timesheet-month-view'
# Conflicts: # src/angular/hq/src/app/staff-dashboard/staff-dashboard.component.ts
- Loading branch information
Showing
10 changed files
with
415 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
.../app/staff-dashboard/staff-dashboard-month-view/staff-dashboard-month-view.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<table class="w-full border-spacing-0 border-separate"> | ||
<thead class="z-[100] sticky top-0"> | ||
<tr class="text-left"> | ||
<th | ||
scope="col" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pr-2 text-nowrap w-3" | ||
></th> | ||
<th | ||
width="28" | ||
scope="col" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pr-2 text-nowrap" | ||
></th> | ||
<th | ||
width="80" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-3 text-nowrap cursor-pointer" | ||
(click)="onSortClick(sortColumn.Hours)" | ||
> | ||
Hrs | ||
<hq-sort-icon | ||
[column]="sortColumn.Hours" | ||
[activeColumn]="staffDashboardService.sortOption$ | async" | ||
[activeSortDirection]="staffDashboardService.sortDirection$ | async" | ||
/> | ||
</th> | ||
<th | ||
width="160" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-2 cursor-pointer" | ||
(click)="onSortClick(sortColumn.Date)" | ||
> | ||
Date | ||
<hq-sort-icon | ||
[column]="sortColumn.Date" | ||
[activeColumn]="staffDashboardService.sortOption$ | async" | ||
[activeSortDirection]="staffDashboardService.sortDirection$ | async" | ||
/> | ||
</th> | ||
<th | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-5 text-nowrap cursor-pointer" | ||
(click)="onSortClick(sortColumn.ChargeCode)" | ||
> | ||
Chrg Code | ||
<hq-sort-icon | ||
[column]="sortColumn.ChargeCode" | ||
[activeColumn]="staffDashboardService.sortOption$ | async" | ||
[activeSortDirection]="staffDashboardService.sortDirection$ | async" | ||
/> | ||
</th> | ||
<th | ||
width="160" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-2 cursor-pointer" | ||
(click)="onSortClick(sortColumn.ClientName)" | ||
> | ||
Client | ||
<hq-sort-icon | ||
[column]="sortColumn.ClientName" | ||
[activeColumn]="staffDashboardService.sortOption$ | async" | ||
[activeSortDirection]="staffDashboardService.sortDirection$ | async" | ||
/> | ||
</th> | ||
<th | ||
width="160" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-2 cursor-pointer" | ||
(click)="onSortClick(sortColumn.ProjectName)" | ||
> | ||
Project | ||
<hq-sort-icon | ||
[column]="sortColumn.ProjectName" | ||
[activeColumn]="staffDashboardService.sortOption$ | async" | ||
[activeSortDirection]="staffDashboardService.sortDirection$ | async" | ||
/> | ||
</th> | ||
<th | ||
width="160" | ||
class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-2 text-nowrap" | ||
> | ||
Activity / Task | ||
</th> | ||
<th class="bg-blue-900 border-steel-blue-600 border-y py-3 pl-2"> | ||
Description | ||
</th> | ||
<th width="40" class="bg-blue-900 border-steel-blue-600 border-y"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@if (this.staffDashboardService.canEdit$ | async) { | ||
<tr | ||
hq-staff-dashboard-time-entry | ||
(hqTimeChange)="upsertTime($event)" | ||
[enableChooseDate]="true" | ||
[chargeCodes]="chargeCodes" | ||
[time]="{ | ||
date: localISODate, | ||
timeStatus: timeStatus.Unsubmitted, | ||
}" | ||
class="relative z-[1]" | ||
></tr> | ||
} | ||
@for (date of dashboard.dates; track date.date) { | ||
@for (time of date.times; track time.id) { | ||
<tr | ||
hq-staff-dashboard-time-entry | ||
[chargeCodes]="chargeCodes" | ||
(hqTimeChange)="upsertTime($event)" | ||
(hqTimeDelete)="deleteTime($event)" | ||
(hqTimeDuplicate)="duplicateTime($event)" | ||
[time]="time" | ||
class="relative z-[1]" | ||
></tr> | ||
} | ||
} | ||
</tbody> | ||
</table> |
76 changes: 76 additions & 0 deletions
76
...rc/app/staff-dashboard/staff-dashboard-month-view/staff-dashboard-month-view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { StaffDashboardService } from './../service/staff-dashboard.service'; | ||
import { CommonModule } from '@angular/common'; | ||
import { | ||
Component, | ||
EventEmitter, | ||
Input, | ||
OnDestroy, | ||
Output, | ||
} from '@angular/core'; | ||
import { GetChargeCodeRecordV1 } from '../../models/charge-codes/get-chargecodes-v1'; | ||
import { GetDashboardTimeV1Response } from '../../models/staff-dashboard/get-dashboard-time-v1'; | ||
import { TimeStatus } from '../../enums/time-status'; | ||
import { | ||
HQTimeChangeEvent, | ||
HQTimeDeleteEvent, | ||
StaffDashboardTimeEntryComponent, | ||
} from '../staff-dashboard-time-entry/staff-dashboard-time-entry.component'; | ||
import { SortColumn } from '../../models/times/get-time-v1'; | ||
import { SortDirection } from '../../models/common/sort-direction'; | ||
import { ReplaySubject } from 'rxjs'; | ||
import { SortIconComponent } from '../../common/sort-icon/sort-icon.component'; | ||
import { localISODate } from '../../common/functions/local-iso-date'; | ||
|
||
@Component({ | ||
selector: 'hq-staff-dashboard-month-view', | ||
standalone: true, | ||
imports: [CommonModule, StaffDashboardTimeEntryComponent, SortIconComponent], | ||
templateUrl: './staff-dashboard-month-view.component.html', | ||
}) | ||
export class StaffDashboardMonthViewComponent implements OnDestroy { | ||
@Input() dashboard!: GetDashboardTimeV1Response; | ||
@Input() chargeCodes: GetChargeCodeRecordV1[] | null = []; | ||
@Input() showAllRejectedTimes: boolean | null = false; | ||
@Input() canEdit: boolean | null = false; | ||
|
||
timeStatus = TimeStatus; | ||
sortColumn = SortColumn; | ||
localISODate = localISODate(); // represent current day | ||
|
||
@Output() timeChange = new EventEmitter<HQTimeChangeEvent>(); | ||
@Output() timeDelete = new EventEmitter<HQTimeDeleteEvent>(); | ||
@Output() timeDuplicate = new EventEmitter<HQTimeChangeEvent>(); | ||
private destroyed$: ReplaySubject<boolean> = new ReplaySubject(1); | ||
|
||
constructor(public staffDashboardService: StaffDashboardService) {} | ||
|
||
ngOnDestroy(): void { | ||
this.destroyed$.next(true); | ||
this.destroyed$.complete(); | ||
} | ||
|
||
upsertTime(event: HQTimeChangeEvent) { | ||
this.timeChange.emit(event); | ||
} | ||
|
||
deleteTime(event: HQTimeDeleteEvent) { | ||
this.timeDelete.emit(event); | ||
} | ||
|
||
duplicateTime(event: HQTimeChangeEvent) { | ||
this.timeDuplicate.emit(event); | ||
} | ||
|
||
onSortClick(sortColumn: SortColumn) { | ||
if (this.staffDashboardService.sortOption$.value === sortColumn) { | ||
this.staffDashboardService.sortDirection$.next( | ||
this.staffDashboardService.sortDirection$.value === SortDirection.Asc | ||
? SortDirection.Desc | ||
: SortDirection.Asc, | ||
); | ||
} else { | ||
this.staffDashboardService.sortOption$.next(sortColumn); | ||
this.staffDashboardService.sortDirection$.next(SortDirection.Asc); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.