user_show.blade.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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"
  22. autocomplete="off"
  23. value="{{$user->nickname ?? ''}}">
  24. </div>
  25. </div>
  26. <div class="form-group">
  27. <label class="col-sm-2 control-label" for="username_new"><span class="red">* </span>
  28. 用户名:</label>
  29. <div class="col-sm-8">
  30. <input type="text" class="form-control" id="username_new" name="username_new"
  31. value="{{$user->username ?? ''}}" autocomplete="off">
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="col-sm-2 control-label" for="password_new"><span class="red">* </span> 密码:</label>
  36. <div class="col-sm-8">
  37. <input type="password" class="form-control" id="password_new" name="password_new"
  38. autocomplete="off">
  39. @if($user) <span class="help-block m-b-none">如果不需要修改密码请设为空</span> @endif
  40. </div>
  41. </div>
  42. <div class="hr-line-dashed"></div>
  43. <div class="form-group">
  44. <label class="col-sm-2 control-label" for="phone">手机号:</label>
  45. <div class="col-sm-8">
  46. <input type="text" class="form-control" id="phone" name="phone" autocomplete="off"
  47. value="{{$user->phone??''}}">
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label class="col-sm-2 control-label" for="telephone">座机:</label>
  52. <div class="col-sm-8">
  53. <input type="text" class="form-control" id="telephone" name="telephone"
  54. autocomplete="off"
  55. value="{{$user->telephone??''}}">
  56. </div>
  57. </div>
  58. <div class="form-group">
  59. <label class="col-sm-2 control-label" for="email">邮箱:</label>
  60. <div class="col-sm-8">
  61. <input type="email" class="form-control" id="email" name="email" autocomplete="off"
  62. value="{{$user->email??''}}">
  63. </div>
  64. </div>
  65. {{--<div class="form-group" id="siteAssign"--}}
  66. {{--style="@if(($user->role_id??null)!=\App\Http\Models\Role::TYPE_CUSTOMER) display:none @endif">--}}
  67. {{--<label class="col-sm-2 control-label" for="site_id">站点分配:</label>--}}
  68. {{--<div class="col-sm-8">--}}
  69. {{--<select data-placeholder="选择站点..." class="chosen-select" style="width:350px;"--}}
  70. {{--id="site_id" name="site_id">--}}
  71. {{--<option value="">请选择站点</option>--}}
  72. {{--@foreach ($sites as $site)--}}
  73. {{--<option value="{{$site->id}}"--}}
  74. {{--@if(($site->site_id??null)==$site->id) selected @endif>{{$site->cn_title}}</option>--}}
  75. {{--@endforeach--}}
  76. {{--</select>--}}
  77. {{--</div>--}}
  78. {{--</div>--}}
  79. <div class="form-group">
  80. <label class="col-sm-2 control-label" for="status">状态:</label>
  81. <div class="col-sm-8">
  82. <input type="checkbox" id="status" name="status" class="js-switch"
  83. @if(!$user || $user->status) checked @endif>
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <div class="col-sm-4 col-sm-offset-2">
  88. <button class="btn btn-primary" type="button" data-id="{{$user->id??0}}" id="save">
  89. 保存
  90. </button>
  91. <button class="btn btn-white" type="button" id="cancel">取消</button>
  92. </div>
  93. </div>
  94. </form>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </body>
  101. @endsection
  102. @section('footer')
  103. {{--<script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>--}}
  104. <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
  105. {{--<script src="{{asset('js/plugins/bootstrap-select-1.13.5/js/bootstrap-select.min.js')}}"></script>--}}
  106. {{--<script src="{{asset('js/plugins/bootstrap-select-1.13.5/js/i18n/defaults-zh_CN.min.js')}}"></script>--}}
  107. <!-- Latest compiled and minified JavaScript -->
  108. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
  109. <!-- (Optional) Latest compiled and minified JavaScript translation files -->
  110. <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/i18n/defaults-*.min.js"></script>
  111. <script>
  112. // var config = {".chosen-select": {}};
  113. // for (var selector in config) $(selector).chosen(config[selector]);
  114. var jsSwitch = document.querySelector(".js-switch");
  115. new Switchery(jsSwitch, {color: "#1AB394", size: 'small'});
  116. var units = {
  117. {{--selectRole: function (_this) {--}}
  118. {{--// var type = $(_this).find("option:selected").data('type');--}}
  119. {{--var type = $(_this).val();--}}
  120. {{--if (type === "{{\App\Http\Models\Role::TYPE_CUSTOMER}}") {--}}
  121. {{--$("#siteAssign").css('display', '');--}}
  122. {{--// var selectConfig = {".chosen-select": {}};--}}
  123. {{--// for (var selectorItem in selectConfig) {--}}
  124. {{--// $(selectorItem).chosen(selectConfig[selectorItem]);--}}
  125. {{--// }--}}
  126. {{--} else {--}}
  127. {{--$("#siteAssign").css('display', 'none');--}}
  128. {{--}--}}
  129. {{--}--}}
  130. };
  131. $(document).on('click', '#cancel', function () {
  132. tips.closeParentLayer();
  133. });
  134. $(document).on('click', '#save', function () {
  135. var id = $(this).data('id');
  136. var url = '/admin/customer/user';
  137. var type = 'post';
  138. if (id > 0) { //编辑
  139. url += '/' + id;
  140. type = 'put';
  141. }
  142. var data = tips.getFormValues('#form');
  143. data.status = jsSwitch.checked ? 1 : 0;
  144. data.site_ids = $("#site_ids").val();
  145. data.username = $("#username_new").val();
  146. data.password = $("#password_new").val();
  147. var ajaxConfig = {
  148. url: url,
  149. type: type,
  150. data: data,
  151. success: function (result) {
  152. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  153. tips.closeParentLayer();
  154. window.parent.tips.tableRefresh('#table');
  155. });
  156. }
  157. };
  158. tips.ajax(ajaxConfig);
  159. });
  160. </script>
  161. @endsection