HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/erp.nhatnamsst.com/storage/framework/views/976caee0647df2958e4b70a82e28a16c.php
<?php $__env->startSection('title', trans('Hãng')); ?>

<?php $__env->startSection('datatable'); ?>
    <?php
        $currentAdmin = get_auth_admin();
        $canCreate = $currentAdmin && (
            $currentAdmin->checkIsSuperAdmin() || 
            ($currentAdmin->role && in_array($currentAdmin->role, [
                \Domains\Core\Enums\AdminRole::ADMIN,
                \Domains\Core\Enums\AdminRole::SALE,
                \Domains\Core\Enums\AdminRole::LEADER_SALE
            ]))
        );
    ?>
    
    <div class="mb-3">
        <div class="d-flex justify-content-between align-items-center mb-2">
            <div class="d-flex align-items-center gap-2">
                <button type="button" class="btn small btn-primary" id="btn-toggle-search">
                    <i class="ti ti-search"></i> Tìm kiếm
                </button>
            </div>
            <div class="d-flex align-items-center gap-2">
                <?php if($canCreate): ?>
                    <a href="<?php echo e(route('cms.brand.create')); ?>" class="btn small btn-primary">
                        <i class="ti ti-plus"></i> Nhập HÃNG
                    </a>
                <?php endif; ?>
            </div>
        </div>
        
        <div id="filter-form" style="display: none; background: white; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label for="filter_name" class="form-label">Tên hãng:</label>
                    <input type="text" class="form-control" id="filter_name" name="filter_name" placeholder="Nhập tên hãng...">
                </div>
            </div>
            <div class="row">
                <div class="col-12">
                    <button type="button" class="btn small btn-primary" id="btn-search">
                        <i class="ti ti-search"></i> Tìm
                    </button>
                    <button type="button" class="btn small btn-secondary" id="btn-clear-search">
                        <i class="ti ti-x"></i> Xóa tìm
                    </button>
                </div>
            </div>
        </div>
    </div>
    
    <div class="table-responsive position-relative">
        
        <?php echo $dataTable->table(['class' => 'table table-bordered'], true); ?>

    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
<script>
$(document).ready(function() {
    var tableId = '<?php echo e($dataTable->getTableAttribute('id')); ?>';
    var datatable = window.LaravelDataTables[tableId];
    var originalUrl = datatable.ajax.url();
    
    // Toggle filter form
    $('#btn-toggle-search').on('click', function() {
        $('#filter-form').slideToggle();
    });
    
    // Search button
    $('#btn-search').on('click', function() {
        var name = $('#filter_name').val();
        
        var params = [];
        if (name) params.push('filter_name=' + encodeURIComponent(name));
        
        var newUrl = originalUrl;
        if (params.length > 0) {
            var separator = originalUrl.indexOf('?') > -1 ? '&' : '?';
            newUrl = originalUrl.split('?')[0] + separator + params.join('&');
        } else {
            newUrl = originalUrl.split('?')[0];
        }
        
        datatable.ajax.url(newUrl).load();
    });
    
    // Clear search button
    $('#btn-clear-search').on('click', function() {
        $('#filter_name').val('');
        datatable.ajax.url(originalUrl.split('?')[0]).load();
    });
});
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('cms.layouts.datatable', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /www/wwwroot/erp.nhatnamsst.com/resources/views/cms/brands/index.blade.php ENDPATH**/ ?>