diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c0efe6494..13ce16f9e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -72,7 +72,6 @@ import { TimeDetailsPipe } from './modules/time-clock/pipes/time-details.pipe'; TimeClockComponent, DetailsFieldsComponent, ProjectListHoverComponent, - ModalComponent, TimeEntriesComponent, MonthPickerComponent, EmptyStateComponent, diff --git a/src/app/modules/activities-management/components/activity-list/activity-list.component.scss b/src/app/modules/activities-management/components/activity-list/activity-list.component.scss index 9611f365e..bad7c99f9 100644 --- a/src/app/modules/activities-management/components/activity-list/activity-list.component.scss +++ b/src/app/modules/activities-management/components/activity-list/activity-list.component.scss @@ -1,7 +1,7 @@ @import '../../../../../styles/colors.scss'; .style-list-project { - background-image: $background-gradient-items; + background-color: $primary; color: white; } diff --git a/src/app/modules/activities-management/components/create-activity/create-activity.component.scss b/src/app/modules/activities-management/components/create-activity/create-activity.component.scss index e69de29bb..2d8850f33 100644 --- a/src/app/modules/activities-management/components/create-activity/create-activity.component.scss +++ b/src/app/modules/activities-management/components/create-activity/create-activity.component.scss @@ -0,0 +1 @@ +@import '../../../../../styles/colors.scss'; diff --git a/src/app/modules/activities-management/store/activity-management.effects.ts b/src/app/modules/activities-management/store/activity-management.effects.ts index c2edbb7a8..88e8b1079 100644 --- a/src/app/modules/activities-management/store/activity-management.effects.ts +++ b/src/app/modules/activities-management/store/activity-management.effects.ts @@ -1,4 +1,4 @@ -import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY, UNEXPECTED_ERROR } from '../../shared/messages'; +import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY } from '../../shared/messages'; import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { Action } from '@ngrx/store'; diff --git a/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.scss b/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.scss index e69de29bb..8099bafc8 100644 --- a/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.scss +++ b/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.scss @@ -0,0 +1 @@ +@import '../../../../../../../styles/colors.scss'; diff --git a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html index 4e172ebde..b304d44b2 100644 --- a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html +++ b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html @@ -15,7 +15,7 @@ - diff --git a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.scss b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.scss index 684f4d133..8099bafc8 100644 --- a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.scss +++ b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.scss @@ -1 +1 @@ -@import '../../../../../../../styles/themes/orange-theme'; +@import '../../../../../../../styles/colors.scss'; diff --git a/src/app/modules/customer-management/components/management-customer-projects/management-customer-projects.component.scss b/src/app/modules/customer-management/components/management-customer-projects/management-customer-projects.component.scss index 9ff109f50..926138ba1 100644 --- a/src/app/modules/customer-management/components/management-customer-projects/management-customer-projects.component.scss +++ b/src/app/modules/customer-management/components/management-customer-projects/management-customer-projects.component.scss @@ -1,7 +1,7 @@ @import '../../../../../styles/colors.scss'; .nav-active { - color: $modal-button-secondary; + color: $secondary; } .nav-item > a:hover { opacity: 0.6; diff --git a/src/app/modules/customer-management/components/projects-type/components/create-project-type/create-project-type.component.scss b/src/app/modules/customer-management/components/projects-type/components/create-project-type/create-project-type.component.scss index e69de29bb..8099bafc8 100644 --- a/src/app/modules/customer-management/components/projects-type/components/create-project-type/create-project-type.component.scss +++ b/src/app/modules/customer-management/components/projects-type/components/create-project-type/create-project-type.component.scss @@ -0,0 +1 @@ +@import '../../../../../../../styles/colors.scss'; diff --git a/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.html b/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.html index 076737384..9970f630f 100644 --- a/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.html +++ b/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.html @@ -15,7 +15,7 @@ {{ projectType.name }} - + diff --git a/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.scss b/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.scss index 684f4d133..8099bafc8 100644 --- a/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.scss +++ b/src/app/modules/customer-management/components/projects-type/components/project-type-list/project-type-list.component.scss @@ -1 +1 @@ -@import '../../../../../../../styles/themes/orange-theme'; +@import '../../../../../../../styles/colors.scss'; diff --git a/src/app/modules/customer-management/components/projects-type/store/project-type.effects.ts b/src/app/modules/customer-management/components/projects-type/store/project-type.effects.ts index 65177abab..d11294c8a 100644 --- a/src/app/modules/customer-management/components/projects-type/store/project-type.effects.ts +++ b/src/app/modules/customer-management/components/projects-type/store/project-type.effects.ts @@ -1,4 +1,4 @@ -import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY, UNEXPECTED_ERROR } from '../../../../shared/messages'; +import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY } from '../../../../shared/messages'; import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { Action } from '@ngrx/store'; diff --git a/src/app/modules/customer-management/components/projects/components/create-project/create-project.component.scss b/src/app/modules/customer-management/components/projects/components/create-project/create-project.component.scss index e69de29bb..8099bafc8 100644 --- a/src/app/modules/customer-management/components/projects/components/create-project/create-project.component.scss +++ b/src/app/modules/customer-management/components/projects/components/create-project/create-project.component.scss @@ -0,0 +1 @@ +@import '../../../../../../../styles/colors.scss'; diff --git a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.html b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.html index 5d598d9d0..de42d3dde 100644 --- a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.html +++ b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.html @@ -19,7 +19,7 @@ - diff --git a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.scss b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.scss index 684f4d133..8099bafc8 100644 --- a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.scss +++ b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.scss @@ -1 +1 @@ -@import '../../../../../../../styles/themes/orange-theme'; +@import '../../../../../../../styles/colors.scss'; diff --git a/src/app/modules/customer-management/components/projects/components/store/project.effects.ts b/src/app/modules/customer-management/components/projects/components/store/project.effects.ts index 05876cf2d..04974dabc 100644 --- a/src/app/modules/customer-management/components/projects/components/store/project.effects.ts +++ b/src/app/modules/customer-management/components/projects/components/store/project.effects.ts @@ -1,4 +1,4 @@ -import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY, UNEXPECTED_ERROR } from '../../../../../shared/messages'; +import { INFO_SAVED_SUCCESSFULLY, INFO_DELETE_SUCCESSFULLY } from '../../../../../shared/messages'; import { Injectable } from '@angular/core'; import { of, Observable } from 'rxjs'; import { catchError, map, mergeMap } from 'rxjs/operators'; diff --git a/src/app/modules/customer-management/pages/customer.component.html b/src/app/modules/customer-management/pages/customer.component.html index 28a99bb04..c56abeef8 100644 --- a/src/app/modules/customer-management/pages/customer.component.html +++ b/src/app/modules/customer-management/pages/customer.component.html @@ -1,7 +1,7 @@ -
+
-
- +
+
-

