user_show.blade.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. @extends('admin/layout')
  2. @section('header')
  3. <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
  4. <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
  5. {{--<link href="{{asset('js/plugins/bootstrap-select-1.13.5/css/bootstrap-select.min.css')}}" rel="stylesheet">--}}
  6. <link rel="stylesheet"
  7. href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
  8. @endsection
  9. @section('content')
  10. <body class="gray-bg">
  11. <div class="wrapper wrapper-content animated fadeInRight">
  12. <div class="row">
  13. <div class="col-sm-12">
  14. <div class="ibox float-e-margins">
  15. <div class="ibox-content">
  16. <form method="get" class="form-horizontal" id="form">
  17. <div class="form-group">
  18. <label class="col-sm-2 control-label" for="nickname"><span
  19. class="red">* </span>昵称:</label>
  20. <div class="col-sm-8">
  21. <input type="text" class="form-control" id="nickname" name="nickname" autocomplete="off"
  22. value="{{$user->nickname ?? ''}}">
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. <label class="col-sm-2 control-label" for="username_new"><span class="red">* </span>
  27. 用户名:</label>
  28. <div class="col-sm-8">
  29. <input type="text" class="form-control" id="username_new" name="username_new"
  30. value="{{$user->username ?? ''}}" autocomplete="off">
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label class="col-sm-2 control-label" for="password_new"><span class="red">* </span> 密码:</label>
  35. <div class="col-sm-8">
  36. <input type="password" class="form-control" id="password_new" name="password_new"
  37. autocomplete="off">
  38. @if($user) <span class="help-block m-b-none">如果不需要修改密码请设为空</span> @endif
  39. </div>
  40. </div>
  41. <div class="hr-line-dashed"></div>
  42. <div class="form-group">
  43. <label class="col-sm-2 control-label" for="entry_time">入职时间:</label>
  44. <div class="col-sm-8">
  45. <input type="text" class="form-control deadline" id="entry_time" name="entry_time" autocomplete="off"
  46. value="{{$user->entry_time??''}}">
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-2 control-label" for="phone">手机号:</label>
  51. <div class="col-sm-8">
  52. <input type="text" class="form-control" id="phone" name="phone" autocomplete="off"
  53. value="{{$user->phone??''}}">
  54. </div>
  55. </div>
  56. <div class="form-group">
  57. <label class="col-sm-2 control-label" for="telephone">座机:</label>
  58. <div class="col-sm-8">
  59. <input type="text" class="form-control" id="telephone" name="telephone" autocomplete="off"
  60. value="{{$user->telephone??''}}">
  61. </div>
  62. </div>
  63. <div class="form-group">
  64. <label class="col-sm-2 control-label" for="email">邮箱:</label>
  65. <div class="col-sm-8">
  66. <input type="email" class="form-control" id="email" name="email" autocomplete="off"
  67. value="{{$user->email??''}}">
  68. </div>
  69. </div>
  70. <div class="form-group">
  71. <label class="col-sm-2 control-label" for="qq">qq号:</label>
  72. <div class="col-sm-8">
  73. <input type="email" class="form-control" id="qq" name="qq" autocomplete="off" value="{{$user->qq??''}}">
  74. </div>
  75. </div>
  76. <div class="form-group">
  77. <label class="col-sm-2 control-label" for="role_id"><span class="red">* </span>
  78. 角色:</label>
  79. <div class="col-sm-8">
  80. <select class="form-control" style="width:350px;"
  81. id="role_id" name="role_id" autocomplete="off">
  82. <option value="">请选择角色</option>
  83. @foreach ($roles as $role)
  84. <option data-type="{{$role->id}}" value="{{$role->id}}"
  85. @if(($user->role_id??null)==$role->id) selected @endif>{{$role->name}}</option>
  86. @endforeach
  87. </select>
  88. </div>
  89. </div>
  90. <div class="form-group" id="siteAssign">
  91. <label class="col-sm-2 control-label" for="site_ids">站点分配:</label>
  92. <div class="col-sm-8">
  93. <select class="selectpicker form-control"
  94. id="site_ids" name="site_ids" data-live-search="true" multiple
  95. title="请选择站点" autocomplete="off">
  96. <option value="">请选择站点</option>
  97. @foreach ($sites as $site)
  98. <option value="{{$site->id}}"
  99. @if(in_array($site->id,$hasSiteIds)) selected @endif>{{$site->cn_title}}</option>
  100. @endforeach
  101. </select>
  102. </div>
  103. </div>
  104. <div class="form-group">
  105. <label class="col-sm-2 control-label" for="status">状态:</label>
  106. <div class="col-sm-8">
  107. <input type="checkbox" id="status" name="status" class="js-switch"
  108. @if(!$user || $user->status) checked @endif>
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <div class="col-sm-4 col-sm-offset-2">
  113. <button class="btn btn-primary" type="button" data-id="{{$user->id??0}}" id="save">
  114. 保存
  115. </button>
  116. <button class="btn btn-white" type="button" id="cancel">取消</button>
  117. </div>
  118. </div>
  119. </form>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </body>
  126. @endsection
  127. @section('footer')
  128. <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
  129. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  130. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  131. <script>
  132. //时间插件
  133. lay('.deadline').each(function () {
  134. laydate.render({
  135. elem: this
  136. , trigger: 'click'
  137. });
  138. });
  139. var jsSwitch = document.querySelector(".js-switch");
  140. new Switchery(jsSwitch, {color: "#1AB394", size: 'small'});
  141. $(document).on('click', '#cancel', function () {
  142. tips.closeParentLayer();
  143. });
  144. $(document).on('click', '#save', function () {
  145. var id = $(this).data('id');
  146. var url = '/admin/system/user';
  147. var type = 'post';
  148. if (id > 0) { //编辑
  149. url += '/' + id;
  150. type = 'put';
  151. }
  152. var data = tips.getFormValues('#form');
  153. data.status = jsSwitch.checked ? 1 : 0;
  154. data.site_ids = $("#site_ids").val();
  155. data.username = $("#username_new").val();
  156. data.password = $("#password_new").val();
  157. var ajaxConfig = {
  158. url: url,
  159. type: type,
  160. data: data,
  161. success: function (result) {
  162. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  163. tips.closeParentLayer();
  164. window.parent.tips.tableRefresh('#table');
  165. });
  166. }
  167. };
  168. tips.ajax(ajaxConfig);
  169. });
  170. </script>
  171. @endsection