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"> <form id="branch_edit_form" enctype="multipart/form-data">
<input type="hidden" id="branch_id" name="branch_id" value="<?php echo $branch['branch_id']; ?>"> <input type="hidden" id="branch_id" name="branch_id" value="<?php echo $branch['branch_id']; ?>">
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label for="old_password">Branch Name</label> <label for="old_password">Branch Name</label>
<div class="input-group"> <div class="input-group">
@ -63,6 +63,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-4">
<div class="form-group">
<label for="old_password">Contact 1</label>
<div class="input-group">
<input type="text" class="form-control" id="contact_1" name="contact_1" value="<?php echo $branch['contact_1']; ?>" required>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="old_password">Contact 2</label>
<div class="input-group">
<input type="text" class="form-control" id="contact_2" name="contact_2" value="<?php echo $branch['contact_2']; ?>" required>
</div>
</div>
</div>
<div class="col-md-5"> <div class="col-md-5">
<div class="form-group"> <div class="form-group">
<label for="old_password">Email</label> <label for="old_password">Email</label>
@ -71,23 +88,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-5">
<div class="form-group">
<label for="old_password">Contact 1</label>
<div class="input-group">
<input type="text" class="form-control" id="contact_1" name="contact_1" value="<?php echo $branch['contact_1']; ?>" required>
</div>
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<label for="old_password">Contact 2</label>
<div class="input-group">
<input type="text" class="form-control" id="contact_2" name="contact_2" value="<?php echo $branch['contact_2']; ?>" required>
</div>
</div>
</div>
<div class="col-md-6" style="margin-top: 27px;"> <div class="col-md-6" style="margin-top: 27px;">
</div> </div>
@ -132,7 +132,7 @@
</div> </div>
</div> </div>
<div class="col-md-12" style="margin-top: 27px;"> <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> </div>
</form> </form>
@ -154,38 +154,38 @@
$(document).ready(function() { $(document).ready(function() {
$('#submit_business').click(function(e) { $('#submit_business').click(function(e) {
e.preventDefault(); // Prevent the form from submitting normally e.preventDefault(); // Prevent the form from submitting normally
var form = document.getElementById('business_edit_form'); var form = document.getElementById('business_edit_form');
var formData = new FormData(form); var formData = new FormData(form);
$.ajax({ $.ajax({
url: '<?= base_url() ?>business_edit', url: '<?= base_url() ?>business_edit',
type: 'POST', type: 'POST',
data: formData, data: formData,
processData: false, // Prevent jQuery from automatically processing the data processData: false, // Prevent jQuery from automatically processing the data
contentType: false, // Prevent jQuery from automatically setting the content type contentType: false, // Prevent jQuery from automatically setting the content type
success: function(response) { success: function(response) {
console.log(response); console.log(response);
if (response) { if (response) {
window.location.reload(); window.location.reload();
} else { } else {
// Handle the case where the response indicates failure // Handle the case where the response indicates failure
alert('Update failed.'); 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 form = document.getElementById('branch_edit_form');
var formData = new FormData(form); var formData = new FormData(form);
@ -194,6 +194,8 @@
type: 'POST', type: 'POST',
data: formData, data: formData,
dataType: 'json', dataType: 'json',
processData: false, // Prevent jQuery from automatically processing the data
contentType: false,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
if (response) { if (response) {
@ -212,7 +214,9 @@
} }
}); });
} })
</script> </script>
<script> <script>
var oldPasswordField = document.getElementById("old_password"); var oldPasswordField = document.getElementById("old_password");

View File

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