450 lines
16 KiB
PHP
Executable File
450 lines
16 KiB
PHP
Executable File
<style>
|
|
|
|
body {
|
|
.multiselect-native-select {
|
|
position: relative;
|
|
/* bottom: 32px; */
|
|
select {
|
|
border: 0 !important;
|
|
clip: rect(0 0 0 0) !important;
|
|
height: 1px !important;
|
|
margin: -1px -1px -1px -3px !important;
|
|
overflow: hidden !important;
|
|
padding: 0 !important;
|
|
position: absolute !important;
|
|
width: 1px !important;
|
|
left: 50%;
|
|
top: 30px;
|
|
}
|
|
}
|
|
|
|
.multiselect-container{
|
|
width: 100% !important;
|
|
}
|
|
|
|
.multiselect-selected-text{
|
|
float: left !important;
|
|
}
|
|
|
|
}
|
|
|
|
.navtab-bg .nav-link {
|
|
margin: 0 5px 10px!important;
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
<div class="row" id="client_add">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row" style="padding-bottom: 10px;">
|
|
<div class="col-6" style="align-self: center;">
|
|
<h4 style="position: relative;">Client Onboarding <span id="client_heading"><?php if (isset($client)) { echo ' - ' . $client['client_name']; } ?></span> </h4>
|
|
</div>
|
|
<div class="col-6" style="text-align: right;">
|
|
<a href="<?= base_url("client/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
|
|
<ul class="nav nav-pills navtab-bg">
|
|
<li class="nav-item">
|
|
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
|
class="nav-link px-3 py-2 active" id="general_tab">
|
|
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
|
<span class="d-none d-sm-inline-block">General</span>
|
|
</a>
|
|
</li>
|
|
<!-- <li class="nav-item">
|
|
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
|
|
<span class="mr-1"><i class="fa fa-file"></i></span>
|
|
<span class="d-none d-sm-inline-block">KYC Docs</span>
|
|
</a>
|
|
</li> -->
|
|
<!-- <li class="nav-item">
|
|
<a href="#RM-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="RM_tab">
|
|
<span class="mr-1"><i class="mdi mdi-account-switch"></i></span>
|
|
<span class="d-none d-sm-inline-block"> Relationship Manager</span>
|
|
</a>
|
|
</li> -->
|
|
<li class="nav-item">
|
|
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="branch_tab">
|
|
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
|
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#notification-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="notification_tab">
|
|
<span class="mr-1"><i class="mdi mdi-bell"></i></span>
|
|
<span class="d-none d-sm-inline-block">Notifications</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#police-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_tab">
|
|
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
|
<span class="d-none d-sm-inline-block">Policies</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#others-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="others_tab">
|
|
<span class="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
|
|
<span class="d-none d-sm-inline-block">Others</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content">
|
|
<?php include('client_others_tab.php'); ?>
|
|
<?php include('notification.php'); ?>
|
|
<?php include('client_basic_info.php'); ?>
|
|
<!-- <?php // include('client_kyc.php'); ?> -->
|
|
<!-- <?php // include('client_rm.php'); ?> -->
|
|
<?php include('client_branch.php'); ?>
|
|
<?php include('client_policy.php'); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="modal fade" id="autoFetchBranchModal" tabindex="-1" role="dialog" aria-labelledby="autoFetchBranchModalLabel" accesskey=""
|
|
aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered" style="margin-left: 400px !important;">
|
|
<div class="modal-content modal-lg">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="autoFetchBranchModalLabel">Fetch Client Branch (Post-Enrolment)</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body" style="min-height:auto !important;">
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group col-md-12">
|
|
<label for="auto_fetch_client">Client List<span class="text-danger">*</span></label>
|
|
<select class="form-control select2" id="auto_fetch_client" name="auto_fetch_client" required>
|
|
<option value="">Select Client</option>
|
|
<?php if (!empty($auto_fetch_client_list)): ?>
|
|
<?php foreach ($auto_fetch_client_list as $client_list): ?>
|
|
<option value="<?= esc($client_list['id']) ?>">
|
|
<?= esc($client_list['client_name']) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="form-group col-md-12">
|
|
<label for="auto_fetch_branch">Branch List<span class="text-danger">*</span></label>
|
|
<select class="form-control select2" id="auto_fetch_branch" name="auto_fetch_branch" required>
|
|
<option value="">Select Branch</option>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn cancel-btn" data-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-primary submit-btn" id="submitAutoFetch">Submit</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
// $(document).ready(function(){
|
|
// var tabid = localStorage.getItem('tabId');
|
|
// console.log(tabid)
|
|
// $('#'+tabid).click();
|
|
// localStorage.removeItem('tabId')
|
|
// })
|
|
|
|
|
|
// $('#general_tab').click( function (){
|
|
// localStorage.setItem('tabId', 'general_tab')
|
|
// })
|
|
|
|
// $('#KYC-DOC-tab').click( function (){
|
|
// localStorage.setItem('tabId', 'kyc_tab')
|
|
// })
|
|
// $('#RM_tab').click( function (){
|
|
// localStorage.setItem('tabId', 'RM_tab')
|
|
// })
|
|
// $('#branch_tab').click( function (){
|
|
// localStorage.setItem('tabId', 'branch_tab')
|
|
// })
|
|
// $('#policy_tab').click( function (){
|
|
// localStorage.setItem('tabId', 'policy_tab')
|
|
// })
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
function client_kyc_docs() {
|
|
var check_client_id = $('#general_PrimaryKey');
|
|
|
|
|
|
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
|
$('#btnBranchAdd').hide();
|
|
toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000});
|
|
}else{
|
|
if ($('#btnBranchBack')[0].style.display == 'none') {
|
|
$('#btnBranchAdd').show();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function client_relationship_manager() {
|
|
var check_client_id = $('#general_PrimaryKey');
|
|
|
|
|
|
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
|
$('#relation_form').hide();
|
|
toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000});
|
|
}else{
|
|
$('#relation_form').show();
|
|
}
|
|
|
|
}
|
|
|
|
function client_policies() {
|
|
var check_client_id = $('#general_PrimaryKey');
|
|
|
|
|
|
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
|
$('#BtnAdd').hide();
|
|
toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000});
|
|
}else{
|
|
if ($('#btnPolicyBack')[0].style.display == 'none') {
|
|
$('#BtnAdd').show();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function client_branch_contact() {
|
|
var check_client_id = $('#general_PrimaryKey');
|
|
|
|
|
|
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
|
$('#btnBranchAdd').hide();
|
|
toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000});
|
|
}else{
|
|
if ($('#btnBranchBack')[0].style.display == 'none') {
|
|
$('#btnBranchAdd').show();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function client_notification() {
|
|
var check_client_id = $('#general_PrimaryKey');
|
|
|
|
|
|
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
|
$('#notification-tab').hide();
|
|
toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000});
|
|
}else{
|
|
if ($('#notification-tab')[0].style.display == 'none') {
|
|
$('#notification-tab').show();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById("kyc_tab").addEventListener("click", function(event) {
|
|
event.preventDefault();
|
|
client_kyc_docs();
|
|
});
|
|
|
|
|
|
document.getElementById("RM_tab").addEventListener("click", function(event) {
|
|
event.preventDefault();
|
|
client_relationship_manager();
|
|
});
|
|
|
|
|
|
document.getElementById("policy_tab").addEventListener("click", function(event) {
|
|
event.preventDefault();
|
|
client_policies();
|
|
});
|
|
|
|
|
|
document.getElementById("branch_tab").addEventListener("click", function(event) {
|
|
event.preventDefault();
|
|
client_branch_contact();
|
|
});
|
|
|
|
document.getElementById("notification_tab").addEventListener("click", function(event) {
|
|
event.preventDefault();
|
|
client_notification();
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
$('#btnAutoBranchFetch').click(function() {
|
|
|
|
var myModal = new bootstrap.Modal(document.getElementById('autoFetchBranchModal'));
|
|
myModal.show();
|
|
|
|
|
|
})
|
|
</script>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#auto_fetch_client').select2();
|
|
$('#auto_fetch_branch').select2();
|
|
|
|
$('#auto_fetch_client').change(function() {
|
|
|
|
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
|
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
$.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>`;
|
|
|
|
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() {
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
console.log("auto_fetch_client call is completed..!!");
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<script>
|
|
$('#submitAutoFetch').click(function() {
|
|
|
|
let client_id = $('#auto_fetch_client').val();
|
|
let branch_id = $('#auto_fetch_branch').val();
|
|
|
|
if (client_id == "" || branch_id == "") {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Missing Data',
|
|
text: 'Please select both Client and its Branch!',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
|
|
return;
|
|
}
|
|
|
|
$.ajax({
|
|
url: "<?php echo base_url('client/branch/auto_fetch_branch_details'); ?>",
|
|
type: "POST",
|
|
data: {
|
|
client_id,
|
|
branch_id
|
|
},
|
|
dataType: "json",
|
|
success: function(response, textStatus, xhr) {
|
|
if (xhr.status === 200) {
|
|
|
|
let result = response.data[0]??[];
|
|
|
|
if(response.data[0] == []){
|
|
console.log("Empty array ..!!!");
|
|
return;
|
|
}
|
|
|
|
let units = JSON.parse(result['units']);
|
|
|
|
let $select = $('#selected');
|
|
$select.empty();
|
|
|
|
units.forEach(unit => {
|
|
// If you want to mark them as selected, set 'selected' attribute
|
|
$select.append(`<option value="${unit}" selected>${unit}</option>`);
|
|
});
|
|
|
|
|
|
|
|
$('#post_branch_id').val(branch_id);
|
|
$('#branch_name').val(result['branch_name']??'');
|
|
$('#branch_code').val(result['branch_code']??'');
|
|
$('#address1').val(result['address1']??'');
|
|
$('#address2').val(result['address2']??'');
|
|
$('#state').val(result['state']??'');
|
|
$('#district').val(result['district']??'');
|
|
$('#branch_city').val(result['city']??'');
|
|
$('#pincode').val(result['pincode']??'');
|
|
$('#gst').val(result['gst']??'');
|
|
$('#sez').val(result['sez']??'');
|
|
|
|
} else {
|
|
console.log("User Error thrown");
|
|
console.log("status" + xhr.status);
|
|
}
|
|
|
|
closeModalById('autoFetchBranchModal');
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error("Error occurred:", status, error);
|
|
},
|
|
complete: function() {
|
|
console.log("auto_fetch_branch_details call is completed..!!");
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
})
|
|
</script>
|
|
|
|
|