﻿<?php
    $canClockIn = ! ($todayHasOpenSession ?? false) && ! ($todayIsWeekoff ?? false);
    $canClockOut = (bool) ($todayHasOpenSession ?? false);
?>
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(!request()->routeIs('dashboard.self')): ?>
<div class="hidden items-center gap-2 lg:flex">
    <div class="inline-flex h-8 items-center rounded-md border border-slate-200 bg-white px-2.5 text-xs font-semibold text-slate-700">
        <i class="bi bi-clock me-1.5 text-slate-500"></i>
        <span id="topbar-live-clock" class="font-mono tabular-nums">--:--:-- --</span>
    </div>
    <div class="topbar-punch shrink-0">
        <?php echo $__env->make('attendance.partials.punch-forms', ['variant' => 'compact', 'prefix' => 'topbar'], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    </div>
</div>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

<?php $__env->startPush('scripts'); ?>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        function updateTopbarClock() {
            var el = document.getElementById('topbar-live-clock');
            if (!el) return;
            var now = new Date();
            var h = now.getHours();
            var m = now.getMinutes();
            var s = now.getSeconds();
            var ampm = h >= 12 ? 'pm' : 'am';
            h = h % 12 || 12;
            el.textContent = (h < 10 ? '0' : '') + h + ':' + (m < 10 ? '0' : '') + m + ':' + (s < 10 ? '0' : '') + s + ' ' + ampm;
        }
        updateTopbarClock();
        setInterval(updateTopbarClock, 1000);
    });
</script>
<?php $__env->stopPush(); ?>
<?php /**PATH /var/www/html/kiyohr/v2_version/resources/views/layouts/partials/topbar-self-attendance.blade.php ENDPATH**/ ?>