disabled.php 6.88 KB
<?php

use yii\helpers\Url;
use app\ht\widgets\LinkPager;


$this->title = '品牌管理';
$this->params['breadcrumbs'][] = '设备管理';
$this->params['breadcrumbs'][] = $this->title;


?>



<div class="panel panel-default">
    <div class="panel-body">
        <form action="" method="get" class="filter-form">
            <table width="100%">
                <thead>
                <tr>
                    <th style="width:7%"></th>
                    <th style="width:22%"></th>
                    <th style="width:7%"></th>
                    <th style="width:23%"></th>
                    <th style="width:8%"></th>
                    <th style="width:32%"></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td class="text-right"><b>英文名称:</b</td>
                    <td><input type="text" class="form-control"  id="englishName" name="englishName"  value="<?= $get['englishName'] ?>"> </td>
                    <td class="text-right"><b>中文名称:</b></td>
                    <td>
                        <input type="text" class="form-control"  id="chineseName" name="chineseName"  value="<?= $get['chineseName'] ?>">
                    </td>
                </tr>

                <tr class="search">
                    <td colspan="6"  class="text-center">
                        <button type="submit" class="btn btn-primary" id="search"><i class="glyphicon glyphicon-search"></i> 查 询  </button>
                        <a class="btn btn-default" href="<?=Url::toRoute("/device/brand/enabled")?>">重&nbsp;&nbsp;&nbsp;&nbsp;置</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>
<div class="panel panel-default">
    <div class="panel-heading">
        <a class="btn btn-primary" id="batch-enable">批量启用</a>&nbsp;&nbsp;&nbsp;
        <a href="<?php echo Url::toRoute('/device/brand/create'); ?>" class="btn btn-success pull-right">添加品牌</a>
        <div class="clearfix"></div>
    </div>

    <div  class="panel-body">
        <ul id="countryTab" class="nav nav-tabs" style="margin-bottom: 20px">
            <li ><a href="<?=Url::toRoute("/device/brand/index")?>" >启用的品牌</a></li>
            <li class="active"><a href="<?=Url::toRoute("/device/brand/disabled")?>" >禁用的品牌</a></li>
        </ul>

        <?php if (!empty($brands)) : ?>
            <table class="table table-striped table-bordered"  id="brand-table">
                <thead>
                <tr>
                    <th style="width:5%;" class="text-center align-middle hqy-all-select"><input type="checkbox" class="select-on-check-all" name="selection_all" value="1"></th>
                    <th style="width:15%;">LOGO</th>
                    <th style="width:15%;">英文名称</th>
                    <th style="width:15%;">中文名称</th>
                    <th style="width:10%;">状态</th>
                    <th style="width:10%;">更新时间</th>
                    <th style="width:10%;">创建时间</th>
                    <th style="width:20%;">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($brands as $brand) : ?>
                    <tr>
                        <td class="text-center align-middle hqy-row-select"><input type="checkbox" name="selection[]" value="<?= $brand['id'] ?>"></td>
                        <td ><img src="<?= $brand['logo'] ?>"   height="75" /></td>
                        <td >
                           <?= $brand['english_name'] ?>
                        </td>
                        <td >
                          <?= $brand['chinese_name'] ?>
                        </td>
                        <td >
                         <?php echo $brand['status']  ?>
                        </td>
                        <td ><?php echo $brand['updated_at']  ?></td>
                        <td >
                            <?php echo $brand['created_at']  ?>
                        </td>
                        <td >
                            <a href="<?php echo Url::toRoute(['/device/brand/update', 'id' => $brand['id']])  ?>">编辑</a> &nbsp;|&nbsp;
                            <a href="<?php echo Url::toRoute(['/device/brand/enable', 'id' => $brand['id']])  ?>"><?php echo $brand['enable']  ?></a>&nbsp;|&nbsp;
                            <a  onclick="confirmRedirect('<?php echo Url::toRoute(['/device/brand/delete', 'id' => $brand['id']])  ?>')" title="删除" href="javascript:void(0)">删除</a>

                        </td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>
        <?php else : ?>
            <p class="text-center">
                没有找到数据
            </p>
        <?php endif; ?>
    </div>

    <div class="panel-footer">
        <div class="hqy-panel-pager">
            <?= LinkPager::widget([
                'pagination' => $pages,
            ]); ?>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

<script>
    // 全部选中
    seajs.use("base/1.0.0/unit/utils/utils-1.0.0",function  (a) {
        a.hqySelectRow('brand-table', 'warning');
    })

    //开启
    $("#batch-enable").click(function() {
        var ids = "";
        $("input[name='selection[]']").each(function() {
            if ($(this).prop("checked") == true) {
                var id = $(this).attr("value");
                ids = ids + id + ",";
            }
        });

        if (ids == "") {
            alert('请选择品牌')
            return false;
        }

        var url = "<?php echo Url::toRoute('/device/brand/batch-enable'); ?>?ids=" + ids;
        $('#url3').val(url);//给会话中的隐藏属性URL赋值
        $('#myModal3').modal();
    });

    function batchEnableSubmit(url){
        var url=$.trim($("#url3").val());//获取会话中的隐藏属性URL
        window.location.href=url;

    }


</script>

<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">关闭</button>
                <h4 class="modal-title" id="myModalLabel3">
                    提示
                </h4>
            </div>
            <div class="modal-body">
                确定启用所选品牌吗?
            </div>
            <div class="modal-footer">
                <input type="hidden" id="url3"/>

                <a  onclick="batchEnableSubmit()" class="btn btn-primary" data-dismiss="modal">确定</a>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>