user_save.blade.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. @endsection
  7. @section('content')
  8. <body class="gray-bg">
  9. <div class="wrapper wrapper-content animated fadeInRight">
  10. <div class="row">
  11. <div class="col-sm-12">
  12. <div class="ibox float-e-margins">
  13. <div class="ibox-content">
  14. <form method="get" class="form-horizontal" id="form">
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label" for="nickname"><span class="red">*</span> 昵称:</label>
  17. <div class="col-sm-8">
  18. <input type="text" class="form-control" id="nickname" name="nickname"
  19. value="{{$user->nickname ?? ''}}">
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label class="col-sm-2 control-label" for="username"><span class="red">*</span>用户名:</label>
  24. <div class="col-sm-8">
  25. <input type="text" class="form-control" id="username" name="username"
  26. value="{{$user->username ?? ''}}" autocomplete="off">
  27. </div>
  28. </div>
  29. <div class="form-group">
  30. <label class="col-sm-2 control-label" for="password"><span class="red">*</span> 密码:</label>
  31. <div class="col-sm-8">
  32. <input type="password" class="form-control" id="password" name="password"
  33. autocomplete="off">
  34. @if($user) <span class="help-block m-b-none">如果不需要修改密码请设为空</span> @endif
  35. </div>
  36. </div>
  37. <div class="hr-line-dashed"></div>
  38. <div class="form-group">
  39. <label class="col-sm-2 control-label" for="phone"><span class="red">*</span> 手机号:</label>
  40. <div class="col-sm-8">
  41. <input type="text" class="form-control" id="phone" name="phone"
  42. value="{{$user->phone??''}}">
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. <label class="col-sm-2 control-label" for="telephone">座机:</label>
  47. <div class="col-sm-8">
  48. <input type="text" class="form-control" id="telephone" name="telephone"
  49. value="{{$user->telephone??''}}">
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. <label class="col-sm-2 control-label" for="email">邮箱:</label>
  54. <div class="col-sm-8">
  55. <input type="email" class="form-control" id="email" name="email"
  56. value="{{$user->email??''}}">
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label class="col-sm-2 control-label" for="role_id"><span class="red">*</span> 角色:</label>
  61. <div class="col-sm-8">
  62. <select class="form-control" style="width:350px;"
  63. id="role_id" name="role_id">
  64. <option value="">请选择角色</option>
  65. @foreach($roles as $role)
  66. <option value="{{$role->id}}" @if(($user->role_id??0)==$role->id) selected @endif>{{$role->name}}</option>
  67. @endforeach
  68. </select>
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. <label class="col-sm-2 control-label" for="agent_id"><span class="red">*</span> 代理商:</label>
  73. <div class="col-sm-8">
  74. <select class="form-control" style="width:350px;"
  75. id="role_id" name="agent_id">
  76. <option value="">请选择代理商</option>
  77. @foreach($agents as $agent)
  78. <option value="{{$agent->id}}" @if(($user->agent_id??0)==$agent->id) selected @endif>{{$agent->company_name}}</option>
  79. @endforeach
  80. </select>
  81. </div>
  82. </div>
  83. <div class="form-group">
  84. <div class="col-sm-4 col-sm-offset-2">
  85. <button class="btn btn-primary" type="button" onclick="units.save()">
  86. 保存
  87. </button>
  88. <button class="btn btn-white" type="button" id="cancel">取消</button>
  89. </div>
  90. </div>
  91. </form>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </body>
  98. @endsection
  99. @section('footer')
  100. <script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>
  101. <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
  102. <script src="{{asset('js/plugins/bootstrap-select-1.13.5/js/bootstrap-select.min.js')}}"></script>
  103. <script src="{{asset('js/plugins/bootstrap-select-1.13.5/js/i18n/defaults-zh_CN.min.js')}}"></script>
  104. <script>
  105. // $(function () {
  106. // var config = {".chosen-select": {}};
  107. // for (var selector in config) $(selector).chosen(config[selector]);
  108. // });
  109. var config = {".chosen-select": {}};
  110. for (var selector in config) $(selector).chosen(config[selector]);
  111. var jsSwitch = document.querySelector(".js-switch");
  112. new Switchery(jsSwitch, {color: "#1AB394", size: 'small'});
  113. var units = {
  114. save: function () {
  115. var url = '/admin/agents/users/{{$user->id??0}}';
  116. var data = tips.getFormValues('#form');
  117. var ajaxConfig = {
  118. url: url,
  119. type: 'put',
  120. data: data,
  121. success: function (result) {
  122. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  123. tips.closeParentLayer();
  124. window.parent.tips.tableRefresh('#table');
  125. });
  126. }
  127. };
  128. tips.ajax(ajaxConfig);
  129. }
  130. };
  131. $(document).on('click', '#cancel', function () {
  132. tips.closeParentLayer();
  133. });
  134. </script>
  135. @endsection