Skip to content

Commit 014aece

Browse files
committed
fixed bugs
1 parent ed7dcd2 commit 014aece

File tree

3 files changed

+74
-25
lines changed

3 files changed

+74
-25
lines changed
Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
.content-ClockIn {
2-
padding: 2.1rem 1rem;
2+
padding: 2.1rem 1rem;
33
}
44

55
.timer {
6-
align-items: center;
7-
display: flex;
8-
height: 100%;
9-
justify-content: center;
6+
align-items: center;
7+
display: flex;
8+
height: 100%;
9+
justify-content: center;
1010
}
11+
12+
.place-holder-danger::-webkit-input-placeholder {
13+
/* WebKit, Blink, Edge */
14+
color: #909;
15+
}
16+
17+
.place-holder-danger:-moz-placeholder {
18+
/* Mozilla Firefox 4 to 18 */
19+
color: #909;
20+
opacity: 1;
21+
}
22+
23+
.placeholder-danger::-moz-placeholder {
24+
/* Mozilla Firefox 19+ */
25+
color: #DC3545 !important;
26+
opacity: 1;
27+
}
28+
29+
.placeholder-danger:-ms-input-placeholder {
30+
/* Internet Explorer 10-11 */
31+
color: #DC3545 !important;
32+
}
33+
34+
.placeholder-danger::-ms-input-placeholder {
35+
/* Microsoft Edge */
36+
color: #DC3545 !important;
37+
}
38+
39+
.placeholder-danger::placeholder {
40+
/* Most modern browsers support this now. */
41+
color: #DC3545 !important;
42+
}

src/app/components/options-sidebar/time-clock/time-clock.component.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
<div class="text-center mt-3">
2-
3-
<div *ngIf="showAlertEnterTecnology" class="alert alert-danger" role="alert">
4-
Field technology is requiered. Enter this field for clock out.
5-
</div>
6-
1+
<div class="text-center mt-5">
72
<div class="card">
83
<div class="card-header">
94
<div class="row">
@@ -62,7 +57,8 @@ <h6 class="text-left"><strong>Projects</strong></h6>
6257
<div class="form-group row">
6358
<label for="inputTechnology" class="col-sm-2 col-form-label text-center"><strong>Technology</strong></label>
6459
<div class="col-sm-10">
65-
<input #data type="text" (keyup)="enterTechnology(data.value)" class="form-control">
60+
<input *ngIf="!showAlertEnterTecnology" #data type="text" (keyup)="enterTechnology(data.value)" class="form-control">
61+
<input *ngIf="showAlertEnterTecnology" #data type="text" (keyup)="enterTechnology(data.value)" class="form-control border-danger placeholder-danger " placeholder="Field technology is requiered. Enter this field for clock out.">
6662
</div>
6763
</div>
6864
</form>

src/app/components/options-sidebar/time-clock/time-clock.component.ts

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export class TimeClockComponent implements OnInit {
2929
seconds: number;
3030
interval;
3131
dataTechnology: string;
32+
execOnlyOneTimeCounter = 0;
33+
execOnlyOneTimeClockIn = 0;
34+
isClockInEnable = false;
3235

3336
constructor() {
3437
this.isClockIn = true;
@@ -42,6 +45,7 @@ export class TimeClockComponent implements OnInit {
4245
}
4346

4447
employeClockIn(): boolean {
48+
this.isClockInEnable = true;
4549
this.isClockIn = !this.isClockIn;
4650
this.startTimer();
4751
this.setTimeToInOut();
@@ -53,12 +57,10 @@ export class TimeClockComponent implements OnInit {
5357
this.isClockIn = false;
5458
this.showAlertEnterTecnology = true;
5559
} else {
56-
this.dataTechnology = '';
57-
this.isClockIn = true;
58-
this.isEnterTechnology = false;
59-
this.showAlertEnterTecnology = false;
60+
this.setVarToEmpty();
6061
this.pauseTimer();
6162
this.setTimeToInOut();
63+
6264
}
6365
}
6466

@@ -72,15 +74,20 @@ export class TimeClockComponent implements OnInit {
7274
}
7375

7476
setShowFields(show: boolean) {
75-
this.isClockIn = false;
76-
this.showFields = show;
77-
this.startTimer();
78-
this.setTimeToInOut();
77+
if ( this.isClockInEnable !== true ) {
78+
this.isClockIn = false;
79+
this.showFields = show;
80+
if ( this.execOnlyOneTimeCounter === 0 ) {
81+
this.startTimer();
82+
this.execOnlyOneTimeCounter++;
83+
}
84+
this.setTimeToInOut();
85+
}
7986
}
8087

8188
startTimer() {
8289
this.interval = setInterval(() => {
83-
this.timer();
90+
this.timer();
8491
}, 1000 );
8592
}
8693

@@ -101,10 +108,24 @@ export class TimeClockComponent implements OnInit {
101108
}
102109

103110
setTimeToInOut() {
104-
this.currentDate = new Date();
105-
this.hour = this.currentDate.getHours();
106-
this.minute = this.currentDate.getMinutes();
107-
this.seconds = this.currentDate.getSeconds();
111+
if ( this.execOnlyOneTimeClockIn === 0 ) {
112+
this.currentDate = new Date();
113+
this.hour = this.currentDate.getHours();
114+
this.minute = this.currentDate.getMinutes();
115+
this.seconds = this.currentDate.getSeconds();
116+
this.execOnlyOneTimeClockIn++;
117+
}
118+
119+
}
120+
121+
setVarToEmpty() {
122+
this.dataTechnology = '';
123+
this.isClockIn = true;
124+
this.isEnterTechnology = false;
125+
this.showAlertEnterTecnology = false;
126+
this.execOnlyOneTimeClockIn = 0;
127+
this.execOnlyOneTimeCounter = 0;
128+
this.isClockInEnable = false;
108129
}
109130

110131
ngOnInit(): void {}

0 commit comments

Comments
 (0)