<%@ page import="org.springframework.ui.ModelMap" %><%--
  Created by IntelliJ IDEA.
  User: ZJW
  Date: 2019/4/11
  Time: 23:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理員-用户后台</title>
    <link type="text/css" rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="shortcut icon" href="http://dsada1.oss-cn-beijing.aliyuncs.com/img/xicon.png" type="image/x-icon">
    <script src="bootstrap/js/jquery-3.3.1.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <style type="text/css">
        .Att{
            font-size: 10px;
        }
    </style>
    <script type="text/javascript">
        // function playMusic(thisId){
        //     var audio = document.getElementById("music");
        //     audio.src ="http://music.163.com/song/media/outer/url?id="+thisId+".mp3";
        //     console.log(thisId + " " + audio.src);
        //     audio.load();
        //     audio.play();
        // }
        function delThisIndent(adminListPersonCode,id) {
            $.ajax({
                url:"delThisIndent.action",
                type:"post",
                data:{"id":id,"adminListPersonCode":adminListPersonCode},
                dataType:"json",
                success:function(data){
                    if (data!=1 ) {  //failed
                        alert("Sorry,Processed Failed")
                        // $("#userSpan").val('');
                    }else {             //successed
                        location.reload();
                        alert("successed!");
                    }

                }
            });
        }

        }


    </script>
</head>
<body>

<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <nav class="navbar navbar-default" role="navigation">
                <div class="navbar-header">
                    <a href="homepage.html" class="navbar-brand">
                        <span class="text-warning">MusicOL©--24®</span>
                    </a>
                </div>

                <div class="collaspe navbar-collapse" id="bs-example-navbar-collaspe-1">
                    <ul class="nav navbar-nav">
                        <li><a href="user.action">用户管理</a></li>
                        <li><a href="indent.action">订单管理</a></li>
                        <%--<li class="active"><a href="admin_list_food.html">菜品管理</a></li>--%>
                        <li><a href="StationAnalysis.action">站长统计</a></li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" data-toggle="dropdown" class="dpanel-bodyropdown-toggle">
                                <span class="glyphicon glyphicon-user"></span>&nbsp;${adminName}
                                <strong class="caret"></strong>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="logOut.action">退出登錄</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    </div><!--ending 1st row-->
    <div class="row">
        <div class="col-md-12">
            <div class="panel-info">
                <div class="panel-heading">
                    <form action="" class="form-inline" role="search">
                        <div class="form-group">
                            <h3> &nbsp;用户管理</h3>
                        </div>
                        &nbsp;&nbsp;&nbsp;
                        <div class="form-group">

                            <input type="text" class="form-control" name="s_fn" placeholder="按用户ID查詢" />
                        </div>
                        <%--<div class="form-group">--%>
                            <%--<select name="s_type" class="form-control">--%>
                                <%--<option value="">所有分類</option>--%>
                                <%--<option>家常</option>--%>
                                <%--<option>涼菜</option>--%>
                                <%--<option>主食</option>--%>
                                <%--<option>甜品</option>--%>
                            <%--</select>--%>
                        <%--</div>--%>
                        <div class="form-group">
                            <button type="submit" class="btn btn-sm btn-info" data-toggle="tooltip" title="搜索菜品">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </button>

                        </div>
                        <div class="form-group">  <p class="Att"><br> &nbsp;&nbsp;&nbsp;&nbsp;用户状态：1--Normal  2--Stoped  0--Canceled</p></div>
                        <div class="form-group pull-right">
                            <a href="#" data-target="#modal-add" data-toggle="modal" role="button" title="添加订单" class="btn btn-sm btn-success">
                                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>&nbsp;添加订单
                            </a>
                        </div>
                    </form>
                </div>
                <div class="panel-body">
                    <table class="table table-striped table-hover table-condensed">
                        <thead>
                        <tr>
                            <th>用户ID</th>
                            <th>用户名</th>
                            <th>用户密码</th>
                            <th>用户等级</th>
                            <th>Listened</th>
                            <th>用户状态</th>
                            <th>备注</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${AllUsers}" var="AllUsers">
                        <tr>
                            <th>${AllUsers.personCode}</th>
                            <td>${AllUsers.username}</td>
                            <td>${AllUsers.password}</td>
                            <td>${AllUsers.personLevel}</td>
                            <td>${AllUsers.personListened}</td>

                            <td></td>
                            <td></td>
                            <td>
                                <a href="admin_list_food.html" data-target="#modal-revise" class="btn btn-xs btn-warning" data-toggle="modal" title="修改菜品" role="button">
                                    <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
                                </a>
                                <button type="button" class="btn-danger" data-toggle="modal" data-target="#delConfirmModal" data-toggle="tooltip" title="刪除菜品" >
                                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                                </button>
                            </td>
                        </tr>
                            <!--刪除確認框-->
                            <div class="modal fade" id="delConfirmModal">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                                                <span aria-hidden="true">&times;</span>
                                            </button>
                                            <h4 class="modal-title">刪除確認</h4>
                                        </div>
                                        <div class="modal-body">
                                            <h4 class="text-danger">確定要刪除該菜品嗎？</h4>
                                        </div>
                                        <div class="modal-footer">
                                            <button class="btn btn-primary" onclick="delThisIndent(${AllIndentList.adminListPersonCode},${AllIndentList.id})">刪除</button>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </c:forEach>
                        </tbody>
                    </table>
                    <nav class="pull-right">
                        <ul class="pagination">
                            <li>
                                <a href="#" aria-label="Previous"><span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li>
                                <a href="#" aria-label="Next"><span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</div>
