<?php /*a:4:{s:75:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\cms\model\index.html";i:1715617489;s:74:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\default.html";i:1715617489;s:71:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\meta.html";i:1715617489;s:73:"E:\phpstudy_pro\WWW\data\hkcms\template\admin\adminlte\common\script.html";i:1715617489;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta name="csrf-token" content="<?php echo token(); ?>">

    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="never">
<meta name="renderer" content="webkit">
<title><?php echo $site['title']; ?> - <?php echo lang("Backstage panel"); ?></title>

<link rel="Shortcut Icon" href="<?php echo $site['favicon']; ?>?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>" type="image/x-icon" />

<!-- Font Awesome 5.13.0 字体图标库 -->
<link rel="stylesheet" href="/static/libs/fontawesome-free/css/all.min.css">
<!-- AdminLTE v3.2.0 | Bootstrap v4.6.0 CSS框架 -->
<link rel="stylesheet" href="/static/module/admin/adminlte/css/adminlte.css?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>">
<link rel="stylesheet" href="/static/module/admin/adminlte/css/common.css?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>">

<script type="text/javascript">
    window.Config = <?php echo json_encode($site); ?>;
    window.Lang = <?php echo json_encode($tempLang); ?>;
    window.Tpl = <?php echo json_encode($Tpl); ?>;
</script>

    <style>
        html,body,.wrapper {
            height: 100% !important;
        }
        .content {
            min-height: 100%;
            height: auto;
            padding-bottom: 20px;
            background-color: #f2f3f5;
        }
        .operatePage .card-footer {
            width: 100%;
            position: fixed;
            bottom: 0;
            z-index: 99;
        }
    </style>

    {__STYLE__}

</head>
<body class="sidebar-mini layout-top-nav overlayScrollbars" >

    <?php if(empty($popup)): ?>
    <!-- 子页 -->
    <div class="wrapper">
        <div class="content">
            <div class="container-fluid" style="padding-top: 16px">
                <style>
    .diy-menu {
        width: auto;
    }
</style>
<div class="card card-primary">
    <div class="card-body">
        <!--筛选-->
        <div class="filter-panel d-none">
            <form action="" method="get" class="frm-filter">
                <div class="row">
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label">ID</label>
                            <input type="text" class="form-control" name="id" placeholder="ID">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang("Model name"); ?></label>
                            <input type="text" class="form-control" name="name" placeholder="<?php echo lang("Model name"); ?>" data-op="like %...%">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang("Table Name"); ?></label>
                            <input type="text" class="form-control" name="tablename" placeholder="<?php echo lang("Table Name"); ?>" data-op="like %...%">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <input type="submit" class="btn btn-primary mr-2" value="<?php echo lang('Search'); ?>">
                            <input type="reset" class="btn btn-default" value="<?php echo lang('Reset'); ?>">
                        </div>
                    </div>
                </div>
            </form>
            <hr>
        </div>

        <div id="toolbar" class="toolbar">
            <?php echo build_toolbar('refresh,add'); if((has_rule('cms/model/import'))): ?>
            <button type="button" class="btn btn-default btn-import" data-url="<?php echo url('/cms.model/import'); ?>"><i class="fas fa-download"></i>
                <?php echo lang('Import'); ?></button>
            <?php endif; ?>

            <div class="dropdown btn-toggle" data-toggle="tooltip" data-placement="right" data-title="点击表格行进行批量操作">
                <a class="btn btn-secondary dropdown-toggle btn-disabled disabled" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="<?php echo lang('Batch operation'); ?>"><i class="fas fa-cog"></i> <?php echo lang('More'); ?></a>
                <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
                    <?php if((has_rule('cms/model/del'))): ?>
                    <a class="dropdown-item btn-del" href="#" data-url="<?php echo url('/cms.model/del'); ?>"><i class="fas fa-trash-alt"></i> <?php echo lang('Batch delete'); ?></a>
                    <?php endif; if((has_rule('batches'))): ?>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item status" href="#" data-params="status=normal"><i class="fas fa-check-circle"></i> <?php echo lang('Set to enable'); ?></a>
                    <a class="dropdown-item status" href="#" data-params="status=hidden"><i class="fas fa-ban"></i> <?php echo lang('Set to disabled'); ?></a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
        <table id="table"
               data-edit="<?php if(has_rule('edit')): ?><?php echo url('/cms.model/edit'); ?><?php endif; ?>"
               data-del="<?php if(has_rule('del')): ?><?php echo url('/cms.model/del'); ?><?php endif; ?>"
               data-batches="<?php if((has_rule('batches'))): ?><?php echo url('/cms.model/batches'); ?><?php endif; ?>"
        ></table>
    </div>
</div>

{block:script}
<script>
    require(['admin','table'], function (admin, Table) {
        var configCon = <?php echo $con; ?>;
        $(function () {
            Table.init({
                url: "<?php echo url('/cms.Model/index'); ?>",
                customFilter: true,
                sortName: 'id',
                sortOrder: 'asc',
                classes: 'table table-bordered table-hover',
                formatSearch: function (e) {
                    return "模型名称";
                },
                columns: [{
                    field: 'state',
                    checkbox: true,
                },{
                    field: 'id',
                    title: 'ID'
                },{
                    field: 'name',
                    title: '<?php echo lang("Model name"); ?>',
                },{
                    field: 'alias',
                    title: '<?php echo lang("Model alias"); ?>',
                },{
                    field: 'tablename',
                    title: '<?php echo lang("Table Name"); ?>',
                },{
                    field: 'diyname',
                    title: '<?php echo lang("Custom URL"); ?>',
                    visible: false
                },{
                    field: 'controller',
                    title: '<?php echo lang("Controller"); ?>',
                    visible: false
                },{
                    field: 'remark',
                    title: '<?php echo lang("Remark"); ?>',
                    textLength: 20,
                    formatter: Table.formatter.textBox,
                    events: Table.events.textBoxBtn
                },{
                    field: 'is_search',
                    title: '<?php echo lang("Global search"); ?>',
                    formatter: function (value, row, index, field) {
                        if (value==-1) {
                            return '-';
                        }
                        return Table.formatter.switchBtn.call(this, value, row, index,field);
                    },
                    events: Table.events.switchBtn
                },{
                    field: 'status',
                    title: '<?php echo lang("Status"); ?>',
                    formatter: Table.formatter.switchBtn,
                    events: Table.events.switchBtn
                },{
                    field: 'create_time',
                    title: '<?php echo lang("Create time"); ?>',
                    visible: false
                },{
                    field: 'update_time',
                    title: '<?php echo lang("Update time"); ?>',
                    visible: false
                },{
                    field: 'operate',
                    title: '<?php echo lang("Operate"); ?>',
                    delTips: '<?php echo lang("Confirm deletion? Pack column and document data"); ?>',
                    formatter: function (value, row, index) {

                        let html = '';

                        html = '<div class="btn-group mr-2">\n' +

                                /* <?php if(has_rule('cms/modelfield/index')): ?> */
                            '    <button type="button" class="btn btn-default btn-xs btn-newMenu" data-title="'+row['name']+'字段" data-url="<?php echo url("/cms.ModelField/index"); ?>?model_id='+row['id']+'"><?php echo lang("Field"); ?></button>\n' +
                                /* <?php endif; ?> */

                            '<button type="button" class="btn btn-default btn-xs" title="更多操作" data-toggle="dropdown" aria-expanded="false" data-reference="parent"><i class="fas fa-ellipsis-h"></i></button>\n' +
                            '<div class="dropdown-menu dropdown-menu-right diy-menu">\n';

                        if (configCon[row['controller']]) {
                            html += '<a class="dropdown-item btn-config" href="<?php echo url("/cms.model/config"); ?>?id='+row['id']+'" data-title="'+row['name']+'"><i class="fas fa-cog"></i> <?php echo lang("Config"); ?></a>'
                        }

                        html += '<a href="<?php echo url("/cms.model/preview"); ?>?model_id='+row['id']+'" target="_blank" class="dropdown-item"><i class="fa fa-eye"></i> <?php echo lang('Preview'); ?></a>';

                        /* <?php if(has_rule('cms/model/export')): ?> */
                        html += '<a href="<?php echo url("/cms.model/export"); ?>?id='+row['id']+'" target="_blank" class="dropdown-item"><i class="fas fa-upload"></i> <?php echo lang("Export"); ?></a>'
                        /* <?php endif; ?> */

                        /* <?php if(has_rule('cms/model/copy')): ?> */
                        html += '<a href="<?php echo url("/cms.model/copy"); ?>?id='+row['id']+'" data-title="'+row['name']+'" class="dropdown-item btn-copy"><i class="fas fa-copy"></i> <?php echo lang("Copy"); ?></a>'
                        /* <?php endif; ?> */


                        html += '</div></div>';
                        return html+Table.formatter.operate.call(this, value, row, index);
                    },
                    events: Table.events.operate
                }]
            });

            // 导入
            $('.btn-import').click(function (e) {
                var data = $(this).data();
                hkcms.api.open(Util.setUrlParams({ url:data.url, query:{popup:1 }}),'<?php echo lang('Import'); ?>')
            });
            // 复制
            $(document).on('click','.btn-copy',function (e) {
                var href = $(this).attr('href');
                var title = $(this).attr('data-title');
                hkcms.api.open(Util.setUrlParams({ url:href, query:{popup:1 }}),'<?php echo lang('Copy'); ?> '+title);
                e.preventDefault();
                return false;
            });
            // 配置
            $(document).on('click','.btn-config',function (e) {
                var href = $(this).attr('href');
                var title = $(this).attr('data-title');
                hkcms.api.open(Util.setUrlParams({ url:href, query:{popup:1 }}),'<?php echo lang('Config'); ?> '+title);
                e.preventDefault();
                return false;
            });
        })
    })