{{ hour | number: '2.0-2' }}:{{ minutes | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

+

{{ hour | number: '2.0-2' }}:{{ minutes | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.html b/src/app/modules/shared/components/details-fields/details-fields.component.html index 7c27d169a..7d705c669 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.html +++ b/src/app/modules/shared/components/details-fields/details-fields.component.html @@ -1,18 +1,25 @@
- Project + Project
+
+ Project is required. +
+
Activity @@ -21,11 +28,17 @@ [class.is-invalid]="activity_id.invalid && activity_id.touched" required id="activity_id" - class="form-control" + class="custom-select" formControlName="activity_id" > - + +
+ Activity is required. +
@@ -53,9 +66,15 @@ class="form-control" aria-label="Small" aria-describedby="inputGroup-sizing-sm" - [class.is-invalid]="start_date.invalid && start_date.touched || hoursValidation" + [class.is-invalid]="(start_date.invalid && start_date.touched)" required /> +
+ Start date is required. +
Start/Hour
@@ -65,10 +84,16 @@ type="text" class="form-control" aria-label="Small" - [class.is-invalid]="start_hour.invalid && start_hour.touched || hoursValidation" + [class.is-invalid]="(start_hour.invalid && start_hour.touched)" required aria-describedby="inputGroup-sizing-sm" /> +
+ Start hour is required. +
@@ -84,6 +109,12 @@ required aria-describedby="inputGroup-sizing-sm" /> +
+ End date is required. +
End/Hour
@@ -93,15 +124,23 @@ id="end_hour" class="form-control" aria-label="Small" - [class.is-invalid]="end_hour.invalid && end_hour.touched" + [class.is-invalid]="(end_hour.invalid && end_hour.touched) || errorDate" required aria-describedby="inputGroup-sizing-sm" /> +
+ End hour is required. +
- +
@@ -109,8 +148,8 @@
diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.scss b/src/app/modules/shared/components/details-fields/details-fields.component.scss index a4b5f6fbb..66072694b 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.scss +++ b/src/app/modules/shared/components/details-fields/details-fields.component.scss @@ -1,7 +1,7 @@ @import '../../../../../styles/colors.scss'; @mixin tagTechnology() { - background-color: $modal-button-secondary; + background-color: $secondary; color: #ffffff; &:hover { @@ -11,7 +11,7 @@ .span-width { width: 6rem; - background-image: $background-pantone; + background-color: $primary; color: white; } diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts b/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts index a17b1a0d2..c67f9bfce 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts +++ b/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts @@ -140,6 +140,8 @@ describe('DetailsFieldsComponent', () => { }); it('should emit ngOnChange with new data', () => { + const childComponent = jasmine.createSpyObj('ChildComponent', ['closeModal']); + component.closeModal = childComponent; const formValue = { project_id: '', activity_id: '', @@ -157,6 +159,8 @@ describe('DetailsFieldsComponent', () => { }); it('should call createError ', () => { + const childComponent = jasmine.createSpyObj('ChildComponent', ['closeModal']); + component.closeModal = childComponent; mockEntriesCreateErrorSelector = store.overrideSelector(getCreateError, false); spyOn(store, 'dispatch'); component.ngOnInit(); @@ -164,6 +168,8 @@ describe('DetailsFieldsComponent', () => { }); it('should call updateError ', () => { + const childComponent = jasmine.createSpyObj('ChildComponent', ['closeModal']); + component.closeModal = childComponent; mockEntriesUpdateErrorSelector = store.overrideSelector(getUpdateError, false); spyOn(store, 'dispatch'); component.ngOnInit(); @@ -172,44 +178,25 @@ describe('DetailsFieldsComponent', () => { it('should emit saveEntry event', () => { spyOn(component.saveEntry, 'emit'); - component.onSubmit(); - const data = { + component.entryForm.setValue({ project_id: '', activity_id: '', - technologies: [], - description: '', - start_date: 'T00:00', - end_date: 'T00:00', uri: '', - }; - expect(component.saveEntry.emit).toHaveBeenCalledWith(data); - }); - - it('should emit saveEntry without project and activite fields event', () => { - spyOn(component.saveEntry, 'emit'); - component.entryForm.setValue({ - project_id: 'id', - activity_id: 'fc5fab41-a21e-4155-9d05-511b956ebd05', - uri: '', - start_date: '', - end_date: '', + start_date: '2020-02-05', + end_date: '2020-02-05', start_hour: '00:00', - end_hour: '00:00', + end_hour: '00:01', description: '', technology: '', }); - component.activities = [ - { id: 'fc5fab41-a21e-4155-9d05-511b956ebd05', tenant_id: 'ioet', name: 'activity1', description: '' }, - ]; component.onSubmit(); - fixture.detectChanges(); const data = { - project_id: 'id', - activity_id: 'fc5fab41-a21e-4155-9d05-511b956ebd05', + project_id: '', + activity_id: '', technologies: [], description: '', - start_date: 'T00:00', - end_date: 'T00:00', + start_date: '2020-02-05T00:00', + end_date: '2020-02-05T00:01', uri: '', }; expect(component.saveEntry.emit).toHaveBeenCalledWith(data); diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.ts b/src/app/modules/shared/components/details-fields/details-fields.component.ts index e37be1849..4fe089ecb 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.ts +++ b/src/app/modules/shared/components/details-fields/details-fields.component.ts @@ -35,7 +35,6 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { @Input() formType: string; @Output() saveEntry = new EventEmitter(); @ViewChild('closeModal') closeModal: ElementRef; - @ViewChild('list') list: ElementRef; entryForm: FormGroup; selectedTechnologies: string[] = []; isLoading = false; @@ -43,14 +42,9 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { activities: Activity[] = []; keyword = 'name'; showlist: boolean; - hoursValidation: boolean; + errorDate: boolean; constructor(private formBuilder: FormBuilder, private store: Store, private renderer: Renderer2) { - this.renderer.listen('window', 'click', (e: Event) => { - if (this.showlist && !this.list.nativeElement.contains(e.target)) { - this.showlist = false; - } - }); this.entryForm = this.formBuilder.group({ project_id: '', activity_id: '', @@ -65,7 +59,6 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { } ngOnInit(): void { - this.store.dispatch(new projectActions.LoadProjects()); const projects$ = this.store.pipe(select(getProjects)); projects$.subscribe((response) => { @@ -95,7 +88,6 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { } ngOnChanges(): void { - this.hoursValidation = false; if (this.entryToEdit) { this.selectedTechnologies = this.entryToEdit.technologies; this.entryForm.setValue({ @@ -110,21 +102,25 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { technology: '', }); } else { - this.selectedTechnologies = []; - this.entryForm.setValue({ - project_id: '', - activity_id: '', - description: '', - start_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'), - start_hour: '00:00', - end_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'), - end_hour: '00:00', - uri: '', - technology: '', - }); + this.cleanForm(); } } + cleanForm() { + this.selectedTechnologies = []; + this.entryForm.setValue({ + project_id: '', + activity_id: '', + description: '', + start_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'), + start_hour: '00:00', + end_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'), + end_hour: '00:00', + uri: '', + technology: '', + }); + } + onTechnologiesUpdated($event: string[]) { this.selectedTechnologies = $event; } @@ -153,8 +149,13 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { } closeEntryModal() { + this.close(); + this.closeModal.nativeElement.click(); + } + + close() { this.entryForm.reset(); - this.closeModal?.nativeElement?.click(); + this.cleanForm(); } onSubmit() { @@ -167,6 +168,12 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { end_date: `${this.entryForm.value.end_date}T${this.entryForm.value.end_hour}`, uri: this.entryForm.value.uri, }; - this.saveEntry.emit(entry); + + if (new Date(entry.start_date) < new Date(entry.end_date)) { + this.errorDate = false; + this.saveEntry.emit(entry); + } else { + this.errorDate = true; + } } } diff --git a/src/app/modules/shared/components/month-picker/month-picker.component.scss b/src/app/modules/shared/components/month-picker/month-picker.component.scss index 01ae0076a..6d2dddcc6 100644 --- a/src/app/modules/shared/components/month-picker/month-picker.component.scss +++ b/src/app/modules/shared/components/month-picker/month-picker.component.scss @@ -1,7 +1,7 @@ @import '../../../../../styles/colors.scss'; .month { - background: $header; + background: $primary; color: white; cursor: pointer; @@ -11,5 +11,5 @@ } .active { - background-color: $item-background; + background-color: $primary; } diff --git a/src/app/modules/shared/components/navbar/navbar.component.html b/src/app/modules/shared/components/navbar/navbar.component.html index ceba11c3f..db02d44c4 100644 --- a/src/app/modules/shared/components/navbar/navbar.component.html +++ b/src/app/modules/shared/components/navbar/navbar.component.html @@ -1,4 +1,4 @@ -