[FIX] ATTENDANCE: Attendance check-in label show when time runnner enabled

This commit is contained in:
Horilla
2024-02-07 12:54:24 +05:30
parent f49db947ce
commit 28ab005007

View File

@@ -387,21 +387,30 @@ def clock_out(request):
clock_out_attendance_and_activity( clock_out_attendance_and_activity(
employee=employee, date_today=date_today, now=now, out_datetime=datetime_now employee=employee, date_today=date_today, now=now, out_datetime=datetime_now
) )
script = """ script = ""
<script> hidden_label = ""
$(document).ready(function () {{ time_runner_enabled = timerunner_enabled(request)["enabled_timerunner"]
$('.at-work-seconds').html(secondsToDuration({at_work_seconds_forecasted})) mouse_in = ""
}}); mouse_out = ""
run = 0; if time_runner_enabled:
at_work_seconds = {at_work_seconds_forecasted}; script = """
</script> <script>
""".format( $(document).ready(function () {{
at_work_seconds_forecasted=employee.get_forecasted_at_work()[ $('.at-work-seconds').html(secondsToDuration({at_work_seconds_forecasted}))
"forecasted_at_work_seconds" }});
], run = 0;
) at_work_seconds = {at_work_seconds_forecasted};
mouse_in = """onmouseenter="$(this).find('span').show();$(this).find('.at-work-seconds').hide();""" </script>
mouse_out = """onmouseleave="$(this).find('span').hide();$(this).find('.at-work-seconds').show();" """ """.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( return HttpResponse(
""" """
<button class="oh-btn oh-btn--success-outline mr-2" <button class="oh-btn oh-btn--success-outline mr-2"
@@ -412,13 +421,14 @@ def clock_out(request):
hx-swap='innerHTML'> hx-swap='innerHTML'>
<ion-icon class="oh-navbar__clock-icon mr-2 text-success" <ion-icon class="oh-navbar__clock-icon mr-2 text-success"
name="enter-outline"></ion-icon> 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> <div class="at-work-seconds"></div>
</button> </button>
{script} {script}
""".format( """.format(
check_in=_("Check-In"), check_in=_("Check-In"),
script=script, script=script,
hidden_label=hidden_label,
mouse_in=mouse_in, mouse_in=mouse_in,
mouse_out=mouse_out, mouse_out=mouse_out,
) )