Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix id type to string
  • Loading branch information
jorgecod authored and enriquezrene committed Mar 24, 2020
commit ed3eaf04eb54dec3a057cc9ff0ea4607fa580232
6 changes: 3 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NavbarComponent } from './components/shared/navbar/navbar.component';
import { UserComponent } from './components/shared/user/user.component';
import { SidebarComponent } from './components/shared/sidebar/sidebar.component';
import { ClockComponent } from './components/shared/clock/clock.component';
import { TimeClockComponent } from './components/options-sidebar/time-clock/time-clock.component';
import { ProjectManagementComponent } from './components/options-sidebar/project-management/project-management.component';
import { TimeEntriesComponent } from "./components/options-sidebar/time-entries/time-entries.component";
import { TimeEntriesComponent } from './components/options-sidebar/time-entries/time-entries.component';
import { ProjectListComponent } from './components/shared/project-list/project-list.component';
import { CreateProjectComponent } from './components/shared/create-project/create-project.component';
import { DetailsFieldsComponent } from './components/shared/details-fields/details-fields.component';
Expand Down Expand Up @@ -54,4 +54,4 @@ import { GroupByDatePipe } from './components/shared/pipes/group-by-date/group-b
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
export class AppModule { }
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { ProjectManagementComponent } from './project-management.component';
import { Project } from '../../../interfaces/project';
import { Project } from '../../../interfaces';
import { ProjectService } from '../../../services/project.service';
import { of } from 'rxjs';
import { CreateProjectComponent } from '../../../components/shared/create-project/create-project.component';
import { ProjectListComponent } from '../../../components/shared/project-list/project-list.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

