<script>
    function refreshLockAjaxUpdate(resourceType, resourceId = false, timeInterval = false) {
        let interval = timeInterval ? timeInterval * 1000 : parseInt("<?php echo e(config('resource_lock.ajax_refresh_time')); ?>") * 1000;
        resourceId = resourceId ? resourceId : 0;
        setInterval(function () {
            $.ajax({
                url: "<?php echo e(route('refresh_resource_lock')); ?>",
                type: "POST",
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    "resource_type": resourceType,
                    "resource_id": resourceId
                }
            }).done(function (response) {

            }).fail(function () {

            });
        }, interval);

    }

    <?php if(isset($callResourceLockRefresh)): ?>
    $(document).ready(function () {
        // okidanje cim se udje u vest
        $.ajax({
            url: "<?php echo e(route('refresh_resource_lock')); ?>",
            type: "POST",
            data: {
                "_token": "<?php echo e(csrf_token()); ?>",
                "resource_type": "<?php echo e($callResourceLockRefresh['resourceType']); ?>", 
                "resource_id": "<?php echo e($callResourceLockRefresh['resourceId']); ?>"
            }
        }).done(function (response) {

        }).fail(function () {

        });

        // okidanje nakon 15sec
        refreshLockAjaxUpdate("<?php echo e($callResourceLockRefresh['resourceType']); ?>", "<?php echo e($callResourceLockRefresh['resourceId']); ?>");
    });
    <?php endif; ?>
</script><?php /**PATH /opt/cms/resources/views/_layout/partials/refresh_resource_lock.blade.php ENDPATH**/ ?>