feat: add profile image editing and update profile validation
This commit is contained in:
@@ -0,0 +1,259 @@
|
||||
<?php $__env->startSection('title' , 'ویرایش پروفایل'); ?>
|
||||
|
||||
<?php $__env->startSection('account-content'); ?>
|
||||
<div class="user-profile-wrapper">
|
||||
|
||||
<?php if(session('success')): ?>
|
||||
<div class="col-lg-12 mb-3">
|
||||
<div class="alert alert-success"><?php echo e(session('success')); ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if(session('error')): ?>
|
||||
<div class="col-lg-12 mb-3">
|
||||
<div class="alert alert-danger"><?php echo e(session('error')); ?></div>
|
||||
</div>
|
||||
<?php 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="<?php echo e(route('accounts.edit-profile.update')); ?>" method="POST" enctype="multipart/form-data">
|
||||
<?php echo csrf_field(); ?>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>نام </label>
|
||||
<input type="text" name="first_name" class="form-control"
|
||||
value="<?php echo e(old('first_name', $user->first_name)); ?>" placeholder="نام شما">
|
||||
<?php $__errorArgs = ['first_name'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger">
|
||||
<?php echo e($message); ?>
|
||||
|
||||
</span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>نام خانوادگی</label>
|
||||
<input type="text" name="last_name" class="form-control"
|
||||
value="<?php echo e(old('last_name', $user->last_name)); ?>" placeholder="نام خانوادگی">
|
||||
<?php $__errorArgs = ['last_name'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger"><?php echo e($message); ?></span> <?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>ایمیل</label>
|
||||
<input type="text" name="email" class="form-control"
|
||||
value="<?php echo e(old('email', $user->email)); ?>" placeholder="ایمیل">
|
||||
<?php $__errorArgs = ['email'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>موبایل</label>
|
||||
<input type="text" name="mobile" class="form-control"
|
||||
value="<?php echo e(old('mobile', $user->mobile)); ?>" placeholder="موبایل">
|
||||
<?php $__errorArgs = ['mobile'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</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>
|
||||
<?php $__currentLoopData = $provinces; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $province): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||
<option value="<?php echo e($province->id); ?>"
|
||||
<?php echo e(old('province_id', $user->province_id) == $province->id ? 'selected' : ''); ?>>
|
||||
<?php echo e($province->name); ?>
|
||||
|
||||
</option>
|
||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||
</select>
|
||||
<?php $__errorArgs = ['province_id'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</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>
|
||||
<?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||
<option value="<?php echo e($city->id); ?>"
|
||||
<?php echo e(old('city_id', $user->city_id) == $city->id ? 'selected' : ''); ?>>
|
||||
<?php echo e($city->name); ?>
|
||||
|
||||
</option>
|
||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||
</select>
|
||||
<?php $__errorArgs = ['city_id'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>عکس پروفایل</label>
|
||||
<input type="file" name="avatar" class="form-control" accept="image/*">
|
||||
<?php $__errorArgs = ['avatar'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</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="<?php echo e(route('accounts.edit-profile.change-password')); ?>" method="POST">
|
||||
<?php echo csrf_field(); ?>
|
||||
<div class="form-group">
|
||||
<label>رمز عبور فعلی</label>
|
||||
<input type="password" name="current_password" class="form-control"
|
||||
placeholder="رمز عبور فعلی">
|
||||
<?php $__errorArgs = ['current_password'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>رمز عبور جدید</label>
|
||||
<input type="password" name="new_password" class="form-control"
|
||||
placeholder="رمز عبور جدید">
|
||||
<?php $__errorArgs = ['new_password'];
|
||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
||||
if ($__bag->has($__errorArgs[0])) :
|
||||
if (isset($message)) { $__messageOriginal = $message; }
|
||||
$message = $__bag->first($__errorArgs[0]); ?>
|
||||
<span class="text-danger"><?php echo e($message); ?></span>
|
||||
<?php unset($message);
|
||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
||||
endif;
|
||||
unset($__errorArgs, $__bag); ?>
|
||||
</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>
|
||||
<?php $__env->stopSection(); ?>
|
||||
<?php $__env->startPush('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: "<?php echo e(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>
|
||||
<?php $__env->stopPush(); ?>
|
||||
|
||||
<?php echo $__env->make('account.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\ASUS\Desktop\airline-agency\resources\views/account/edit-profile.blade.php ENDPATH**/ ?>
|
||||
Reference in New Issue
Block a user