edit.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. @component('panel.layouts.component', ['title' => 'حساب‌کاربری'])
  2. @slot('style')
  3. <style>
  4. label.cabinet{
  5. display: block;
  6. cursor: pointer;
  7. }
  8. label.cabinet input.file{
  9. position: relative;
  10. height: 100%;
  11. width: auto;
  12. opacity: 0;
  13. -moz-opacity: 0;
  14. filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
  15. margin-top:-30px;
  16. }
  17. #upload-demo{
  18. width: 250px;
  19. height: 250px;
  20. padding-bottom:25px;
  21. }
  22. figure figcaption {
  23. position: absolute;
  24. bottom: 0;
  25. color: #fff;
  26. width: 100%;
  27. padding-left: 9px;
  28. padding-bottom: 5px;
  29. text-shadow: 0 0 10px #000;
  30. }
  31. </style>
  32. @endslot
  33. @slot('subject')
  34. <h1><i class="fa fa-user"></i> حساب‌کاربری</h1>
  35. <p>بخش ویرایش اطلاعات حساب‌کاربری، لطفا اطلاعات خود را با دقت وارد نمایید.</p>
  36. @endslot
  37. @slot('breadcrumb')
  38. <li class="breadcrumb-item"><a href="{{ route('panel') }}"> پنل مدیریت</a></li>
  39. <li class="breadcrumb-item">حساب‌کاربری</li>
  40. @endslot
  41. @slot('content')
  42. <div class="row user">
  43. <div class="col-md-12">
  44. <div class="profile">
  45. <div style="padding: 30px 60px;text-align: center;white-space: nowrap;background-color: #404040;color: #fff;">
  46. <div class="container">
  47. <div class="row">
  48. <div class="col-xs-12">
  49. <label class="cabinet center-block">
  50. <input type="file" class="item-img file center-block" name="file_photo" style="opacity: 1;display: none;"/>
  51. <figure>
  52. <img src="" class="gambar img-responsive img-thumbnail" id="item-img-output" style="height: 150px; width: 150px;border-radius: 50%;" />
  53. </figure>
  54. </label>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="modal fade" id="cropImagePop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  59. <div class="modal-dialog">
  60. <div class="modal-content">
  61. <div class="modal-header">
  62. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  63. <h4 class="modal-title" id="myModalLabel"></h4>
  64. </div>
  65. <div class="modal-body" style="text-align: -webkit-center;">
  66. <div id="upload-demo" class="center-block"></div>
  67. </div>
  68. <div class="modal-footer">
  69. <button type="button" id="cropImageBtn" class="btn btn-primary">برش</button>
  70. <button type="button" class="btn btn-secondary" data-dismiss="modal">بستن</button>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <h4>{{ auth()->user()->name }}</h4>
  76. @forelse(auth()->user()->roles as $role)
  77. <span class="py-0">{{ $role->display_name }}</span><br>
  78. @empty
  79. <span></span>
  80. @endforelse
  81. </div>
  82. <div style="flex: 1;background-image: url(http://placeimg.com/1200/300/nature);background-size: cover;background-position: center;min-height: 300px;"></div>
  83. </div>
  84. </div>
  85. <div class="col-md-3">
  86. <div class="tile p-0">
  87. <ul class="nav flex-column nav-tabs user-tabs">
  88. <li class="nav-item"><a class="nav-link active" href="#user-settings" data-toggle="tab">تنظیمات</a></li>
  89. <li class="nav-item"><a class="nav-link" href="#user-timeline" data-toggle="tab">آخرین رویداد‌ها</a></li>
  90. </ul>
  91. </div>
  92. </div>
  93. <div class="col-md-9">
  94. <div class="tab-content">
  95. <div class="tab-pane active" id="user-settings">
  96. <div class="tile user-settings">
  97. <h4 class="line-head">اطلاعات کاربری</h4>
  98. <form action="{{ route('account.update', $account) }}" method="POST">
  99. @csrf
  100. @method('PUT')
  101. <div class="row mb-4">
  102. <div class="col-md-4">
  103. <label for="username">نام کاربری</label>
  104. <input class="form-control @error('username') is-invalid @enderror" type="text" name="username" id="username" value="{{ $account->username ?? old('username') }}">
  105. @error('username')
  106. <span class="invalid-feedback" role="alert">
  107. <strong>
  108. {{ $message }}
  109. </strong>
  110. </span>
  111. @enderror
  112. </div>
  113. <div class="col-md-4">
  114. <label for="name">نام و نام‌خانوادگی</label>
  115. <input class="form-control @error('name') is-invalid @enderror" type="text" name="name" id="name" value="{{ $account->name ?? old('name') }}">
  116. @error('name')
  117. <span class="invalid-feedback" role="alert">
  118. <strong>
  119. {{ $message }}
  120. </strong>
  121. </span>
  122. @enderror
  123. </div>
  124. </div>
  125. <div class="row mb-4">
  126. <div class="col-md-4">
  127. <label for="mobile">تلفن‌همراه</label>
  128. <input class="form-control @error('mobile') is-invalid @enderror" type="text" name="mobile" id="mobile" value="{{ $account->mobile ?? old('mobile') }}">
  129. @error('mobile')
  130. <span class="invalid-feedback" role="alert">
  131. <strong>
  132. {{ $message }}
  133. </strong>
  134. </span>
  135. @enderror
  136. </div>
  137. <div class="col-md-4">
  138. <label for="email">ایمیل</label>
  139. <input class="form-control @error('email') is-invalid @enderror" type="email" name="email" id="email" value="{{ $account->email ?? old('email') }}">
  140. @error('email')
  141. <span class="invalid-feedback" role="alert">
  142. <strong>
  143. {{ $message }}
  144. </strong>
  145. </span>
  146. @enderror
  147. </div>
  148. </div>
  149. <div class="row mb-4">
  150. <div class="col-md-8">
  151. <label for="two_factor_status">فعال‌سازی ورود دو مرحله‌ای</label>
  152. <select class="form-control @error('two_factor_status') is-invalid @enderror" name="two_factor_status" id="two_factor_status">
  153. <option value="off" {{ ($account->two_factor_status == 'off') ? 'selected' : '' }}>غیر‌فعال باشد</option>
  154. <option value="sms" {{ ($account->two_factor_status == 'sms') ? 'selected' : '' }}>از طریق پیامک</option>
  155. <option value="email" {{ ($account->two_factor_status == 'email') ? 'selected' : '' }}>از طریق ایمیل</option>
  156. </select>
  157. @error('two_factor_status')
  158. <span class="invalid-feedback" role="alert">
  159. <strong>
  160. {{ $message }}
  161. </strong>
  162. </span>
  163. @enderror
  164. </div>
  165. </div>
  166. <div class="row mb-10">
  167. <div class="col-md-12">
  168. <button class="btn btn-sm btn-success" type="submit">ثبت</button>
  169. </div>
  170. </div>
  171. </form>
  172. </div>
  173. </div>
  174. <div class="tab-pane fade" id="user-timeline">
  175. <div class="timeline-post">
  176. <div class="post-media"><a href="#"><img src="https://s3.amazonaws.com/uifaces/faces/twitter/jsa/48.jpg"></a>
  177. <div class="content">
  178. <h5><a href="#">John Doe</a></h5>
  179. <p class="text-muted"><small>2 January at 9:30</small></p>
  180. </div>
  181. </div>
  182. <div class="post-content">
  183. <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis tion ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  184. </div>
  185. <ul class="post-utility">
  186. <li class="likes"><a href="#"><i class="fa fa-fw fa-lg fa-thumbs-o-up"></i>Like</a></li>
  187. <li class="shares"><a href="#"><i class="fa fa-fw fa-lg fa-share"></i>Share</a></li>
  188. <li class="comments"><i class="fa fa-fw fa-lg fa-comment-o"></i> 5 Comments</li>
  189. </ul>
  190. </div>
  191. <div class="timeline-post">
  192. <div class="post-media"><a href="#"><img src="https://s3.amazonaws.com/uifaces/faces/twitter/jsa/48.jpg"></a>
  193. <div class="content">
  194. <h5><a href="#">John Doe</a></h5>
  195. <p class="text-muted"><small>2 January at 9:30</small></p>
  196. </div>
  197. </div>
  198. <div class="post-content">
  199. <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis tion ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  200. </div>
  201. <ul class="post-utility">
  202. <li class="likes"><a href="#"><i class="fa fa-fw fa-lg fa-thumbs-o-up"></i>Like</a></li>
  203. <li class="shares"><a href="#"><i class="fa fa-fw fa-lg fa-share"></i>Share</a></li>
  204. <li class="comments"><i class="fa fa-fw fa-lg fa-comment-o"></i> 5 Comments</li>
  205. </ul>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. @endslot
  212. @slot('script')
  213. <script>
  214. // Start upload preview image
  215. $(".gambar").attr("src", "https://s3.amazonaws.com/uifaces/faces/twitter/jsa/128.jpg");
  216. var $uploadCrop,
  217. tempFilename,
  218. rawImg,
  219. imageId;
  220. function readFile(input) {
  221. if (input.files && input.files[0]) {
  222. var reader = new FileReader();
  223. reader.onload = function (e) {
  224. $('.upload-demo').addClass('ready');
  225. $('#cropImagePop').modal('show');
  226. rawImg = e.target.result;
  227. };
  228. reader.readAsDataURL(input.files[0]);
  229. }
  230. else {
  231. swal("Sorry - you're browser doesn't support the FileReader API");
  232. }
  233. }
  234. $uploadCrop = $('#upload-demo').croppie({
  235. viewport: {
  236. width: 150,
  237. height: 150,
  238. type: 'circle'
  239. },
  240. enforceBoundary: false,
  241. enableExif: true
  242. });
  243. $('#cropImagePop').on('shown.bs.modal', function(){
  244. // alert('Shown pop');
  245. $uploadCrop.croppie('bind', {
  246. url: rawImg
  247. }).then(function(){
  248. console.log('jQuery bind complete');
  249. });
  250. });
  251. $('.item-img').on('change', function () { imageId = $(this).data('id'); tempFilename = $(this).val();
  252. $('#cancelCropBtn').data('id', imageId); readFile(this); });
  253. $('#cropImageBtn').on('click', function (ev) {
  254. $uploadCrop.croppie('result', {
  255. type: 'base64',
  256. format: 'jpeg',
  257. size: {width: 150, height: 150}
  258. }).then(function (resp) {
  259. $('#item-img-output').attr('src', resp);
  260. $('#cropImagePop').modal('hide');
  261. });
  262. });
  263. // End upload preview image
  264. </script>
  265. @endslot
  266. @endcomponent