Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: #229 fix general observations
  • Loading branch information
enriquezrene committed May 13, 2020
commit d8cec3d2364de743b9c13a6c3d75c5096169022b
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
>Customer description is required</span
>
</div>
<button type="submit" class="btn btn-sm btn-primary" [disabled]="!customerForm.valid">Save</button>
<button (click)="resetCustomerForm()" id="cancel" type="button" class="btn btn-sm btn-secondary mb-2 ml-2 mt-2">
<button type="submit" class="btn btn-primary" [disabled]="!customerForm.valid">Save</button>
<button (click)="resetCustomerForm()" id="cancel" type="button" class="btn btn-secondary mb-2 ml-2 mt-2">
Cancel
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
>
<td class="col-sm-9">{{ customer.name }}</td>
<td class="col-sm-3 text-center">
<button (click)="editCustomer(customer.id)" type="button" class="btn btn-sm btn-secondary">
<button (click)="editCustomer(customer.id)" type="button" class="btn btn-sm btn-primary">
<i class="fa fa-pencil fa-xs"></i>
</button>
<button (click)="deleteCustomer(customer.id)" type="button" class="btn btn-sm btn-danger ml-2">
<i class="fas fa-trash-alt fa-xs"></i>
<button (click)="deleteCustomer(customer.id)" type="button" class="btn btn-sm btn-secondary ml-2">
<i class="fa fa-trash-alt fa-xs"></i>
</button>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<textarea class="form-control form-control-sm mt-2" id="descriptionTextArea" rows="3" placeholder="Description"
formControlName="description"></textarea>
</div>
<button type="submit" class="btn btn-sm btn-primary" [disabled]="!projectTypeForm.valid">
<button type="submit" class="btn btn-primary" [disabled]="!projectTypeForm.valid">
Save
</button>
<button class="btn btn-sm btn-secondary mb-2 ml-2 mt-2" type="reset" [hidden]="!projectTypeToEdit"
<button class="btn btn-secondary mb-2 ml-2 mt-2" type="reset" [hidden]="!projectTypeToEdit"
(click)="cancelButton()">
Cancel
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
>
<td class="col-sm-9">{{ projectType.name }}</td>
<td class="col-sm-3 text-center">
<button type="button" class="btn btn-sm btn-secondary" (click)="updateProjectType(projectType.id)"><i class="fa fa-pencil fa-xs"></i></button>
<button type="button" class="btn btn-sm btn-danger ml-2" (click)="deleteProjectType(projectType.id)"><i class="fas fa-trash-alt fa-xs"></i></button>
<button type="button" class="btn btn-sm btn-primary" (click)="updateProjectType(projectType.id)"><i class="fa fa-pencil fa-xs"></i></button>
<button type="button" class="btn btn-sm btn-secondary ml-2" (click)="deleteProjectType(projectType.id)"><i class="fas fa-trash-alt fa-xs"></i></button>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<option *ngFor="let type of projectsTypes" [value]="type.id">{{ type.name }}</option>
</select>
</div>
<button type="submit" [disabled]="!projectForm.valid" class="btn btn-sm btn-primary">Save</button>
<button type="submit" [disabled]="!projectForm.valid" class="btn btn-primary">Save</button>
<button
type="reset"
[hidden]="!projectToEdit"
(click)="cancelButton()"
class="btn btn-sm btn-secondary mb-2 ml-2 mt-2"
class="btn btn-secondary mb-2 ml-2 mt-2"
>
Cancel
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
>
<td class="col-sm-9">{{ project.name }}</td>
<td class="col-sm-3 text-center">
<button type="button" class="btn btn-sm btn-secondary" (click)="updateProject(project)">
<button type="button" class="btn btn-sm btn-primary" (click)="updateProject(project)">
<i class="fa fa-pencil fa-xs"></i>
</button>
<button type="button" class="btn btn-sm btn-danger ml-2" (click)="deleteProject(project.id)">
<i class="fas fa-trash-alt fa-xs"></i>
<button type="button" class="btn btn-sm btn-secondary ml-2" (click)="deleteProject(project.id)">
<i class="fa fa-trash-alt fa-xs"></i>
</button>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<img src="../../../assets/img/ioet.png" />
</div>
<div class="login-body">
<h3>Please login</h3>
<h3>Please log in</h3>
</div>

<div class="login-controls">
<button (click)="login()" class="btn btn-primary">login</button>
</div>

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save</button>
<button #closeModal type="button" class="btn btn-secondary" data-dismiss="modal">
Close
Cancel
</button>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export class SidebarComponent implements OnInit {

getItemsSidebar() {
this.itemsSidebar = [
{ route: '/time-clock', icon: 'far fa-clock', text: 'Time Clock' },
{ route: '/time-entries', icon: 'far fa-list-alt', text: 'Time Entries' },
{ route: '/time-clock', icon: 'fas fa-clock', text: 'Time Clock' },
{ route: '/time-entries', icon: 'fas fa-list-alt', text: 'Time Entries' },
{ route: '/reports', icon: 'fas fa-chart-pie', text: 'Reports' },
{ route: '/activities-management', icon: 'far fa-file-alt', text: 'Activities' },
{ route: '/customers-management', icon: 'fas fa-users-cog', text: 'Customers' },
{ route: '/activities-management', icon: 'fas fa-file-alt', text: ' Activities' },
{ route: '/customers-management', icon: 'fas fa-user', text: 'Customers' },
];
}
}
11 changes: 11 additions & 0 deletions src/app/modules/time-clock/models/time.entry.summary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface TimeEntriesSummary {
day: TimeDetails;
week: TimeDetails;
month: TimeDetails;
}

