edit.blade.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. @extends('admin/public/layout')
  2. @section('css')
  3. <link href="{{ asset('/static/js/bootstrap-datepicker/css/bootstrap-datepicker3.min.css')}}" rel="stylesheet" />
  4. @endsection
  5. @section('title')
  6. 编辑用户
  7. @endsection
  8. @section('content')
  9. <section class="content-header">
  10. <h1>
  11. 编辑用户
  12. <small>编辑用户信息</small>
  13. </h1>
  14. </section>
  15. <section class="content">
  16. <div class="row">
  17. <div class="col-xs-12">
  18. <div class="box box-default">
  19. <div class="box-header with-border">
  20. <h3 class="box-title">基本资料</h3>
  21. </div>
  22. <form role="form" name="userForm" method="POST" enctype="multipart/form-data" action="{{ route('admin.user.update',['id'=>$user->id]) }}">
  23. <input name="_method" type="hidden" value="PUT">
  24. <input type="hidden" name="_token" value="{{ csrf_token() }}">
  25. <div class="box-body">
  26. <div class="form-group @if ($errors->has('name')) has-error @endif">
  27. <label for="name">用户名</label>
  28. <input type="text" name="name" class="form-control " placeholder="登陆用户名" value="{{ old('name',$user->name) }}">
  29. @if ($errors->has('name')) <p class="help-block">{{ $errors->first('name') }}</p> @endif
  30. </div>
  31. <div class="form-group">
  32. <label>头像</label>
  33. <input type="file" name="avatar" />
  34. <div style="margin-top: 10px;">
  35. <img src="{{ get_user_avatar($user->id,'big') }}" width="100"/>
  36. </div>
  37. </div>
  38. <div class="form-group @if ($errors->has('email')) has-error @endif">
  39. <label for="name">邮箱</label>
  40. <input type="text" name="email" class="form-control " placeholder="邮箱地址" value="{{ old('email',$user->email) }}">
  41. @if ($errors->has('email')) <p class="help-block">{{ $errors->first('email') }}</p> @endif
  42. </div>
  43. <div class="form-group @if ($errors->has('password')) has-error @endif">
  44. <label for="name">密码</label>
  45. <input type="text" name="password" class="form-control " placeholder="密码" value="" />
  46. @if ($errors->has('password')) <p class="help-block">{{ $errors->first('password') }}</p> @endif
  47. </div>
  48. <div class="form-group">
  49. <label for="name">角色</label>
  50. <select class="form-control" name="role_id">
  51. @foreach( $roles as $role )
  52. <option value="{{ $role->id }}" @if($user->getRoles()->contains($role->id)) selected @endif> {{ $role->name }}</option>
  53. @endforeach
  54. </select>
  55. </div>
  56. <div class="form-group ">
  57. <label for="time_friendly">性别</label>
  58. <div class="radio">
  59. <label><input type="radio" name="gender" value="1" @if ( $user->gender === 1) checked @endif >男</label>&nbsp;&nbsp;&nbsp;&nbsp;
  60. <label><input type="radio" name="gender" value="2" @if ( $user->gender === 2) checked @endif >女</label>&nbsp;&nbsp;&nbsp;&nbsp;
  61. <label><input type="radio" name="gender" value="0" @if ( $user->gender === 0) checked @endif >保密</label>
  62. </div>
  63. </div>
  64. <div class="form-group @if ($errors->has('birthday')) has-error @endif">
  65. <label for="name">出生日期</label>
  66. <input type="text" name="birthday" class="form-control datepicker" placeholder="出生日期" value="{{ old('birthday',$user->birthday) }}" />
  67. @if ($errors->has('birthday')) <p class="help-block">{{ $errors->first('birthday') }}</p> @endif
  68. </div>
  69. <div class="form-group">
  70. <label for="setting-city" class="control-label">所在城市</label>
  71. <div class="row">
  72. <div class="col-sm-5">
  73. <select class="form-control" name="province" id="province">
  74. <option>请选择省份</option>
  75. @foreach($data['provinces'] as $province)
  76. <option value="{{ $province->id }}" @if($user->province == $province->id) selected @endif>{{ $province->name }}</option>
  77. @endforeach
  78. </select>
  79. </div>
  80. <div class="col-sm-5">
  81. <select class="form-control" name="city" id="city">
  82. <option>请选择城市</option>
  83. @foreach($data['cities'] as $city)
  84. <option value="{{ $city->id }}" @if($user->city == $city->id) selected @endif >{{ $city->name }}</option>
  85. @endforeach
  86. </select>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="form-group @if ($errors->has('title')) has-error @endif">
  91. <label for="name">身份职业</label>
  92. <input type="text" name="title" class="form-control " placeholder="身份职业" value="{{ old('title',$user->title) }}">
  93. @if ($errors->has('title')) <p class="help-block">{{ $errors->first('title') }}</p> @endif
  94. </div>
  95. <div class="form-group @if ($errors->has('description')) has-error @endif">
  96. <label for="name">自我介绍</label>
  97. <textarea name="description" class="form-control " placeholder="自我介绍">{{ old('description',$user->description) }}</textarea>
  98. @if ($errors->has('description')) <p class="help-block">{{ $errors->first('description') }}</p> @endif
  99. </div>
  100. <div class="form-group">
  101. <label>状态</label>
  102. <span class="text-muted">(禁用后用户将不能访问网站)</span>
  103. <div class="radio">
  104. @foreach(trans_common_status('all') as $key => $status)
  105. <label>
  106. <input type="radio" name="status" value="{{ $key }}" @if($user->status === $key) checked @endif /> {{ $status }}
  107. </label>&nbsp;&nbsp;
  108. @endforeach
  109. </div>
  110. </div>
  111. </div>
  112. <div class="box-footer">
  113. <button type="submit" class="btn btn-primary">保存</button>
  114. <button type="reset" class="btn btn-success">重置</button>
  115. </div>
  116. </form>
  117. </div>
  118. </div>
  119. </div>
  120. </section>
  121. @endsection
  122. @section('script')
  123. <script src="{{ asset('/static/js/bootstrap-datepicker/js/bootstrap-datepicker.js') }}"></script>
  124. <script src="{{ asset('/static/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js') }}"></script>
  125. <script type="text/javascript">
  126. $(function(){
  127. /*生日日历*/
  128. $(".datepicker").datepicker({
  129. format: "yyyy-mm-dd",
  130. language: "zh-CN",
  131. calendarWeeks: true,
  132. autoclose: true
  133. });
  134. /*加载省份城市*/
  135. $("#province").change(function(){
  136. var province_id = $(this).val();
  137. $("#city").load("{{ url('ajax/loadCities') }}/"+province_id);
  138. });
  139. set_active_menu('manage_user',"{{ route('admin.user.index') }}");
  140. });
  141. </script>
  142. @endsection