describe('ProjectManagementComponent', () => {
let component: ProjectManagementComponent;
let fixture: ComponentFixture<ProjectManagementComponent>;
let projectService: ProjectService;

const projects: Project[] = [{
id: 1,
id: '1',
name: 'app 1',
details: 'It is a good app',
status: 'inactive',
completed: true
},
{
id: 2,
id: '2',
name: 'app 2',
details: 'It is a good app',
status: 'inactive',
completed: false
},
{
id: 3,
id: '3',
name: 'app 3',
details: 'It is a good app',
status: 'active',
Expand Down Expand Up @@ -89,14 +90,14 @@ describe('ProjectManagementComponent', () => {

it('should edit a project #updateProject', () => {
const project = {
id: 1,
id: '1',
name: 'app test',
details: 'It is a excelent app',
status: 'inactive',
completed: true
};

component.editedProjectId = 1;
component.editedProjectId = '1';
component.updateProject(project);
expect(component.projects.length).toEqual(3);
expect(component.projects[0].name).toBe('app test');
Expand All @@ -106,14 +107,14 @@ describe('ProjectManagementComponent', () => {
});

it('should filter the project to edit #editProject', () => {
const editProjectId = 2;
const editProjectId = '2';
component.editProject(editProjectId);
expect(component.project.name).toBe('app 2');
});

it('should clean the project #cancelForm', () => {
const project = {
id: 1,
id: '1',
name: 'app 1',
details: 'It is a good app',
status: 'inactive',
Expand Down Expand Up @@ -149,7 +150,7 @@ describe('ProjectManagementComponent', () => {
}));

it('should delete a project #deleteProject', () => {
const projectId = 1;
const projectId = '1';

component.deleteProject(projectId);
expect(component.projects.length).toEqual(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Project } from '../../../interfaces/project';
import { Project } from '../../../interfaces';
import { ProjectService } from '../../../services/project.service';

@Component({
Expand Down Expand Up @@ -30,7 +30,7 @@ export class ProjectManagementComponent implements OnInit {
this.projects[projectIndex].status = projectData.status;
this.projects[projectIndex].completed = projectData.completed;
} else {
const newProject: Project = { id: this.projects.length + 1, name: projectData.name,
const newProject: Project = { id: (this.projects.length + 1).toString(), name: projectData.name,
details: projectData.details, status: projectData.status, completed: false
};
this.projects = this.projects.concat(newProject);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,84 +1,91 @@
<div class="text-center mt-5">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-2 text-left">
<strong>Time clock</strong>
</div>
<div class="col-10 text-right">
<i class="far fa-question-circle"></i>
</div>
</div>
<div class="text-center mt-3">

<div *ngIf="showAlertEnterTecnology" class="alert alert-danger" role="alert">
Field technology is requiered. Enter this field for clock out.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: required?

</div>

<div class="card">
<div class="card-header">
<div class="row">
<div class="col-2 text-left">
<strong>Time clock</strong>
</div>
<div class="col-10 text-right">
<i class="far fa-question-circle"></i>
</div>
</div>
</div>

<div class="card-body">
<p *ngIf="!isClockIn" class="card-title text-left"><strong>{{ username }}</strong> clocked <strong class="text-success">in</strong> at <strong>{{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}</strong></p>
<p *ngIf="isClockIn" class="card-title text-left"><strong>{{ username }}</strong> clocked <strong class="text-danger">out</strong> at <strong>{{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}</strong></p>
<h6 class="text-left"><strong>Totals</strong></h6>
<hr>
<div class="row">
<div class="col-4">
<h6>Current</h6>
<h3>{{ hourCounterRealTime | number: '2.0-2' }}:{{ minuteCounterRealTime | number: '2.0-2' }}:{{ secondsCounterRealTime | number: '2.0-2' }}</h3>
</div>
<div class="col-4">
<h6>Day</h6>
<h3>00:00</h3>
</div>
<div class="col-4">
<h6>Week</h6>
<h3>00:00</h3>
</div>
</div>
<h6 class="text-left"><strong>Projects</strong></h6>
<form>
<div class="form-group">
<input type="text" class="form-control" id="formGroupExampleInput" placeholder="&#xF002; Search project" style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, FontAwesome">
</div>
</form>
<p class="text-left"><i class="fas fa-folder"></i><strong> Top</strong></p>
<ul class="list-group">
<app-project-list-hover [projects]="projects" (showFields)="setShowFields($event)"></app-project-list-hover>
</ul>
<br>
<form *ngIf="(!isClockIn || showFields) && !isHidenForm">
<div class="form-group row">
<label for="inputActivity" class="col-sm-2 col-form-label text-center"><strong>Activity</strong></label>
<div class="col-sm-10">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="inputJiraTicket" class="col-sm-2 col-form-label text-center"><strong>Jira Ticket</strong></label>
<div class="col-sm-10">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="inputTechnology" class="col-sm-2 col-form-label text-center"><strong>Technology</strong></label>
<div class="col-sm-10">
<input *ngIf="!showAlertEnterTecnology" #data type="text" (keyup)="enterTechnology(data.value)" class="form-control">
<input *ngIf="showAlertEnterTecnology" #data type="text" (keyup)="enterTechnology(data.value)" class="form-control border-danger">
<div>
<h6 *ngIf="showAlertEnterTecnology" class="text-danger text-left">Technology field is required. Enter this field to clock out.</h6>
</div>
</div>
</div>
</form>
<hr>
<div class="container">
<div class="row">
<div class="col text-left" id="optionsContainer">
<button class="btn btn-light btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Options
</button>
</div>
<div class="col text-right" id="clockInOutContainer">
<button *ngIf="isClockIn" class="btn btn-success btn-sm" type="button" (click)="employeClockIn()">Clock In</button>
<button *ngIf="!isClockIn" class="btn btn-danger btn-sm" type="button" (click)="employeClockOut()">Clock Out</button>
</div>
</div>
</div>
<div class="card-body">
<p *ngIf="!isClockIn" class="card-title text-left"><strong>{{ username }}</strong> clocked <strong
class="text-success">in</strong> at <strong>{{ clockInUsername }}</strong></p>
<p *ngIf="isClockIn" class="card-title text-left"><strong>{{ username }}</strong> clocked <strong
class="text-danger">out</strong> at <strong>{{ clockOutUsername }}</strong></p>
<h6 class="text-left"><strong>Totals</strong></h6>
<hr>
<div class="row">
<div class="col-4">
<h6>Current</h6>
<h3>{{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}</h3>
</div>
<div class="col-4">
<h6>Day</h6>
<h3>4:22</h3>
</div>
<div class="col-4">
<h6>Week</h6>
<h3>14:00</h3>
</div>
</div>
<h6 class="text-left"><strong>Projects</strong></h6>
<form>
<div class="form-group">
<input type="text" class="form-control" id="formGroupExampleInput" placeholder="&#xF002; Search project"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component should be drop-down not a input

style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, FontAwesome">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we defining all these style inline? should not we create a class?

</div>
</form>
<p class="text-left"><i class="fas fa-folder"></i><strong> Top</strong></p>
<ul class="list-group">
<app-project-list-hover [projects]="projects" (showFields)="setShowFields($event)"></app-project-list-hover>
</ul>
<br>
<form *ngIf="!isClockIn || showFields">
<div class="form-group row">
<label for="inputActivity" class="col-sm-2 col-form-label text-center"><strong>Activity</strong></label>
<div class="col-sm-10">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="inputJiraTicket" class="col-sm-2 col-form-label text-center"><strong>Jira Ticket</strong></label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of these styles are just intended to make the screen look exactly the same as time-sheets. We need to make it look better not the same :)

<div class="col-sm-10">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group row">
<label for="inputTechnology" class="col-sm-2 col-form-label text-center"><strong>Technology</strong></label>
<div class="col-sm-10">
<input #data type="text" (keyup)="enterTechnology(data.value)" class="form-control">
</div>
</div>
</form>
<hr>
<div class="container">
<div class="row">
<div class="col text-left">
<button class="btn btn-light btn-sm dropdown-toggle" type="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Options
</button>
</div>
<div class="col text-right">
<button *ngIf="isClockIn" class="btn btn-success btn-sm" type="button" (click)="employeClockIn()">Clock
In</button>
<button *ngIf="!isClockIn" class="btn btn-danger btn-sm" type="button" (click)="employeClockOut()">Clock
Out</button>
</div>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { TimeEntriesComponent } from './time-entries.component';
import { GroupByDatePipe } from '../../shared/pipes/group-by-date/group-by-date.pipe';
import { MonthPickerComponent } from '../../shared/month-picker/month-picker.component';
import { DetailsFieldsComponent } from '../../shared/details-fields/details-fields.component';
import { EmptyStateComponent } from '../../shared/empty-state/empty-state.component';
import { ModalComponent } from '../../shared/modal/modal.component';

describe('TimeEntriesComponent', () => {
let component: TimeEntriesComponent;
let fixture: ComponentFixture<TimeEntriesComponent>;
const entry = {
id: "entry_1",
project: "Mido - 05 de Febrero",
startDate: "2020-02-05T15:36:15.887Z",
endDate: "2020-02-05T18:36:15.887Z",
activity: "development",
technology: "Angular, TypeScript",
comments: "No comments",
ticket: "EY-25"
id: 'entry_1',
project: 'Mido - 05 de Febrero',
startDate: '2020-02-05T15:36:15.887Z',
endDate: '2020-02-05T18:36:15.887Z',
activity: 'development',
technology: 'Angular, TypeScript',
comments: 'No comments',
ticket: 'EY-25'
};

function setup() {
Expand All @@ -26,7 +31,18 @@ describe('TimeEntriesComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TimeEntriesComponent, GroupByDatePipe ]
declarations: [
EmptyStateComponent,
DetailsFieldsComponent,
GroupByDatePipe,
ModalComponent,
MonthPickerComponent,
TimeEntriesComponent
],
imports: [
FormsModule,
ReactiveFormsModule
]
})
.compileComponents();
}));
Expand All @@ -41,16 +57,16 @@ describe('TimeEntriesComponent', () => {
expect(component).toBeTruthy();
});

/* it('should have p tag as \'time-entries works!\'', async(() => {
it('should have p tag as \'time-entries works!\'', async(() => {
// tslint:disable-next-line: no-shadowed-variable
const { app, fixture } = setup();
fixture.detectChanges();
const compile = fixture.debugElement.nativeElement;
const ptag = compile.querySelector('p');
expect(ptag.textContent).toBe('time-entries works!');
})); */
}));

it('should call filter entry', async(() => {
it('should call dataByMonth in ngOnInit()', async(() => {
component.ngOnInit();
expect(component.dataByMonth.length).toEqual(3);
}));
Expand Down
Loading