</script>
{/block:script}
            </div>
        </div>
    </div>

    <?php else: ?>
    <div class="operatePage">
        <style>
    .diy-menu {
        width: auto;
    }
</style>
<div class="card card-primary">
    <div class="card-body">
        <!--筛选-->
        <div class="filter-panel d-none">
            <form action="" method="get" class="frm-filter">
                <div class="row">
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label">ID</label>
                            <input type="text" class="form-control" name="id" placeholder="ID">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang("Model name"); ?></label>
                            <input type="text" class="form-control" name="name" placeholder="<?php echo lang("Model name"); ?>" data-op="like %...%">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <label class="row-form-label"><?php echo lang("Table Name"); ?></label>
                            <input type="text" class="form-control" name="tablename" placeholder="<?php echo lang("Table Name"); ?>" data-op="like %...%">
                        </div>
                    </div>
                    <div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-xs-12">
                        <div class="form-group">
                            <input type="submit" class="btn btn-primary mr-2" value="<?php echo lang('Search'); ?>">
                            <input type="reset" class="btn btn-default" value="<?php echo lang('Reset'); ?>">
                        </div>
                    </div>
                </div>
            </form>
            <hr>
        </div>

        <div id="toolbar" class="toolbar">
            <?php echo build_toolbar('refresh,add'); if((has_rule('cms/model/import'))): ?>
            <button type="button" class="btn btn-default btn-import" data-url="<?php echo url('/cms.model/import'); ?>"><i class="fas fa-download"></i>
                <?php echo lang('Import'); ?></button>
            <?php endif; ?>

            <div class="dropdown btn-toggle" data-toggle="tooltip" data-placement="right" data-title="点击表格行进行批量操作">
                <a class="btn btn-secondary dropdown-toggle btn-disabled disabled" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="<?php echo lang('Batch operation'); ?>"><i class="fas fa-cog"></i> <?php echo lang('More'); ?></a>
                <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
                    <?php if((has_rule('cms/model/del'))): ?>
                    <a class="dropdown-item btn-del" href="#" data-url="<?php echo url('/cms.model/del'); ?>"><i class="fas fa-trash-alt"></i> <?php echo lang('Batch delete'); ?></a>
                    <?php endif; if((has_rule('batches'))): ?>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item status" href="#" data-params="status=normal"><i class="fas fa-check-circle"></i> <?php echo lang('Set to enable'); ?></a>
                    <a class="dropdown-item status" href="#" data-params="status=hidden"><i class="fas fa-ban"></i> <?php echo lang('Set to disabled'); ?></a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
        <table id="table"
               data-edit="<?php if(has_rule('edit')): ?><?php echo url('/cms.model/edit'); ?><?php endif; ?>"
               data-del="<?php if(has_rule('del')): ?><?php echo url('/cms.model/del'); ?><?php endif; ?>"
               data-batches="<?php if((has_rule('batches'))): ?><?php echo url('/cms.model/batches'); ?><?php endif; ?>"
        ></table>
    </div>