<!--添加菜品-->
<div class="modal fade" id="modal-add" role="dialog" tabindex="-1" aria-hidden="true" aria-labelledby="myModalLable">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h3 class="modal-title  text-center text-primary" id="myModalLable">添加菜品</h3>
            </div>
            <form role="form" method="post" class="form-horizontal">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="courseName " class="col-sm-4 control-lable">菜品名称</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="courseName" name="cn" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="special" class="col-sm-4 control-lable">菜品特色</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="special" name="spc" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="mainMaterial" class="col-sm-4 control-lable">主要原料</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="mainMaterial" name="mm" required>
                        </div>
                    </div>
                    <div>
                        <form role="form">
                            <div class="form-group">
                                <label label for="typeSelect" class="col-sm-4 control-lable">所属分类</label>
                                <div class="col-sm-6">
                                    <select class="form-control">
                                        <option>家常</option>
                                        <option>凉菜</option>
                                        <option>主食</option>
                                    </select>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="form-group">
                        <label for="coursePrice" class="col-sm-4 control-lable">菜品价格</label>
                        <div class="col-sm-6">
                            <input type="number" class="form-control" id="coursePrice" name="cp" required> &nbsp;单位:￥
                        </div>
                    </div>
                    <div>
                        <div class="form-group">
                            <label for="inputfile" class="col-sm-4 control-lable">菜品照片</label>
                            <div class="col-sm-6">
                                <input type="file" id="inputfile">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="courseRemark" class="col-sm-4 control-lable">菜品备注</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="courseRemark" name="cr" required>
                            <p>-1:代表正常菜,0:代表厨师推荐。</p>
                            <p>正常数代表特价菜价格</p>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <center><button type="submit" class="btn btn-primary">确认添加</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">放弃返回</button></center>
                </div>
            </form>
        </div>
    </div>
</div>
<!--修改菜品页面-->
<div class="modal fade" id="modal-revise" role="dialog" tabindex="-1" aria-hidden="true" aria-labelledby="myModalLable">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h3 class="modal-title  text-center text-primary" id="myModalLable">添加菜品</h3>
            </div>
            <form role="form" method="post" class="form-horizontal">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="courseName " class="col-sm-4 control-lable">菜品名称</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="courseName" name="cn" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="special" class="col-sm-4 control-lable">菜品特色</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="special" name="spc" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="mainMaterial" class="col-sm-4 control-lable">主要原料</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="mainMaterial" name="mm" required>
                        </div>
                    </div>
                    <div>
                        <form role="form">
                            <div class="form-group">
                                <label label for="typeSelect" class="col-sm-4 control-lable">所属分类</label>
                                <div class="col-sm-6">
                                    <select class="form-control">
                                        <option>家常</option>
                                        <option>凉菜</option>
                                        <option>主食</option>
                                    </select>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="form-group">
                        <label for="coursePrice" class="col-sm-4 control-lable">菜品价格</label>
                        <div class="col-sm-6">
                            <input type="number" class="form-control" id="coursePrice" name="cp" required> &nbsp;单位:￥
                        </div>
                    </div>
                    <div>
                        <div class="form-group">
                            <label for="inputfile" class="col-sm-4 control-lable">菜品照片</label>
                            <div class="col-sm-6">
                                <input type="file" id="inputfile">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="courseRemark" class="col-sm-4 control-lable">菜品备注</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="courseRemark" name="cr" required>
                            <p>-1:代表正常菜,0:代表厨师推荐。</p>
                            <p>正常数代表特价菜价格</p>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <center><button type="submit" class="btn btn-primary">确认添加</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">放弃返回</button></center>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- 	<script type="text/javascript">
		document.getElementById('inputfile').onchange = function() {
				add();
				var imgFile = this.files[0];
				var fr = new FileReader();
				fr.onload = function() {
					var imgs = document.getElementsByClassName('updateimg');
					imgs[imgs.length-1].src = fr.result;
					/*document.getElementById('image').getElementsByTagName('img')[0].src = fr.result;*/
				};
				fr.readAsDataURL(imgFile);
			};
	</script> -->
</body>
</html>

<!--
(div.container-fluid>(div.row>div.col-md-12>nav.navbar-default>(div.navbar-header>a.navbar-brand>span.text-warning)+(div.navbar-collapse>(ul.navbar-nav>(li>a)*4)+(ul.navbar-nav>li.dropdown>(a.dropdown-toggle>span.glyphicon-user+strong.caret)+(ul.dropdown-menu>li>a))))+(div.row>div.col-md-12>div.panel-info>(div.panel-heading>form.form-inline>(div.form-group>input.form-control)+(div.form-group>select.form-control>option*5)+(div.form-group>button.btn-sm>span.glyphicon-search)+(div.form-group>a.btn-success>span.glyphicon-plus-sign))+(div.panel-body>(thead>tr>th*10)+(tbody>(tr>th+(td*8)+(td>(a.btn-xs>span.glyphicon-edit)+(button.btn-danger>span.glyphicon-trash))+(td>(a.btn-xs>span.glyphicon-edit)+(button.btn-danger>span.glyphicon-trash))+(td>(a.btn-xs>span.glyphicon-edit)+(button.btn-danger>span.glyphicon-trash))+(nav.pull-right>ul.pagination>(li>a>span)+(li>a)*3+(li>a>span)))))))+div.modal.fade#delConfirmModal>div.modal-dialog>div.modal-content>(div.modal-header>(button.close>span)+(h4.modal-title))+(div.modal-body>h4.text-danger)+(div.modal-footer>(button.btn.btn-default*2))-->

