CHANGE_UI_FIX - VADIVEL J 2025-10-09
This commit is contained in:
parent
51b74549ac
commit
11bef9921f
@ -1043,38 +1043,47 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#auto_fetch_client').change(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
||||
$('#auto_fetch_client').select2();
|
||||
$('#auto_fetch_branch').select2();
|
||||
|
||||
$('#auto_fetch_client').change(function() {
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
client_id: $('#auto_fetch_client').val()
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(response, textStatus, xhr) {
|
||||
if (xhr.status === 200) {
|
||||
let options = `<option value="">Select Branch</option>`;
|
||||
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
||||
|
||||
response.data.forEach((data) => {
|
||||
options += `<option value="${data.id}">${data.branch_name}</option>`;
|
||||
});
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
client_id: $('#auto_fetch_client').val()
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(response, textStatus, xhr) {
|
||||
if (xhr.status === 200) {
|
||||
let options = `<option value="">Select Branch</option>`;
|
||||
|
||||
$('#auto_fetch_branch').html(options);
|
||||
} else {
|
||||
$('#auto_fetch_branch').html('<option value="">No Branch Found</option>');
|
||||
response.data.forEach((data) => {
|
||||
options += `<option value="${data.id}">${data.branch_name}</option>`;
|
||||
});
|
||||
|
||||
$('#auto_fetch_branch').html(options);
|
||||
} else {
|
||||
$('#auto_fetch_branch').html('<option value="">No Branch Found</option>');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("Error occurred:", status, error);
|
||||
},
|
||||
complete: function() {
|
||||
console.log("auto_fetch_client call is completed..!!");
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("Error occurred:", status, error);
|
||||
},
|
||||
complete: function() {
|
||||
console.log("auto_fetch_client call is completed..!!");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@ -1158,8 +1167,5 @@
|
||||
})
|
||||
|
||||
|
||||
$(function() {
|
||||
$('.select2').select2();
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user