feat: implement profile editing and password change
This commit is contained in:
@@ -8,14 +8,18 @@
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
</div>
|
||||
@endif
|
||||
@if (session('error'))
|
||||
<div class="col-lg-12 mb-3">
|
||||
<div class="alert alert-danger">{{ session('error') }}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="col-lg-12 mb-4">
|
||||
<div class="user-profile-card">
|
||||
<h4 class="user-profile-card-title">بروزرسانی مشخصات پروفایل</h4>
|
||||
<div class="user-profile-form">
|
||||
<form action="{{route('accounts.edit-profile.update' , $user->id)}}" method="POST">
|
||||
<form action="{{ route('accounts.edit-profile.update') }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
@@ -60,7 +64,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>استان</label>
|
||||
<select name="province_id" class="form-control">
|
||||
<select name="province_id" id="province_id" class="form-control">
|
||||
<option value="">انتخاب استان</option>
|
||||
@foreach($provinces as $province)
|
||||
<option value="{{ $province->id }}"
|
||||
@@ -78,9 +82,9 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>شهر</label>
|
||||
<select name="city_id" class="form-control">
|
||||
<select name="city_id" id="city_id" class="form-control">
|
||||
<option value="">انتخاب شهر</option>
|
||||
@foreach($province->cities as $city)
|
||||
@foreach($cities as $city)
|
||||
<option value="{{ $city->id }}"
|
||||
{{ old('city_id', $user->city_id) == $city->id ? 'selected' : '' }}>
|
||||
{{ $city->name }}
|
||||
@@ -92,6 +96,7 @@
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button type="submit" class="theme-btn mt-4">آپدیت مشخصات پروفایل <i class="far fa-user"></i>
|
||||
</button>
|
||||
@@ -105,27 +110,34 @@
|
||||
<h4 class="user-profile-card-title">عوض کردن رمز عبور</h4>
|
||||
<div class="col-lg-12">
|
||||
<div class="user-profile-form">
|
||||
<form action="#" method="POST">
|
||||
<form action="{{ route('accounts.edit-profile.change-password') }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="form-group">
|
||||
<label>رمز عبور فعلی</label>
|
||||
<input type="password" name="current_password" class="form-control"
|
||||
placeholder="رمز عبور فعلی">
|
||||
@error('current_password') <span class="text-danger">{{ $message }}</span> @enderror
|
||||
@error('current_password')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>رمز عبور جدید</label>
|
||||
<input type="password" name="new_password" class="form-control"
|
||||
placeholder="رمز عبور جدید">
|
||||
@error('new_password') <span class="text-danger">{{ $message }}</span> @enderror
|
||||
@error('new_password')
|
||||
<span class="text-danger">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>تکرار رمز عبور جدید</label>
|
||||
<input type="password" name="new_password_confirmation" class="form-control"
|
||||
placeholder="تکرار رمز عبور جدید">
|
||||
</div>
|
||||
<button type="submit" class="theme-btn mt-4">عوض کردن رمز عبور <i class="far fa-key"></i>
|
||||
|
||||
<button type="submit" class="theme-btn mt-4">
|
||||
عوض کردن رمز عبور <i class="far fa-key"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -134,3 +146,37 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#province_id').on('change', function () {
|
||||
let provinceId = $(this).val();
|
||||
let citySelect = $('#city_id');
|
||||
|
||||
|
||||
citySelect.html('<option value="">انتخاب شهر</option>');
|
||||
|
||||
|
||||
if (provinceId) {
|
||||
citySelect.html('<option value="">در حال بارگذاری شهرها...</option>');
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url('/account/get-cities') }}/" + provinceId,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
let options = '<option value="">انتخاب شهر</option>';
|
||||
$.each(data, function (key, city) {
|
||||
options += '<option value="' + city.id + '">' + city.name + '</option>';
|
||||
});
|
||||
citySelect.html(options);
|
||||
},
|
||||
error: function () {
|
||||
citySelect.html('<option value="">خطا در دریافت لیست شهرها</option>');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
|
||||
@section('content')
|
||||
<main class="main">
|
||||
|
||||
<div class="site-breadcrumb" style="background: url({{asset('assets/img/breadcrumb/02.jpg')}})">
|
||||
<div class="container">
|
||||
<h2 class="breadcrumb-title">@yield('title')</h2>
|
||||
@@ -31,3 +29,4 @@
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
|
||||
@@ -86,5 +86,6 @@
|
||||
<script src="{{asset('assets/js/jquery.timepicker.min.js')}}"></script>
|
||||
<script src="{{asset('assets/js/wow.min.js')}}"></script>
|
||||
<script src="{{asset('assets/js/main.js')}}"></script>
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user