export interface TimeDetails {
hours: string;
minutes: string;
seconds: string;
}
87 changes: 42 additions & 45 deletions src/app/modules/time-clock/pages/time-clock.component.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
<div class="text-center mt-3">
<h6 class="text-left"><strong>Summary</strong></h6>
<hr />
<div class="row pb-4">
<div class="col-4">
<h6>Day</h6>
<h3>4:22</h3>
</div>
<div class="col-4">
<h6>Week</h6>
<h3>14:25</h3>
</div>
<div class="col-4">
<h6>Month</h6>
<h3>49:32</h3>
</div>
</div>
<div style="width: 60%;">

<h6 class="text-left"><strong>Summary</strong></h6>
<hr />
<div class="row pb-4">
<div class="col-4">
<h6>Day</h6>
<h3>4:22</h3>
</div>
<div class="col-4">
<h6>Week</h6>
<h3>14:25</h3>
</div>
<div class="col-4">
<h6>Month</h6>
<h3>49:32</h3>
</div>
</div>
<div class="row pb-4">
<div class="col-12">
<p *ngIf="areFieldsVisible" class="card-title text-left">
<strong>{{ username }}</strong> clocked <strong class="text-clock-in-color">in</strong> at
<strong>{{ activeTimeEntry?.start_date | date:'shortTime' }}</strong>
</p>
<p *ngIf="!areFieldsVisible" class="card-title text-left">
<strong>{{ username }}</strong> you did not clock-in yet.
</p>
</div>
<div class="row pb-4">
<div class="col-12">
<p *ngIf="areFieldsVisible" class="card-title text-left">
You clocked in at
<strong>{{ activeTimeEntry?.start_date | date:'shortTime' }}</strong>
</p>
<p *ngIf="!areFieldsVisible" class="card-title text-left">
Hi <strong>{{ username }}</strong>, please select a project to clock-in.
</p>
</div>

</div>
<div class="input-group input-group-sm mb-3 flex-nowrap">
<div class="input-group-prepend">
<span class="input-group-text span-width" id="inputGroup-sizing-sm">Project</span>
</div>
<app-project-list-hover class="w-100"></app-project-list-hover>
</div>
<div *ngIf="areFieldsVisible">
<app-entry-fields></app-entry-fields>
</div>

</div>
<div class="input-group input-group-sm mb-3 flex-nowrap">
<div class="input-group-prepend">
<span class="input-group-text span-width" id="inputGroup-sizing-sm">Project</span>
</div>
<app-project-list-hover class="w-100"></app-project-list-hover>
</div>
<div *ngIf="areFieldsVisible">
<app-entry-fields></app-entry-fields>
</div>
<div class="container">
<div class="row">
<div class="col text-right">
<button *ngIf="areFieldsVisible" class="btn btn-primary" type="button" (click)="clockOut()">
Clock Out
</button>
</div>
</div>
<div class="form-group" style="text-align: right;">
<button *ngIf="areFieldsVisible" class="btn btn-primary" type="button" (click)="clockOut()">
Clock Out
</button>
</div>
</div>
9 changes: 9 additions & 0 deletions src/app/modules/time-clock/services/entry.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ describe('EntryService', () => {
});
});

it('loads summary with get /summary', () => {
service.baseUrl = 'time-entries';

service.summary().subscribe((response) => {
const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/summary`);
expect(loadEntryRequest.request.method).toBe('GET');
});
});

it('loads all Entries', () => {
service.baseUrl = 'time-entries';
service.loadEntries().subscribe((response) => {
Expand Down
7 changes: 7 additions & 0 deletions src/app/modules/time-clock/services/entry.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TimeEntriesSummary } from './../models/time.entry.summary';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

Expand Down Expand Up @@ -38,4 +39,10 @@ export class EntryService {
const url = `${this.baseUrl}/${idEntry}/stop`;
return this.http.post(url, null);
}

summary(): Observable<TimeEntriesSummary> {
const summaryUrl = `${this.baseUrl}/summary`;
return this.http.get<TimeEntriesSummary>(summaryUrl);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@
<td class="col"> {{ entry.uri }} </td>
<td class="col">
<button
class="btn btn-sm btn-secondary"
class="btn btn-sm btn-primary"
data-toggle="modal"
data-target="#editRecordsByDate"
(click)="editEntry(entry.id)"
>
<i class="fa fa-edit"></i>
<i class="fa fa-edit fa-xs"></i>
</button>
<button
class="btn btn-sm btn-danger ml-2"
class="btn btn-sm btn-secondary ml-2"
data-toggle="modal"
data-target="#deleteModal"
(click)="openModal(entry)"
>
<i class="fa fa-trash"></i>
<i class="fa fa-trash fa-xs"></i>
</button>
</td>

Expand Down