682 lines
25 KiB
PHP
Executable File
682 lines
25 KiB
PHP
Executable File
|
||
<style>
|
||
/* .table th,
|
||
.table td {
|
||
padding: 8px;
|
||
}
|
||
|
||
table.dataTable tbody td {
|
||
padding: 4px 4px !important;
|
||
}
|
||
|
||
table.dataTable thead th {
|
||
padding: 4px 4px !important;
|
||
} */
|
||
|
||
.col-12{
|
||
|
||
max-width: 98% !important;
|
||
}
|
||
|
||
.btn-filter{
|
||
margin-left: 20px !important;
|
||
}
|
||
|
||
.custom-dropdown-menu {
|
||
display: none;
|
||
position: absolute;
|
||
background-color: #ffffff !important;
|
||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||
border-radius: 0.25rem;
|
||
padding: 0.5rem 0;
|
||
min-width: 10rem;
|
||
z-index: 9999;
|
||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||
}
|
||
|
||
.custom-dropdown-menu .dropdown-item {
|
||
display: block !important;
|
||
width: 100% !important;
|
||
padding: 0.5rem 1rem !important;
|
||
color: #212529 !important;
|
||
text-decoration: none !important;
|
||
background-color: transparent !important;
|
||
}
|
||
|
||
.custom-dropdown-menu .dropdown-item:hover {
|
||
background-color: #f8f9fa !important;
|
||
color: #16181b !important;
|
||
cursor: pointer !important;
|
||
}
|
||
|
||
|
||
|
||
.add-from-lead{
|
||
color:#E26828;
|
||
border : 0px solid white ;
|
||
background-color: white;
|
||
text-decoration: underline ;
|
||
}
|
||
|
||
.add-from-lead:hover{
|
||
color:#E26828;
|
||
border : 0px solid white ;
|
||
background-color: white;
|
||
text-decoration: underline ;
|
||
}
|
||
|
||
.dataTables_length label {height: 21px !important;}
|
||
|
||
|
||
|
||
|
||
</style>
|
||
|
||
<div class="row" id="client_list">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<!-- <div class="row" style="margin-bottom:1rem;">-->
|
||
<!-- <div class="col-6" style="align-self: center;">
|
||
<h4 style="position: relative;">Client</h4>
|
||
</div> -->
|
||
<!-- <div class="col-2" style="text-align: right; position: relative;top: 56px; left: 303px;">
|
||
<a class="btn btn-primary waves-effect waves-light" onclick="showModal()">Add From Lead</a>
|
||
</div>
|
||
<div class="col-1" style="text-align: right; position: relative;top: 56px; left: 294px;">
|
||
<a href="<?= base_url("client/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">Add</a>
|
||
</div> -->
|
||
<!-- </div>-->
|
||
<table data-custom-table-css="table" class="table mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||
<thead class="bg-light">
|
||
<tr>
|
||
<th class="font-weight-medium">S.No </th>
|
||
<th class="font-weight-medium">Client Name </th>
|
||
<th class="font-weight-medium">Account Manager </th>
|
||
<th class="font-weight-medium">Action </th>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody>
|
||
<?php foreach($clientList as $index => $row){ ?>
|
||
<tr >
|
||
<td class="text-center"><?=$index+1?></td>
|
||
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
|
||
<!-- <td>
|
||
<?php $account_managers = ''; ?>
|
||
<?php foreach ($client_rm as $client): ?>
|
||
<?php if ($client->client_id == $row->id): ?>
|
||
<?php $account_managers .= $client->account_manager . ', '; ?>
|
||
<?php endif; ?>
|
||
<?php endforeach; ?>
|
||
<?php
|
||
$account_managers = rtrim($account_managers, ', ');
|
||
echo $account_managers !== '' ? $account_managers : 'N/A'; ?>
|
||
</td> -->
|
||
<td>
|
||
<?= $row->account_managers ?>
|
||
</td>
|
||
<td>
|
||
<div class="btn-group dropdown">
|
||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||
<div class="dropdown-menu dropdown-menu-right">
|
||
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions</a>
|
||
<?php if(in_array(get_role_id(), [1, 5])) { ?>
|
||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||
<?php } ?>
|
||
</div>
|
||
</div>
|
||
</td>
|
||
|
||
</tr>
|
||
|
||
<?php } ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div><!-- end col -->
|
||
</div>
|
||
<!-- end row -->
|
||
|
||
|
||
<div id="append_client_info"></div>
|
||
|
||
|
||
<!-- Center modal content -->
|
||
<div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||
<div class="modal-dialog modal-dialog-centered">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="myCenterModalLabel">Lead List</h4>
|
||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
|
||
<div class="form-group col-md-12">
|
||
<label for="lead_id"> Lead List <span class="text-danger">*</span></label>
|
||
<select class="form-control" id="lead_id" name="lead_id" required>
|
||
<option value="">Select Lead</option>
|
||
<?php if(isset($lead_data)) { ?>
|
||
<?php foreach ($lead_data as $value) { ?>
|
||
<option value="<?= $value['id']?>"><?= $value['client_name'] ?> - <?= $value['branch_name'] ?> - <?= $value['user_name'] ?></option>
|
||
<?php } ?>
|
||
<?php } ?>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||
<button type="submit" class="btn btn-primary" onclick="featchClient()">Fetch Client</button>
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div>
|
||
</div>
|
||
<!-- /.modal -->
|
||
|
||
<script>
|
||
document.addEventListener("DOMContentLoaded", function () {
|
||
const table = document.getElementById("tickets-table");
|
||
|
||
// Create custom dropdown
|
||
function createCustomDropdown(row) {
|
||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||
if (!originalDropdown) return null;
|
||
|
||
const customDropdown = document.createElement('div');
|
||
customDropdown.className = 'custom-dropdown-menu';
|
||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||
|
||
// Add 'Open Client Details' option in the dropdown
|
||
const clientId = row.querySelector('.client_info').dataset.id;
|
||
const openDetailsOption = document.createElement('a');
|
||
openDetailsOption.href = "javascript:void(0);";
|
||
openDetailsOption.className = 'dropdown-item';
|
||
openDetailsOption.innerHTML = `<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>Open Client Details`;
|
||
|
||
openDetailsOption.addEventListener('click', function() {
|
||
openClientDetailsPage(clientId); // Open the client details page when clicked
|
||
});
|
||
|
||
customDropdown.appendChild(openDetailsOption);
|
||
|
||
return customDropdown;
|
||
}
|
||
|
||
let activeDropdown = null;
|
||
|
||
// Add click event listener to rows
|
||
table.querySelectorAll("tbody tr").forEach(row => {
|
||
const customDropdown = createCustomDropdown(row);
|
||
if (!customDropdown) return;
|
||
|
||
document.body.appendChild(customDropdown);
|
||
|
||
row.addEventListener("click", function(event) {
|
||
// Ignore clicks on the action column
|
||
if (event.target.closest('td:last-child')) {
|
||
return;
|
||
}
|
||
|
||
// Show the action dropdown
|
||
if (activeDropdown) {
|
||
activeDropdown.style.display = 'none';
|
||
}
|
||
|
||
const rect = event.target.getBoundingClientRect();
|
||
customDropdown.style.display = 'block';
|
||
customDropdown.style.position = 'fixed';
|
||
customDropdown.style.left = `${rect.left}px`;
|
||
customDropdown.style.top = `${rect.bottom + 5}px`; // 5px gap
|
||
|
||
activeDropdown = customDropdown;
|
||
event.stopPropagation();
|
||
});
|
||
|
||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||
item.addEventListener('click', function(e) {
|
||
e.preventDefault();
|
||
const onclickAttr = this.getAttribute('onclick');
|
||
if (onclickAttr) {
|
||
eval(onclickAttr);
|
||
}
|
||
|
||
const href = this.getAttribute('href');
|
||
if (href && href !== '#') {
|
||
window.location.href = href;
|
||
}
|
||
|
||
if (activeDropdown) {
|
||
activeDropdown.style.display = 'none';
|
||
activeDropdown = null;
|
||
}
|
||
|
||
e.stopPropagation();
|
||
});
|
||
});
|
||
});
|
||
|
||
// Close dropdown when clicking outside
|
||
document.addEventListener("click", function() {
|
||
if (activeDropdown) {
|
||
activeDropdown.style.display = 'none';
|
||
activeDropdown = null;
|
||
}
|
||
});
|
||
|
||
// Open client details page
|
||
function openClientDetailsPage(clientId) {
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
$.ajax({
|
||
url: "<?= base_url('util/get-client-details/') ?>" + clientId,
|
||
type: "GET",
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
$('#append_client_info').empty().append(res.data);
|
||
$('#client_info').show();
|
||
$('#client_list').hide();
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
</script>
|
||
|
||
<script>
|
||
|
||
$(document).ready(function(){
|
||
$('#lead_id').select2();
|
||
})
|
||
var table;
|
||
$(document).ready(function()
|
||
{
|
||
table = $('#tickets-table').DataTable({
|
||
// dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
||
// "<'row'<'col-sm-12'tr>>" +
|
||
// "<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||
dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
||
"<'row'<'col-sm-12'tr>>" +
|
||
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||
buttons: [
|
||
{
|
||
text: 'Add From Opportunities',
|
||
className: 'btn-filter add-from-lead', // custom class
|
||
action: function(e, dt, node, config) {
|
||
showModal();
|
||
}
|
||
},
|
||
{
|
||
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Add </span>',
|
||
className: 'btn app-btn-primary mr-2',
|
||
action: function(e, dt, node, config) {
|
||
addClient();
|
||
}
|
||
},
|
||
{
|
||
extend: 'collection',
|
||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||
className: 'btn app-btn-secondary ',
|
||
buttons: [
|
||
{
|
||
extend: 'csv',
|
||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||
title: 'Client-List',
|
||
// title: function() {
|
||
// return $('#toggleButtons').is(':checked')
|
||
// ? 'GC-Client-List'
|
||
// : 'RC-Client-List';
|
||
// },
|
||
className: 'app-btn-primary ',
|
||
exportOptions: {
|
||
columns: ':not(:last-child)'
|
||
},
|
||
}
|
||
]
|
||
}
|
||
],
|
||
language: {
|
||
search: `
|
||
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
|
||
_INPUT_
|
||
<i class="mdi mdi-magnify datatable-search-icon"
|
||
style="position:absolute; right:11px; top:50%; transform:translateY(-53%); color:#666;"></i>
|
||
<i class="mdi mdi-close-circle datatable-clear-icon"
|
||
style="position:absolute; right:11px; top:50%; transform:translateY(-53%); color:#666; display:none;"></i>
|
||
</div>`,
|
||
searchPlaceholder: "Search",
|
||
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||
},
|
||
paging: true ,
|
||
// pagingType: 'full_numbers'
|
||
});
|
||
|
||
// $(".datatable-buttons").prepend(`
|
||
// <label class="switch">
|
||
// <input type="checkbox" id="toggleButtons">
|
||
// <span">Group</span>
|
||
// </label>
|
||
// `);
|
||
|
||
$(".datatable-buttons").prepend(`
|
||
<span id="statusSwitchWrapper" class="dt-switch-wrapper">
|
||
<span class="custom-switch" style="text-align: left;">
|
||
<input type="checkbox" class="custom-control-input" id="toggleButtons" checked>
|
||
<label class="custom-control-label" for="toggleButtons" style="vertical-align: middle !important;">Group Client</label>
|
||
</span>
|
||
</span>
|
||
`);
|
||
|
||
$('#toggleButtons').on('change', function() {
|
||
let type = $(this).is(':checked') ? 1 : 2;
|
||
let url = '<?= base_url('client/typeList/') ?>' + type;
|
||
|
||
$('.loader').fadeIn(); // Show loader during AJAX
|
||
|
||
$.ajax({
|
||
url: url,
|
||
method: 'GET',
|
||
success: function(response) {
|
||
$('.loader').fadeOut();
|
||
// Pass response.data directly to the function
|
||
if (response.status === "success") {
|
||
renderRows(response.data);
|
||
} else {
|
||
// If the structure is slightly different, pass the whole object
|
||
renderRows(response);
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
$('.loader').fadeOut();
|
||
console.error("Error loading:", error);
|
||
renderRows([]);
|
||
}
|
||
});
|
||
});
|
||
|
||
})
|
||
|
||
function renderRows(incomingData) {
|
||
|
||
let actualList = [];
|
||
if (incomingData && incomingData.clientList) {
|
||
actualList = incomingData.clientList;
|
||
} else if (Array.isArray(incomingData)) {
|
||
actualList = incomingData;
|
||
}
|
||
|
||
|
||
table.clear();
|
||
|
||
if (actualList.length > 0) {
|
||
actualList.forEach((row, index) => {
|
||
|
||
let rowData = [
|
||
index + 1,
|
||
`<span class="client_info" data-id="${row.id}">${row.client_name} (${row.short_name})</span>`,
|
||
row.account_managers || "N/A",
|
||
`<div class="btn-group dropdown">
|
||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown">
|
||
<i class="mdi mdi-dots-horizontal"></i>
|
||
</a>
|
||
<div class="dropdown-menu dropdown-menu-right">
|
||
<a class="dropdown-item" href="<?= base_url("client/list/") ?>${row.id}">
|
||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||
</a>
|
||
<a class="dropdown-item" href="<?= base_url("client/deposit/") ?>${row.id}">
|
||
<i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions
|
||
</a>
|
||
<?php if(in_array(get_role_id(), [1, 5])) { ?>
|
||
<a class="dropdown-item" data-id="${row.id}" onclick="removeClient(this)">
|
||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||
</a>
|
||
<?php } ?>
|
||
</div>
|
||
</div>`
|
||
];
|
||
|
||
let newRow = table.row.add(rowData);
|
||
$(newRow.node()).find('td:eq(0)').addClass('text-center');
|
||
$(newRow.node()).find('td:eq(1)').addClass('client_info').attr('data-id', row.id);
|
||
|
||
});
|
||
}
|
||
table.draw();
|
||
}
|
||
|
||
//DO NOT REMOVE THIS FUNCTION >>> THI FUNCTION FOR CLIENT SOFT DELETE
|
||
// function removeClient(element)
|
||
// {
|
||
|
||
// Swal.fire({
|
||
// title: "Are you sure?",
|
||
// text: "You need to remove this client.",
|
||
// icon: "info",
|
||
// showCancelButton: true,
|
||
// confirmButtonColor: "#3085d6",
|
||
// confirmButtonText: "Yes",
|
||
// }).then((result) => {
|
||
|
||
// if (result.isConfirmed) {
|
||
|
||
// $('.loader').fadeIn();
|
||
// $('.loader-mask').fadeIn();
|
||
|
||
// var id = element.getAttribute('data-id');
|
||
// var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||
// $.ajax({
|
||
// url: form_action,
|
||
// type: "GET",
|
||
// dataType: 'json',
|
||
// processData: false,
|
||
// contentType: false,
|
||
// success: function(res) {
|
||
|
||
// $('.loader').fadeOut();
|
||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
// if(res){
|
||
// if (res.status == true) {
|
||
// toastr.success('Client removed successfully.', 'Success');
|
||
// location.reload();
|
||
// } else {
|
||
// Swal.fire({
|
||
// title: "warning!",
|
||
// text: res.message,
|
||
// icon: "warning"
|
||
// });
|
||
// // toastr.warning(res.message, 'Warning');
|
||
// }
|
||
// }
|
||
// },
|
||
// error: function (xhr, status, error) {
|
||
// console.error(xhr.responseText);
|
||
// console.error(status, error);
|
||
// $('.loader').fadeOut();
|
||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||
// console.log('Something Wrong!', 'warning');
|
||
// }
|
||
// });
|
||
// }
|
||
|
||
// });
|
||
|
||
// }
|
||
|
||
function removeClient(element)
|
||
{
|
||
console.log("Remove client function called")
|
||
console.log('element', element);
|
||
|
||
Swal.fire({
|
||
title: "Are you sure?",
|
||
html: `Is this a Demo Client?, Please reconfirm by clicking Yes to delete. <br> <span style = "color : red; font-size : 14px;">Note : This data will be deleted permanently and cannot be recovered.</span>`,
|
||
icon: "warning",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#3085d6",
|
||
confirmButtonText: "Yes",
|
||
}).then((result) => {
|
||
|
||
console.log('Print the result : ', result)
|
||
if (result.isConfirmed) {
|
||
|
||
console.log('Click Yes : ', result.isConfirmed);
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
var id = element.getAttribute('data-id');
|
||
console.log('client_id', id);
|
||
|
||
var form_action = '<?= base_url("/client/wipe") ?>';
|
||
console.log('URL : ', form_action);
|
||
|
||
$.ajax({
|
||
url: form_action,
|
||
type: "POST",
|
||
data: {client_id : id},
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
|
||
console.log('Client remove function response : ', res);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
if (res.status == true) {
|
||
toastr.success(res.message, 'Success');
|
||
location.reload();
|
||
} else {
|
||
Swal.fire({
|
||
title: "Warning!",
|
||
text: res.message,
|
||
icon: "warning"
|
||
});
|
||
// toastr.warning(res.message, 'Warning');
|
||
}
|
||
},
|
||
error: function (xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
console.log('Something Wrong!', 'warning');
|
||
}
|
||
});
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
$(document).on('click', '.client_info', function() {
|
||
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
var client_id = $(this).data('id')
|
||
$('#append_client_info').empty();
|
||
|
||
console.log(client_id);
|
||
console.log('client_info');
|
||
|
||
$('#client_info').show();
|
||
$('#client_list').hide();
|
||
|
||
$.ajax({
|
||
url: "<?= base_url('util/get-client-details/') ?>" + client_id,
|
||
type: "GET",
|
||
dataType: 'json',
|
||
processData: false,
|
||
contentType: false,
|
||
success: function(res) {
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
console.log(res);
|
||
console.log(res.data.length);
|
||
$('#append_client_info').append(res.data);
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}
|
||
});
|
||
|
||
|
||
});
|
||
|
||
$(document).on('click', '.client_info_close', function() {
|
||
|
||
console.log('client_info_close');
|
||
$('#client_info').hide();
|
||
$('#client_list').show();
|
||
});
|
||
|
||
function showModal(){
|
||
var myModal = new bootstrap.Modal(document.getElementById('lead_modal'));
|
||
myModal.show();
|
||
}
|
||
|
||
function featchClient(){
|
||
|
||
let lead_id = $('#lead_id').val();
|
||
console.log('lead_id : ', lead_id)
|
||
let url = '<?= base_url('leads/featchLeadDataAndInsertClient/') ?>' + lead_id
|
||
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
$.ajax({
|
||
url: url,
|
||
type: "GET",
|
||
dataType: 'json',
|
||
success: function (res) {
|
||
console.log(res);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
if(res.status == true){
|
||
let client_url = '<?= base_url('client/list/') ?>'
|
||
+ res.client_id
|
||
+ '?cd_amt=' + (res.cd_amount ?? 0)
|
||
+ '&client_policy_id=' + res.client_policy_id
|
||
+ '#police-tab';
|
||
toastr.success(res.message, 'Success')
|
||
window.location.href = client_url
|
||
}else{
|
||
toastr.warning(res.message, 'Warning')
|
||
}
|
||
|
||
$('.close').click()
|
||
},
|
||
error: function (xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
$('.close').click()
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
function addClient(){
|
||
let url = "<?= base_url("client/create"); ?>";
|
||
window.location.href = url;
|
||
}
|
||
|
||
</script>
|