added logic for updating user profile plus other bug fixes

This commit is contained in:
Kwesi Banson Jnr
2026-03-16 16:41:32 +00:00
parent 9cd017fb9a
commit 72180de8e4
30 changed files with 1346 additions and 49 deletions

View File

@@ -51,12 +51,14 @@
</head>
<body class="nav-md">
@include('systemusers.partials.profile')
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<img src="{{ url('public/assets/img/cml-final-3.png') }}" width="230px" height="70px" style="background-color: #fff;">
<div class="navbar nav_title" style="padding-top: 10px; padding-left: 15px;">
<!-- <img src="{{ url('public/assets/img/cml-logo.png') }}" style="background-color: #fff;"> -->
<img src="{{ url('public/assets/img/cml-final-3_no-bg.png') }}" width="200" style="background-color: #fff;">
<!-- <a href="{{ url('/') }}" class="site_title"><i class="fa fa-paw"></i>
<span>Click ERP</span>
</a> -->
@@ -143,11 +145,105 @@
<script src="{!! url('public/assets/vendors/bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js') !!}"></script>
<script src="{!! url('public/assets/js/jquery-confirm.min.js') !!}"></script>
<script>
$(document).ready(function(){
$('.profileLink').click(function(evt){
evt.preventDefault();
$.ajax({
type: "GET",
url: base_url + '/getprofile',
processData: false,
contentType: false,
async: false,
success: function (data){
if (data.code === 1) {
console.log(data);
$('.staffId').val(data.staff_member.id);
$('.staffName').val(data.staff_member.name);
$('.staffEmail').val(data.staff_member.email);
// $('.staffPhone').val(data.staff_member.status).change();
$('.staffPhone').val(data.staff_member.phone);
// $('.staffDesignation').val(data.staff_member.designation);
$('.staffDateAdded').val(data.staff_member.created_at);
$('#profileModal').modal('show');
}
else if (data.code > 1) {
$.alert({
title: 'Alert!',
content: data.msg,
});
}
else {
$.alert({
title: 'Alert!',
content: 'Your request could not be handled. Try again !',
});
}
}
});
});
$('#staffProfileForm').submit(function(evt){
evt.preventDefault(evt);
$('#successArea').addClass('d-none');
$('#errorsArea').removeClass('d-none');
var formData = new FormData($('#staffProfileForm')[0]);
$.ajax({
url: base_url + '/profileupdate',
type: 'POST',
data: formData,
processData: false,
contentType: false,
beforeSend: function() {
$('#successArea').text("");
$('#successArea').text("Please wait ... profile update in progress!");
},
success: function(data) {
if (data['code'] === 1) {
$('#successArea').removeClass('d-none');
$('#errorsArea').addClass('d-none');
$('#successArea').text("");
$('#successArea').text(data['msg']);
// location.reload();
$.alert({
title: 'Alert!',
content: data['msg'],
});
setTimeout(function() {
$('#profileModal').modal('hide');
//location.reload(); // Reloads the current page
}, 2000);
}
else{
$('#successArea').addClass('d-none');
$('#errorArea').removeClass('d-none');
$('#errorArea').text("");
$('#errorArea').text("Account could not be updated!");
$.alert({
title: 'Alert!',
content: 'Account could not updated!',
});
}
},
error: function(xhr, status, error) {
console.error('Error:', error);
$('#successArea').text(error);
$('#successArea').text(error);
$.alert({
title: 'Alert!',
content: error,
});
}
});
});
if ($('.notification-alert').length) {
setTimeout(() => {
$('.notification-alert').slideUp()
}, 2000);
}
});
</script>
@yield('javascript')
@@ -157,4 +253,7 @@
<script src="{!! url('public/assets/build/js/custom.js') !!}"></script>
</body>
</html>
</html>
1. User Service, 2. Payment Service 3. Notification Service 4. Transaction Service 5. Reporting Service.