[FIX] ATTENDANCE: Attendance check-in label show when time runnner enabled
This commit is contained in:
@@ -387,21 +387,30 @@ def clock_out(request):
|
||||
clock_out_attendance_and_activity(
|
||||
employee=employee, date_today=date_today, now=now, out_datetime=datetime_now
|
||||
)
|
||||
script = """
|
||||
<script>
|
||||
$(document).ready(function () {{
|
||||
$('.at-work-seconds').html(secondsToDuration({at_work_seconds_forecasted}))
|
||||
}});
|
||||
run = 0;
|
||||
at_work_seconds = {at_work_seconds_forecasted};
|
||||
</script>
|
||||
""".format(
|
||||
at_work_seconds_forecasted=employee.get_forecasted_at_work()[
|
||||
"forecasted_at_work_seconds"
|
||||
],
|
||||
)
|
||||
mouse_in = """onmouseenter="$(this).find('span').show();$(this).find('.at-work-seconds').hide();"""
|
||||
mouse_out = """onmouseleave="$(this).find('span').hide();$(this).find('.at-work-seconds').show();" """
|
||||
script = ""
|
||||
hidden_label = ""
|
||||
time_runner_enabled = timerunner_enabled(request)["enabled_timerunner"]
|
||||
mouse_in = ""
|
||||
mouse_out = ""
|
||||
if time_runner_enabled:
|
||||
script = """
|
||||
<script>
|
||||
$(document).ready(function () {{
|
||||
$('.at-work-seconds').html(secondsToDuration({at_work_seconds_forecasted}))
|
||||
}});
|
||||
run = 0;
|
||||
at_work_seconds = {at_work_seconds_forecasted};
|
||||
</script>
|
||||
""".format(
|
||||
at_work_seconds_forecasted=employee.get_forecasted_at_work()[
|
||||
"forecasted_at_work_seconds"
|
||||
],
|
||||
)
|
||||
hidden_label = """
|
||||
style="display:none"
|
||||
"""
|
||||
mouse_in = """ onmouseenter="$(this).find('div.at-work-seconds').hide();$(this).find('span').show();" """
|
||||
mouse_out = """onmouseleave="$(this).find('div.at-work-seconds').show();$(this).find('span').hide();" """
|
||||
return HttpResponse(
|
||||
"""
|
||||
<button class="oh-btn oh-btn--success-outline mr-2"
|
||||
@@ -412,13 +421,14 @@ def clock_out(request):
|
||||
hx-swap='innerHTML'>
|
||||
<ion-icon class="oh-navbar__clock-icon mr-2 text-success"
|
||||
name="enter-outline"></ion-icon>
|
||||
<span class="hr-check-in-out-text">{check_in}</span>
|
||||
<span class="hr-check-in-out-text" {hidden_label} >{check_in}</span>
|
||||
<div class="at-work-seconds"></div>
|
||||
</button>
|
||||
{script}
|
||||
""".format(
|
||||
check_in=_("Check-In"),
|
||||
script=script,
|
||||
hidden_label=hidden_label,
|
||||
mouse_in=mouse_in,
|
||||
mouse_out=mouse_out,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user