CHANGE_ADMIN_BUSINESS_AND_BRANCH_CORRECT : AADHAVAN

This commit is contained in:
aadhavan valli 2024-06-05 15:02:30 +05:30
parent f8d2769d99
commit 78076bb786
2 changed files with 44 additions and 40 deletions

View File

@ -55,7 +55,7 @@
<form id="branch_edit_form" enctype="multipart/form-data">
<input type="hidden" id="branch_id" name="branch_id" value="<?php echo $branch['branch_id']; ?>">
<div class="row">
<div class="col-md-5">
<div class="col-md-4">
<div class="form-group">
<label for="old_password">Branch Name</label>
<div class="input-group">
@ -63,15 +63,8 @@
</div>
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<label for="old_password">Email</label>
<div class="input-group">
<input type="text" class="form-control" id="email" name="email" value="<?php echo $branch['branch_name']; ?>" required>
</div>
</div>
</div>
<div class="col-md-5">
<div class="col-md-4">
<div class="form-group">
<label for="old_password">Contact 1</label>
<div class="input-group">
@ -79,7 +72,7 @@
</div>
</div>
</div>
<div class="col-md-5">
<div class="col-md-4">
<div class="form-group">
<label for="old_password">Contact 2</label>
<div class="input-group">
@ -87,7 +80,14 @@
</div>
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<label for="old_password">Email</label>
<div class="input-group">
<input type="text" class="form-control" id="email" name="email" value="<?php echo $branch['branch_name']; ?>" required>
</div>
</div>
</div>
<div class="col-md-6" style="margin-top: 27px;">
</div>
@ -132,7 +132,7 @@
</div>
</div>
<div class="col-md-12" style="margin-top: 27px;">
<button type="button" class="btn btn-primary" id="submit_password" style="float: inline-end;" onclick="changePassword(this)">Submit</button>
<button type="button" class="btn btn-primary" id="submit_branch" style="float: inline-end;">Submit</button>
</div>
</form>
@ -154,39 +154,39 @@
$(document).ready(function() {
$('#submit_business').click(function(e) {
e.preventDefault(); // Prevent the form from submitting normally
$('#submit_business').click(function(e) {
e.preventDefault(); // Prevent the form from submitting normally
var form = document.getElementById('business_edit_form');
var formData = new FormData(form);
var form = document.getElementById('business_edit_form');
var formData = new FormData(form);
$.ajax({
url: '<?= base_url() ?>business_edit',
type: 'POST',
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Prevent jQuery from automatically setting the content type
success: function(response) {
console.log(response);
if (response) {
window.location.reload();
} else {
// Handle the case where the response indicates failure
alert('Update failed.');
$.ajax({
url: '<?= base_url() ?>business_edit',
type: 'POST',
data: formData,
processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Prevent jQuery from automatically setting the content type
success: function(response) {
console.log(response);
if (response) {
window.location.reload();
} else {
// Handle the case where the response indicates failure
alert('Update failed.');
}
},
error: function(xhr, status, error) {
// Handle errors here
console.error(xhr.responseText);
}
},
error: function(xhr, status, error) {
// Handle errors here
console.error(xhr.responseText);
}
});
});
});
});
function changePassword(params) {
$('#submit_branch').click(function(e) {
e.preventDefault();
var form = document.getElementById('branch_edit_form');
var formData = new FormData(form);
$.ajax({
@ -194,6 +194,8 @@
type: 'POST',
data: formData,
dataType: 'json',
processData: false, // Prevent jQuery from automatically processing the data
contentType: false,
success: function(response) {
console.log(response);
if (response) {
@ -211,8 +213,10 @@
console.error(xhr.responseText);
}
});
})
}
</script>
<script>
var oldPasswordField = document.getElementById("old_password");

View File

@ -25,7 +25,7 @@
<div class="col-8">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"><?php echo $docData->service_name; ?>
<a class="btn btn-primary download-btn">
<a >
<i class="fas fa-download"></i>
</a>
</h4>