| Server IP : 138.197.107.151 / Your IP : 216.73.217.7 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/silversharkadmindev/resources/views/profile/ |
Upload File : |
@extends('layouts.app',['title'=>"Edit profile"])
@section('content')
<div class="main-content" id="result">
<div class="page-content edit-profile">
<div class="container-fluid">
<div class="row">
{{-- @include("partials.messages.messages") --}}
<div class="col-lg-8 offset-lg-2">
<h4 class="mb-4 mt-50">Edit Profile</h4>
</div>
</div>
<div class="row">
<div class="col-lg-8 offset-lg-2">
{{-- Profile Form --}}
<div class="card mb-4">
<div class="card-body">
<form id="profile_form" method="POST" action="{{ route('profile.update') }}">
@csrf
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name"
value="{{ old('name', $user->name) }}" required>
</div>
<div class="mb-3">
<label for="name" class="form-label">Email</label>
<input type="text" readonly class="form-control" id="email" name="email"
value="{{ old('email', $user->email) }}" required>
</div>
<div class="mb-3">
<label for="phone" class="form-label">Phone</label><br/>
<input type="text" class="form-control" id="phone" name="phone"
value="{{ old('phone', $user->phone) }}">
<input class="form-control" type="hidden" name="phone_full" id="phone_full" value="{{ old('phone_full') }}" >
</div>
<button type="submit" id="submitBtn" class="btn btn-primary button-text">Update Profile</button>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8 offset-lg-2">
<h4 class="mb-4">Change Password</h4>
</div>
</div>
<div class="row">
<div class="col-lg-8 offset-lg-2">
{{-- Change Password Form --}}
<div class="card">
<div class="card-body">
<form id="formChangePassword" method="POST" action="{{ route('profile.changePassword') }}">
@csrf
<div class="mb-3">
<label for="old_password" class="form-label">Old Password</label>
<div class="form-group position-relative pass_field">
<input type="password" class="form-control" id="old_password" name="old_password" required>
<button type="button" class="btn btn-light position-absolute end-0 top-0 toggle-password btn-border" tabindex="-1"><i
class="mdi mdi-eye-outline"></i></button>
</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">New Password</label>
<div class="form-group position-relative pass_field">
<input type="password" class="form-control" id="password" name="password" required>
<button type="button" class="btn btn-light position-absolute end-0 top-0 toggle-password btn-border" tabindex="-1"><i
class="mdi mdi-eye-outline"></i></button>
</div>
</div>
<div class="mb-3">
<label for="password_confirmation" class="form-label">Confirm New Password</label>
<div class="form-group position-relative pass_field">
<input type="password" class="form-control" id="password_confirmation" name="password_confirmation" required>
<button type="button" class="btn btn-light position-absolute end-0 top-0 toggle-password btn-border" tabindex="-1"><i
class="mdi mdi-eye-outline"></i></button>
</div>
</div>
<button type="submit" id="submitPasswordBtn" class="btn btn-primary button-text">Change Password</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('topcss')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.3.1/build/css/intlTelInput.css"/>
@endpush
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.3.1/build/js/intlTelInput.min.js"></script>
<script>
$(document).ready(function() {
$(".toggle-password").click(function() {
let input = $(this).closest(".pass_field").find("input");
let icon = $(this).closest(".pass_field").find("i");
if (input.attr("type") === "password") {
input.attr("type", "text");
icon.removeClass("mdi-eye-outline").addClass("mdi-eye-off-outline");
} else {
input.attr("type", "password");
icon.removeClass("mdi-eye-off-outline").addClass("mdi-eye-outline");
}
});
});
</script>
<script>
var input = document.querySelector("#phone");
var iti = window.intlTelInput(input, {
separateDialCode: true,
strictMode: true,
countryOrder: ["us", "in", "gb"], // USA, India, UK
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.3.1/build/js/utils.js"),
});
// On submit, get the full international number
$('#profile_form').on('submit', function(e) {
//e.preventDefault();
let phoneNumber = iti.getNumber(); // e.g., +919812345678
$('#phone_full').val(phoneNumber); // overwrite input value with full number
//document.getElementById('submitBtn').disabled = true;
});
$('#formChangePassword').on('submit', function(e) {
//document.getElementById('submitPasswordBtn').disabled = true;
});
</script>
<script>
$('#profile_form').on('submit', function(e) {
//e.preventDefault();
let phoneNumber = iti.getNumber(); // e.g., +919812345678
$('#phone_full').val(phoneNumber); // overwrite input value with full number
document.getElementById('submitBtn').disabled = true;
});
$('#formChangePassword').on('submit', function(e) {
document.getElementById('submitPasswordBtn').disabled = true;
});
</script>
<script src="{{ asset('assets/validate/jquery.validate.min.js')}}"></script>
<script type="text/javascript">
$(function() {
jQuery.validator.addMethod("fullname", function(value, element) {
return this.optional(element) || /^[A-Za-z]+(?:\s[A-Za-z]+)?$/.test(value);
}, "Please enter a valid name.");
$("#profile_form").validate({
submitHandler: function(form) {
// Disable button to prevent duplicate submissions
$("#submitBtn").prop("disabled", true);
form.submit(); // submit the form after disabling
},
rules: {
name: {
required: true,
fullname: true,
minlength: 3
}
},
messages: {
name: {
required: "This field is required.",
minlength: "Full name must be at least 3 characters."
}
}
})
$("#formChangePassword").validate({
submitHandler: function(form) {
// Disable button to prevent duplicate submissions
$("#submitBtn").prop("disabled", true);
form.submit(); // submit the form after disabling
},
rules: {
old_password:{
required:true
},
password: {
required: true,
minlength: 6
},
password_confirmation: {
required: true,
minlength: 6,
equalTo: "#password" // must match password
}
},
messages: {
password: {
required: "This field is required.",
minlength: "New password must be at least 6 characters long."
},
password_confirmation: {
required: "This field is required.",
minlength: "Password must be at least 6 characters long.",
equalTo: "New password and confirm password do not match."
}
}
})
});
</script>
@endpush