%PDF- %PDF-
| Direktori : /www/loslex_o/test/storage/framework/views/ |
| Current File : /www/loslex_o/test/storage/framework/views/c89889d9fd9ec6bbe9e933d2d0cb1e47.php |
<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag; ?>
<?php foreach($attributes->onlyProps(['days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' => 0, 'expires']) as $__key => $__value) {
$$__key = $$__key ?? $__value;
} ?>
<?php $attributes = $attributes->exceptProps(['days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' => 0, 'expires']); ?>
<?php foreach (array_filter((['days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' => 0, 'expires']), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
$$__key = $$__key ?? $__value;
} ?>
<?php $__defined_vars = get_defined_vars(); ?>
<?php foreach ($attributes as $__key => $__value) {
if (array_key_exists($__key, $__defined_vars)) unset($$__key);
} ?>
<?php unset($__defined_vars); ?>
<div
x-data="
{
timer: {
days: '<?php echo e($days); ?>',
hours: '<?php echo e($hours); ?>',
minutes: '<?php echo e($minutes); ?>',
seconds: '<?php echo e($seconds); ?>',
},
startCounter: function () {
let runningCounter = setInterval(() => {
let countDownDate = new Date(<?php echo e($expires->timestamp); ?> * 1000).getTime();
let timeDistance = countDownDate - new Date().getTime();
if (timeDistance < 0) {
clearInterval(runningCounter);
return;
}
this.timer.days = this.formatCounter(Math.floor(timeDistance / (1000 * 60 * 60 * 24)));
this.timer.hours = this.formatCounter(Math.floor((timeDistance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)));
this.timer.minutes = this.formatCounter(Math.floor((timeDistance % (1000 * 60 * 60)) / (1000 * 60)));
this.timer.seconds = this.formatCounter(Math.floor((timeDistance % (1000 * 60)) / 1000));
}, 1000);
},
formatCounter: function (number) {
return number.toString().padStart(2, '0');
}
}
"
x-init="startCounter()"
<?php echo e($attributes); ?>
>
<?php if($slot->isEmpty()): ?>
<span x-text="timer.days"><?php echo e($days); ?></span> :
<span x-text="timer.hours"><?php echo e($hours); ?></span> :
<span x-text="timer.minutes"><?php echo e($minutes); ?></span> :
<span x-text="timer.seconds"><?php echo e($seconds); ?></span>
<?php else: ?>
<?php echo e($slot); ?>
<?php endif; ?>
</div>
<?php /**PATH /www/loslex/test/resources/views/components/countdown.blade.php ENDPATH**/ ?>