<?php /* /www/wwwroot/default/jian/resources/views/Admin/shalong-list.blade.php */ ?>
<?php $__env->startSection('admin'); ?>

<div class="content-wrapper" style="min-height: 810px;">
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h4>沙龙列表</h4>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/admin/index">首页</a></li>
              <li class="breadcrumb-item active">沙龙管理</li>
              <li class="breadcrumb-item active">沙龙列表</li>
            </ol>
          </div>
        </div>
      </div>
    </section>
    <div class="col-xs-3">
        <button class="btn btn-primary add" style="margin-left:17px;margin-bottom:15px">添加沙龙 +</button>
    </div>
        <div class="form-group col-md-12">
            <label for="name" class="col-sm-2 control-label"> 选择门店</label>
                <div class="col-sm-3">
                    <select class="form-control" id="md">
                        <?php $__currentLoopData = $md; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($val -> id); ?>" <?php if($md_id == $val -> id): ?> selected <?php endif; ?>> <?php echo e($val -> md_name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
        </div>
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-12">

            <div class="card">
              <div class="card-body p-0">
                <table class="table table-condensed">
                  <tbody>
               
                  <tr style="text-align:center">
                    <th>沙龙名称</th>
                    <th>状态</th>
                    <th>报名情况</th> 
                    <th>上下架</th>
                    <th>置顶</th>
                    <th style="width: 100px">操作</th>
                  </tr>
                  <?php $__currentLoopData = $shalong; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr style="text-align:center">
                    <td><?php echo e($val['title']); ?></td>
                    <!-- 此处是沙龙的报名状态 -->
                    <td><?php echo e($val['level']); ?></td>
                    <td><a href="javascript:void(0);" onclick="look(<?php echo e($val['id']); ?>)"><?php echo e($val['person_num']); ?></a></td>
                    <td>
                        <?php if($val['status'] == 1): ?>
                        <a href="javascript:void(0)" onclick="status(<?php echo e($val['id']); ?>)"><span class="badge bg-success">上架中</span></a>
                        <?php else: ?>
                        <a href="javascript:void(0)" onclick="status(<?php echo e($val['id']); ?>)"><span class="badge bg-danger">下架中</span></a>
                        <?php endif; ?>
                    </td>
                    <td>
                        <?php if($val['orders'] < 0): ?>
                        <a href="javascript:void(0)" onclick="tops(<?php echo e($val['id']); ?>)"><span class="badge bg-success">已置顶</span></a>
                        <?php else: ?>
                        <a href="javascript:void(0)" onclick="tops(<?php echo e($val['id']); ?>)"><span class="badge bg-danger">未置顶</span></a>
                        <?php endif; ?>
                    </td>
                    <td>
                        <a href="javascript:void(0)" onclick="edit(<?php echo e($val['id']); ?>)"><i class="fa fa-edit" style="font-size: 16px;" title="编辑"></i></a>
                        <a href="javascript:void(0)" onclick="del(<?php echo e($val['id']); ?>)"><i class="fa fa-trash" style="font-size: 16px;" title="删除"></i></a>
                    </td>
                  </tr>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody></table>
              </div>
            </div>
          </div>
        </div>
    </section>
  </div>
<script src="/admin/plugins/jquery/jquery.min.js"></script>
<script src="/admin/layer-v3.1.1/layer/layer.js"></script>
<script>
   $('.add').click(function(){
       window.location.href="/admin/shalong/add";
   })
    $('#md').change(function(){
        var id = $('#md option:selected').val();
        window.location.href="/admin/shalong/list?md="+id;
    })
   function del(id)
    {
        if(!id) {
            layer.msg('参数不全');
            return false;
        }
        layer.confirm('确认删除该文章吗？', {
            btn: ['确认','取消'] //按钮
            }, function(){
                $.get('/admin/shalong/delete',{id:id},function(res){
                    if(res.code == '1000'){
                        layer.msg(res.msg);
                        window.location.reload();
                    }else{
                        layer.msg(res.msg);
                    }
                })
        });
    }
    function status(id)
    {
        if(!id){
            layer.alert('参数错误');
            return false;
        }
        layer.confirm('确认操作吗？', {
            btn: ['确认','取消'] //按钮
            }, function(){
                $.get('/admin/shalong/status',{id:id},function(res){
                    if(res.code == '1000'){
                        layer.msg(res.msg);
                        window.location.reload();
                    }else{
                        layer.msg(res.msg);
                    }
                })
        });  
    }
    // 人工置顶
    function tops(id)
    {
        if(!id){
            layer.alert('参数错误');
            return false;
        }
        layer.confirm('确认操作吗？', {
            btn: ['确认','取消'] //按钮
            }, function(){
                $.get('/admin/shalong/top',{id:id},function(res){
                    if(res.code == '1000'){
                        layer.msg(res.msg);
                        window.location.reload();
                    }else{
                        layer.msg(res.msg);
                    }
                })
        });  
    }
    function edit(id)
    {
      if(!id){
        layer.alert('参数错误');
        return false;
      }
      window.location.href="/admin/shalong/edit/"+ id;
    }
    //查看报名详情
    function look(id)
    {
      if(!id) {
        layer.alert('参数错误');
        return false;
      }
      window.location.href="/admin/shalong/lookPerson/"+ id;
    }
</script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('title','沙龙列表'); ?>
<?php $__env->startSection('sl','menu-open'); ?>
<?php $__env->startSection('sl2','active'); ?>
<?php $__env->startSection('all-sl','active'); ?>
<?php echo $__env->make('Public.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>