</div>

{block:script}
<script>
    require(['admin','table'], function (admin, Table) {
        var configCon = <?php echo $con; ?>;
        $(function () {
            Table.init({
                url: "<?php echo url('/cms.Model/index'); ?>",
                customFilter: true,
                sortName: 'id',
                sortOrder: 'asc',
                classes: 'table table-bordered table-hover',
                formatSearch: function (e) {
                    return "模型名称";
                },
                columns: [{
                    field: 'state',
                    checkbox: true,
                },{
                    field: 'id',
                    title: 'ID'
                },{
                    field: 'name',
                    title: '<?php echo lang("Model name"); ?>',
                },{
                    field: 'alias',
                    title: '<?php echo lang("Model alias"); ?>',
                },{
                    field: 'tablename',
                    title: '<?php echo lang("Table Name"); ?>',
                },{
                    field: 'diyname',
                    title: '<?php echo lang("Custom URL"); ?>',
                    visible: false
                },{
                    field: 'controller',
                    title: '<?php echo lang("Controller"); ?>',
                    visible: false
                },{
                    field: 'remark',
                    title: '<?php echo lang("Remark"); ?>',
                    textLength: 20,
                    formatter: Table.formatter.textBox,
                    events: Table.events.textBoxBtn
                },{
                    field: 'is_search',
                    title: '<?php echo lang("Global search"); ?>',
                    formatter: function (value, row, index, field) {
                        if (value==-1) {
                            return '-';
                        }
                        return Table.formatter.switchBtn.call(this, value, row, index,field);
                    },
                    events: Table.events.switchBtn
                },{
                    field: 'status',
                    title: '<?php echo lang("Status"); ?>',
                    formatter: Table.formatter.switchBtn,
                    events: Table.events.switchBtn
                },{
                    field: 'create_time',
                    title: '<?php echo lang("Create time"); ?>',
                    visible: false
                },{
                    field: 'update_time',
                    title: '<?php echo lang("Update time"); ?>',
                    visible: false
                },{
                    field: 'operate',
                    title: '<?php echo lang("Operate"); ?>',
                    delTips: '<?php echo lang("Confirm deletion? Pack column and document data"); ?>',
                    formatter: function (value, row, index) {

                        let html = '';

                        html = '<div class="btn-group mr-2">\n' +

                                /* <?php if(has_rule('cms/modelfield/index')): ?> */
                            '    <button type="button" class="btn btn-default btn-xs btn-newMenu" data-title="'+row['name']+'字段" data-url="<?php echo url("/cms.ModelField/index"); ?>?model_id='+row['id']+'"><?php echo lang("Field"); ?></button>\n' +
                                /* <?php endif; ?> */

                            '<button type="button" class="btn btn-default btn-xs" title="更多操作" data-toggle="dropdown" aria-expanded="false" data-reference="parent"><i class="fas fa-ellipsis-h"></i></button>\n' +
                            '<div class="dropdown-menu dropdown-menu-right diy-menu">\n';

                        if (configCon[row['controller']]) {
                            html += '<a class="dropdown-item btn-config" href="<?php echo url("/cms.model/config"); ?>?id='+row['id']+'" data-title="'+row['name']+'"><i class="fas fa-cog"></i> <?php echo lang("Config"); ?></a>'
                        }

                        html += '<a href="<?php echo url("/cms.model/preview"); ?>?model_id='+row['id']+'" target="_blank" class="dropdown-item"><i class="fa fa-eye"></i> <?php echo lang('Preview'); ?></a>';

                        /* <?php if(has_rule('cms/model/export')): ?> */
                        html += '<a href="<?php echo url("/cms.model/export"); ?>?id='+row['id']+'" target="_blank" class="dropdown-item"><i class="fas fa-upload"></i> <?php echo lang("Export"); ?></a>'
                        /* <?php endif; ?> */

                        /* <?php if(has_rule('cms/model/copy')): ?> */
                        html += '<a href="<?php echo url("/cms.model/copy"); ?>?id='+row['id']+'" data-title="'+row['name']+'" class="dropdown-item btn-copy"><i class="fas fa-copy"></i> <?php echo lang("Copy"); ?></a>'
                        /* <?php endif; ?> */


                        html += '</div></div>';
                        return html+Table.formatter.operate.call(this, value, row, index);
                    },
                    events: Table.events.operate
                }]
            });

            // 导入
            $('.btn-import').click(function (e) {
                var data = $(this).data();
                hkcms.api.open(Util.setUrlParams({ url:data.url, query:{popup:1 }}),'<?php echo lang('Import'); ?>')
            });
            // 复制
            $(document).on('click','.btn-copy',function (e) {
                var href = $(this).attr('href');
                var title = $(this).attr('data-title');
                hkcms.api.open(Util.setUrlParams({ url:href, query:{popup:1 }}),'<?php echo lang('Copy'); ?> '+title);
                e.preventDefault();
                return false;
            });
            // 配置
            $(document).on('click','.btn-config',function (e) {
                var href = $(this).attr('href');
                var title = $(this).attr('data-title');
                hkcms.api.open(Util.setUrlParams({ url:href, query:{popup:1 }}),'<?php echo lang('Config'); ?> '+title);
                e.preventDefault();
                return false;
            });
        })
    })
</script>
{/block:script}
    </div>
    <?php endif; ?>

    <script src="/static/libs/require/require.js"></script>
<script src="/static/module/admin/adminlte/js/main.js?v=<?php echo env('APP_DEBUG')?time():$site['version']; ?>"></script>

<!-- // 加载插件JS-->
<?php echo load_js(); ?>



    {__SCRIPT__}
    
</body>
</html>