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
added validations in form
  • Loading branch information
daros10 committed Mar 17, 2020
commit 26554fbeb282c10167310a402730ad0a7fbd2ed1
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<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.
</div>

<div class="card">
<div class="card-header">
<div class="row">
Expand All @@ -12,7 +16,8 @@
</div>

<div class="card-body">
<p class="card-title text-left"><strong>Dario</strong> clocked out at <strong>hh:mm:ss</strong></p>
<p *ngIf="!isClockIn" class="card-title text-left"><strong>Dario</strong> clocked <strong class="text-success">in</strong> at <strong>hh:mm:ss</strong></p>
<p *ngIf="isClockIn" class="card-title text-left"><strong>Dario</strong> clocked <strong class="text-danger">out</strong> at <strong>hh:mm:ss</strong></p>
<h6 class="text-left"><strong>Totals</strong></h6>
<hr>
<div class="row">
Expand Down Expand Up @@ -68,7 +73,7 @@ <h6 class="text-left"><strong>Projects</strong></h6>
<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 type="text" class="form-control">
<input #data type="text" (keyup)="enterTechnology(data.value)" class="form-control">
</div>
</div>
</form>
Expand All @@ -82,7 +87,7 @@ <h6 class="text-left"><strong>Projects</strong></h6>
</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)="employeClockIn()">Clock Out</button>
<button *ngIf="!isClockIn" class="btn btn-danger btn-sm" type="button" (click)="employeClockOut()">Clock Out</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,34 @@ import { Component, OnInit } from '@angular/core';
export class TimeClockComponent {

isClockIn: boolean;
isEnterTechnology: boolean;
showAlertEnterTecnology: boolean;

constructor() {
this.isClockIn = true;
this.isEnterTechnology = false;
}

employeClockIn(): boolean {
this.isClockIn = !this.isClockIn;
console.log('valor es' + this.isClockIn);
return this.isClockIn;
}

employeClockOut() {
if ( this.isEnterTechnology === false ) {
this.isClockIn = false;
this.showAlertEnterTecnology = true;
} else {
this.isClockIn = true;
this.showAlertEnterTecnology = false;
}
}

enterTechnology(data: string) {
if ( data.length > 0 ) {
this.isEnterTechnology = true;
} else {
this.isEnterTechnology = false;
}
}
}