185 lines
9.3 KiB
PHP
185 lines
9.3 KiB
PHP
@extends('account.layouts.app')
|
|
|
|
@section('title' , 'ویرایش پروفایل')
|
|
|
|
@section('account-content')
|
|
<div class="user-profile-wrapper">
|
|
|
|
@if (session('success'))
|
|
<div class="col-lg-12 mb-3">
|
|
<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') }}" method="POST">
|
|
@csrf
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>نام </label>
|
|
<input type="text" name="first_name" class="form-control"
|
|
value="{{ old('first_name', $user->first_name) }}" placeholder="نام شما">
|
|
@error('first_name')
|
|
<span class="text-danger">
|
|
{{ $message }}
|
|
</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>نام خانوادگی</label>
|
|
<input type="text" name="last_name" class="form-control"
|
|
value="{{ old('last_name', $user->last_name) }}" placeholder="نام خانوادگی">
|
|
@error('last_name') <span class="text-danger">{{ $message }}</span> @enderror
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>ایمیل</label>
|
|
<input type="text" name="email" class="form-control"
|
|
value="{{ old('email', $user->email) }}" placeholder="ایمیل">
|
|
@error('email')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>موبایل</label>
|
|
<input type="text" name="mobile" class="form-control"
|
|
value="{{ old('mobile', $user->mobile) }}" placeholder="موبایل">
|
|
@error('mobile')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>استان</label>
|
|
<select name="province_id" id="province_id" class="form-control">
|
|
<option value="">انتخاب استان</option>
|
|
@foreach($provinces as $province)
|
|
<option value="{{ $province->id }}"
|
|
{{ old('province_id', $user->province_id) == $province->id ? 'selected' : '' }}>
|
|
{{ $province->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@error('province_id')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>شهر</label>
|
|
<select name="city_id" id="city_id" class="form-control">
|
|
<option value="">انتخاب شهر</option>
|
|
@foreach($cities as $city)
|
|
<option value="{{ $city->id }}"
|
|
{{ old('city_id', $user->city_id) == $city->id ? 'selected' : '' }}>
|
|
{{ $city->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@error('city_id')
|
|
<span class="text-danger">{{ $message }}</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<button type="submit" class="theme-btn mt-4">آپدیت مشخصات پروفایل <i class="far fa-user"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-12">
|
|
<div class="user-profile-card">
|
|
<h4 class="user-profile-card-title">عوض کردن رمز عبور</h4>
|
|
<div class="col-lg-12">
|
|
<div class="user-profile-form">
|
|
<form action="{{ route('accounts.edit-profile.change-password') }}" method="POST">
|
|
@csrf
|
|
<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
|
|
</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
|
|
</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>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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
|