app.blade.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <link rel=icon type=image/png href="data:image/png;base64,iVBORw0KGgo=">
  8. <meta name="description" content="">
  9. <meta name="author" content="">
  10. <title>管理后台</title>
  11. <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  12. <style>
  13. body {
  14. padding-top: 50px;
  15. }
  16. .sub-header {
  17. padding-bottom: 10px;
  18. border-bottom: 1px solid #eee;
  19. }
  20. .navbar-fixed-top {
  21. border: 0;
  22. }
  23. .sidebar {
  24. display: none;
  25. }
  26. @media (min-width: 768px) {
  27. .sidebar {
  28. position: fixed;
  29. top: 51px;
  30. bottom: 0;
  31. left: 0;
  32. z-index: 1000;
  33. display: block;
  34. padding: 20px;
  35. overflow-x: hidden;
  36. overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
  37. background-color: #f5f5f5;
  38. border-right: 1px solid #eee;
  39. }
  40. }
  41. .nav-sidebar {
  42. margin-right: -21px; /* 20px padding + 1px border */
  43. margin-bottom: 20px;
  44. margin-left: -20px;
  45. }
  46. .nav-sidebar > li > a {
  47. padding-right: 20px;
  48. padding-left: 20px;
  49. }
  50. .nav-sidebar > .active > a,
  51. .nav-sidebar > .active > a:hover,
  52. .nav-sidebar > .active > a:focus {
  53. color: #fff;
  54. background-color: #428bca;
  55. }
  56. .main {
  57. padding: 20px;
  58. }
  59. @media (min-width: 768px) {
  60. .main {
  61. padding-right: 40px;
  62. padding-left: 40px;
  63. }
  64. }
  65. .main .page-header {
  66. margin-top: 0;
  67. }
  68. .placeholders {
  69. margin-bottom: 30px;
  70. text-align: center;
  71. }
  72. .placeholders h4 {
  73. margin-bottom: 0;
  74. }
  75. .placeholder {
  76. margin-bottom: 20px;
  77. }
  78. .placeholder img {
  79. display: inline-block;
  80. border-radius: 50%;
  81. }
  82. </style>
  83. </head>
  84. <body>
  85. <nav class="navbar navbar-inverse navbar-fixed-top">
  86. <div class="container-fluid">
  87. <div class="navbar-header">
  88. <a class="navbar-brand" href="/">管理后台</a>
  89. </div>
  90. <ul class="nav navbar-nav navbar-right">
  91. <li class="dropdown">
  92. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{session('username')}} <span class="caret"></span></a>
  93. <ul class="dropdown-menu">
  94. <li><a href="/logout">退出</a></li>
  95. </ul>
  96. </li>
  97. </ul>
  98. </div>
  99. </nav>
  100. <div class="container-fluid">
  101. <div class="row">
  102. <div class="col-sm-3 col-md-2 sidebar">
  103. <ul class="nav nav-sidebar">
  104. <li class="{{$page == 'send_orders' ? 'active':''}}" ><a href="{{url('/sendorder/list')}}">派单统计</a></li>
  105. </ul>
  106. </div>
  107. <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
  108. @yield('content')
  109. </div>
  110. </div>
  111. </div>
  112. </body>
  113. <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
  114. <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  115. <script>
  116. function AlertWindow(obj) {
  117. $.ajaxSetup({
  118. headers: {
  119. 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
  120. }
  121. });
  122. this.startEle = obj.startEle || '.js-alert-start';
  123. this.startAjax = obj.startAjax || false;
  124. this.endAjax = obj.endAjax || false;
  125. this.closeEle = obj.closeEle || ".js-modal-close";
  126. this.saveEle = obj.saveEle || ".js-modal-save";
  127. this.errorEle = obj.errorEle || ".js-error-msg";
  128. this.oStartEle = $(this.startEle);
  129. this.formHtml = obj.formHtml;
  130. this.saveHtml =obj.saveHtml;
  131. this.__init__();
  132. }
  133. AlertWindow.prototype.__init__ = function () {
  134. fromOldHtml = '';
  135. //打开
  136. var that = this;
  137. var editid = '';
  138. if(that.startAjax){
  139. that.oStartEle.on('click',function (e) {
  140. e.preventDefault();
  141. var data = {};
  142. if(that.startAjax.data){
  143. data[that.startAjax.data.key] = $(this).data(that.startAjax.data.key);
  144. }
  145. $.ajax({
  146. url:that.startAjax.url,
  147. type:that.startAjax.type || 'get',
  148. data:data,
  149. dataType:'json',
  150. success:function (res) {
  151. if(res.code == 1){
  152. //$(that.startAjax.target).html(res.data)
  153. that.formHtml = res.data;
  154. var title = $(this).data('title') || '编辑';
  155. editid = $(this).data('id');
  156. that.show(title);
  157. }
  158. },
  159. });
  160. })
  161. }else{
  162. that.oStartEle.on('click',function (e) {
  163. e.preventDefault();
  164. var title = $(this).data('title') || '编辑';
  165. editid = $(this).data('id');
  166. that.show(title);
  167. })
  168. }
  169. //提交
  170. console.log(that.saveEle);
  171. $("#myModal .modal-footer").on('click',that.saveEle,function () {
  172. var data = $('.js-ajax-from').serializeArray();
  173. var res = that.formcheck(data,that.endAjax.requiredata) ;
  174. if(!( res === true )){
  175. $('.'+res).addClass('has-error');
  176. $(that.errorEle).html("不能为空").css({"display":"inline"});
  177. return false;
  178. }
  179. //console.log(that.endAjax);
  180. //console.log(data);
  181. var newdata = {};
  182. for(var k in data){
  183. newdata[data[k]['name']] = data[k]['value'];
  184. }
  185. console.log(editid);
  186. if(editid){
  187. newdata['id'] = editid;
  188. }
  189. console.log(newdata);
  190. //return ;
  191. $.ajax({
  192. url:that.endAjax.url,
  193. type:"post",
  194. data:newdata,
  195. dataType:'json',
  196. success:function (response) {
  197. //console.log(response)
  198. if(response.code){
  199. that.hide();
  200. setTimeout(function () {
  201. var html = '<div class="alert alert-success" role="alert">'+response.msg+'</div>';
  202. $('.js-prepend').prepend(html);
  203. setTimeout(function () {
  204. //window.location.reload();
  205. },300)
  206. },10)
  207. }else {
  208. $('.'+res).addClass('has-error');
  209. $(that.errorEle).html(response.msg).css({"display":"inline"});
  210. return false;
  211. }
  212. },
  213. fail:function () {
  214. $(that.errorEle).html("error").css({"display":"inline"});
  215. return false;
  216. }
  217. })
  218. });
  219. //关闭
  220. $(that.closeEle).on('click',function () {
  221. that.hide(that.saveClass);
  222. /*setTimeout(function () {
  223. window.location.reload();
  224. },100)*/
  225. })
  226. };
  227. AlertWindow.prototype.show = function (title) {
  228. $("#myModal .modal-footer").html(this.saveHtml);
  229. $('#myModal .js-ajax-from').html(this.formHtml);
  230. $('body').addClass('modal-open');
  231. $('#myModal').addClass('in').css({"display":"block"});
  232. if(title){
  233. $('#myModalLabel').html(title);
  234. }
  235. $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii'});
  236. };
  237. AlertWindow.prototype.hide = function () {
  238. $("#myModal .modal-footer").html("");
  239. $('body').removeClass('modal-open');
  240. $('#myModal').removeClass('in').css({"display":"none"});
  241. };
  242. AlertWindow.prototype.ajax = function (obj) {
  243. //console.log(obj)
  244. $.ajax({
  245. obj
  246. });
  247. };
  248. AlertWindow.prototype.formcheck = function (form,require) {
  249. //console.log(require);
  250. if(!require.length)
  251. return true;
  252. for(var i = 0;i<require.length;i++){
  253. if( form[i].name == require[i] && form[i].value == '')
  254. return require[i];
  255. }
  256. return true;
  257. }
  258. $(function () {
  259. /*var total = $("#hidden-total").val();
  260. $("#js-order-page ul").append("<li><a href='javascript:;'>总计"+total+"</a></li>")
  261. $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii'});*/
  262. })
  263. </script>
  264. @stack('scripts')
  265. </html>