|
23 | 23 | <app-month-picker [selectedDate]="selectedDate" (dateSelected)="dateSelected($event)"></app-month-picker>
|
24 | 24 | <div style="height: 15px"></div>
|
25 | 25 |
|
26 |
| - <div *ngIf="displayGridView; then gridView; else listView"></div> |
27 |
| - <ng-template #gridView> |
28 |
| - <div id="gridView"> |
29 |
| - <div *ngIf="timeEntriesDataSource$ | async as dataSource"> |
30 |
| - <app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar> |
31 |
| - <app-calendar |
32 |
| - *ngIf="!dataSource.isLoading" |
33 |
| - [timeEntries$]="timeEntriesDataSource$" |
34 |
| - [currentDate]="selectedDate.toDate()" |
35 |
| - [calendarView]="calendarView" |
36 |
| - (changeDate)="changeDate($event)" |
37 |
| - (changeView)="changeView($event)" |
38 |
| - (viewModal)="editEntry($event.id)" |
39 |
| - (deleteTimeEntry)="openModal($event.timeEntry)" |
40 |
| - > |
41 |
| - </app-calendar> |
42 |
| - </div> |
| 26 | + |
| 27 | + <div id="gridView" [hidden]="!displayGridView"> |
| 28 | + <div *ngIf="timeEntriesDataSource$ | async as dataSource"> |
| 29 | + <app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar> |
| 30 | + <app-calendar |
| 31 | + *ngIf="!dataSource.isLoading" |
| 32 | + [timeEntries$]="timeEntriesDataSource$" |
| 33 | + [currentDate]="selectedDate.toDate()" |
| 34 | + [calendarView]="calendarView" |
| 35 | + (changeDate)="changeDate($event)" |
| 36 | + (changeView)="changeView($event)" |
| 37 | + (viewModal)="editEntry($event.id)" |
| 38 | + (deleteTimeEntry)="openModal($event.timeEntry)" |
| 39 | + > |
| 40 | + </app-calendar> |
43 | 41 | </div>
|
44 |
| - </ng-template> |
45 |
| - <ng-template #listView> |
46 |
| - <div id="listView"> |
47 |
| - <table class="table table-sm table-striped mb-0" *ngIf="timeEntriesDataSource$ | async as dataSource"> |
48 |
| - <thead class="thead-blue"> |
49 |
| - <tr class="d-flex"> |
50 |
| - <th class="col">Date</th> |
51 |
| - <th class="col">Time in - out</th> |
52 |
| - <th class="col">Duration</th> |
53 |
| - <th class="col">Customer</th> |
54 |
| - <th class="col">Project</th> |
55 |
| - <th class="col">Activity</th> |
56 |
| - <th class="col"></th> |
57 |
| - </tr> |
58 |
| - </thead> |
59 |
| - <tr *ngIf="dataSource.isLoading"> |
| 42 | + </div> |
| 43 | + |
| 44 | + <div id="listView" [hidden]="displayGridView"> |
| 45 | + <table |
| 46 | + class="table table-sm table-striped mb-0" |
| 47 | + datatable |
| 48 | + [dtTrigger]="dtTrigger" |
| 49 | + [dtOptions]="dtOptions" |
| 50 | + *ngIf="(timeEntriesDataSource$ | async) as dataSource"> |
| 51 | + <caption></caption> |
| 52 | + <thead class="thead-blue"> |
| 53 | + <tr class="d-flex"> |
| 54 | + <th class="col">Date</th> |
| 55 | + <th class="col">Time in - out</th> |
| 56 | + <th class="col">Duration</th> |
| 57 | + <th class="col">Customer</th> |
| 58 | + <th class="col">Project</th> |
| 59 | + <th class="col">Activity</th> |
| 60 | + <th class="col"></th> |
| 61 | + </tr> |
| 62 | + </thead> |
| 63 | + <tr *ngIf="dataSource.isLoading"> |
| 64 | + <td class="text-center" colspan="7">{{NO_DATA_MESSAGE}}</td> |
| 65 | + </tr> |
| 66 | + <app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar> |
| 67 | + <tbody *ngIf="!dataSource.isLoading"> |
| 68 | + <tr *ngIf="!dataSource?.data.length"> |
60 | 69 | <td class="text-center" colspan="7">{{NO_DATA_MESSAGE}}</td>
|
61 | 70 | </tr>
|
62 |
| - <app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar> |
63 |
| - <tbody *ngIf="!dataSource.isLoading"> |
64 |
| - <tr *ngIf="!dataSource?.data.length"> |
65 |
| - <td class="text-center" colspan="7">{{NO_DATA_MESSAGE}}</td> |
66 |
| - </tr> |
67 |
| - <tr class="d-flex" *ngFor="let entry of dataSource.data"> |
68 |
| - <td class="col">{{ entry.start_date | date: 'MM/dd/yyyy' }}</td> |
69 |
| - <td class="col">{{ entry.start_date | date: 'HH:mm' }} - {{ entry.end_date | date: 'HH:mm' }}</td> |
70 |
| - <td class="col">{{ entry.end_date | substractDate: entry.start_date }}</td> |
71 |
| - <td class="col">{{ entry.customer_name }}</td> |
72 |
| - <td class="col">{{ entry.project_name }}</td> |
73 |
| - <td class="col">{{ entry.activity_name }}</td> |
74 |
| - <td class="col"> |
75 |
| - <button |
76 |
| - class="btn btn-sm btn-primary" |
77 |
| - data-toggle="modal" |
78 |
| - data-target="#editRecordsByDate" |
79 |
| - (click)="editEntry(entry.id)" |
80 |
| - > |
81 |
| - <i class="fa fa-edit fa-xs"></i> |
82 |
| - </button> |
83 |
| - <button |
84 |
| - class="btn btn-sm btn-danger ml-2" |
85 |
| - data-toggle="modal" |
86 |
| - data-target="#deleteModal" |
87 |
| - (click)="openModal(entry)" |
88 |
| - > |
89 |
| - <i class="fa fa-trash fa-xs"></i> |
90 |
| - </button> |
91 |
| - </td> |
92 |
| - </tr> |
93 |
| - </tbody> |
94 |
| - </table> |
95 |
| - </div> |
96 |
| - </ng-template> |
| 71 | + <tr class="d-flex" *ngFor="let entry of dataSource.data"> |
| 72 | + <td class="col">{{ entry.start_date | date: 'MM/dd/yyyy' }}</td> |
| 73 | + <td class="col">{{ entry.start_date | date: 'HH:mm' }} - {{ entry.end_date | date: 'HH:mm' }}</td> |
| 74 | + <td class="col">{{ entry.end_date | substractDate: entry.start_date }}</td> |
| 75 | + <td class="col">{{ entry.customer_name }}</td> |
| 76 | + <td class="col">{{ entry.project_name }}</td> |
| 77 | + <td class="col">{{ entry.activity_name }}</td> |
| 78 | + <td class="col"> |
| 79 | + <button |
| 80 | + class="btn btn-sm btn-primary" |
| 81 | + data-toggle="modal" |
| 82 | + data-target="#editRecordsByDate" |
| 83 | + (click)="editEntry(entry.id)" |
| 84 | + > |
| 85 | + <i class="fa fa-edit fa-xs"></i> |
| 86 | + </button> |
| 87 | + <button |
| 88 | + class="btn btn-sm btn-danger ml-2" |
| 89 | + data-toggle="modal" |
| 90 | + data-target="#deleteModal" |
| 91 | + (click)="openModal(entry)" |
| 92 | + > |
| 93 | + <i class="fa fa-trash fa-xs"></i> |
| 94 | + </button> |
| 95 | + </td> |
| 96 | + </tr> |
| 97 | + </tbody> |
| 98 | + </table> |
| 99 | + </div> |
97 | 100 | </div>
|
| 101 | + |
98 | 102 | <div class="modal fade" id="editRecordsByDate" tabindex="-1" role="dialog">
|
99 | 103 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
100 | 104 | <div class="modal-content" cdkDrag (cdkDragEnded)="resetDraggablePosition($event)">
|
|
0 commit comments