FIX_DELETE_CONFIRM_ROLE_AND_OTHERS : RV

This commit is contained in:
VENKATESHWARAN 2024-06-25 15:08:21 +05:30
parent 33a07a816e
commit 9d6c23ff4e
19 changed files with 890 additions and 649 deletions

View File

@ -213,7 +213,7 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "MasterController::createCDMasterData");
$routes->post("edit", "MasterController::editCDMasterData");
$routes->get("list/(:any)", "MasterController::getCDMasterDataByID/$1");
// $routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
$routes->get("remove/(:any)", "MasterController::removeCDMaster/$1");
});
});

View File

@ -301,9 +301,9 @@ class ClientController extends AdminController
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
// dd('Hi');
$editData['client_branch']['role'] = get_role_id();
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id);
// dd($this->clientPolicyModel->getLastQuery());
foreach ($clientPoliceData as $key => $value) {
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
@ -311,12 +311,10 @@ class ClientController extends AdminController
}
$editData['client_policy'] = $clientPoliceData;
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
// dd($editData);
echo view('layout/header', $headerData);
echo view('client_onboarding', $editData);
echo view('layout/footer');
@ -565,6 +563,7 @@ class ClientController extends AdminController
if($insert){
$branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll();
$branchData['role'] = get_role_id();
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);

View File

@ -1123,13 +1123,7 @@ class MasterController extends AdminController
public function CDMasterList()
{
$data['CD_Master_Data'] = $this->CDMasterModel
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name as insurer_name, user_profiles.first_name as user_name')
->join('clients', 'clients.id = cd_master.client_id')
->join('insurers', 'insurers.id = cd_master.insurer_id')
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
->where('cd_master.is_active', 1)
->findAll();
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
$data['insurers'] = $this->insurerModel->findAll();
$data['clients'] = $this->clientModel->findAll();
$this->loadLayout('cd_master_list', $data);
@ -1217,4 +1211,18 @@ class MasterController extends AdminController
}
}
public function removeCDMaster($id){
$this->myLogger->logme('error','CDMaster Remove function called');
$data['updated_by'] = get_session_userid();
$data['is_active'] = 0;
$update = $this->CDMasterModel->where('id', $id)->set($data)->update();
if($update){
return $this->respond(['status' => true,'code' => 200], 200);
}else{
return $this->respond(['status' => false,'code' => 404], 200);
}
}
}

View File

@ -239,3 +239,12 @@ if (!function_exists('get_username')) {
}
if (!function_exists('get_role_id')) {
function get_role_id() {
$role_id = get_session_userdata()->role;
return $role_id;
}
}

View File

@ -61,4 +61,26 @@ class CDMasterModel extends Model
return $data;
}
public function getCDMasterList(){
$query = $this->db->table('cd_master')
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count')
->join('clients', 'clients.id = cd_master.client_id')
->join('insurers', 'insurers.id = cd_master.insurer_id')
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
->join(
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
FROM cd_master
JOIN client_policy ON client_policy.cd_ac_no = cd_master.cd_ac_no
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts',
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
'left'
)
->where('cd_master.is_active', 1)
->get();
$result = $query->getResultArray();
return $result;
}
}

View File

@ -77,12 +77,14 @@ class ClientPolicyModel extends Model
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
->select('policy_type.policy_type as policy_type_name')
->select('client_branch.branch_name as branch_name')
->join('insurers', 'insurers.id = client_policy.insurer_id')
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left')
->join('policies', 'policies.id = client_policy.policy_id')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
->where('client_policy.client_id', $client_id)
->where('client_policy.policy_status', 1)
->where('client_policy.is_active', 1)

View File

@ -58,12 +58,12 @@ table.dataTable thead th {
<?php echo $row['user_name']; ?></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>
<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 btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<?php if($row['cd_ac_no_count'] == 0) { ?>
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeCDMaster(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
<?php } ?>
</div>
</div>
</td>
@ -290,4 +290,50 @@ table.dataTable thead th {
})
function removeCDMaster(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this CD.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/cash_deposite/remove/") ?>' + id;
$.ajax({
url: form_action,
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('CD removed successfully.', 'success');
location.reload();
} else {
toastr.warning('Failed to remove CD.', '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');
}
});
}
});
}
</script>

View File

@ -1,10 +1,11 @@
<div class="tab-pane fade" id="branch-tab">
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
</div>
<div class="table-responsive" id="branch_table" >
<div class="table-responsive" id="branch_table">
<table class="table table-borderless table-nowrap mb-0">
<thead class="thead-light">
@ -23,34 +24,35 @@
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
<button type="button" id="btnBranchBack"
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list"
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
</div>
<hr>
<form role="form" class="parsley-examples" method="post" id="branch_form"
enctype="multipart/form-data">
<form role="form" class="parsley-examples" method="post" id="branch_form" enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="client_id" id="client_id_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey"/>
<input type="hidden" name="client_id" id="client_id_branch"
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_name">Branch Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" placeholder="Enter Branch Name" name="branch_name" required>
<input type="text" class="form-control" id="branch_name" placeholder="Enter Branch Name"
name="branch_name" required>
</div>
<div class="form-group col-md-6">
<label for="branch_code">Branch Code<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code"
placeholder="Enter Branch Code" name="branch_code" required>
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" placeholder="Enter Branch Code"
name="branch_code" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="state">State<span
class="text-danger">*</span></label>
<label for="state">State<span class="text-danger">*</span></label>
<select class="form-control" id="state" name="state" required>
<option value="">Select State</option>
<?php foreach($state as $value) { ?>
@ -59,16 +61,14 @@
</select>
</div>
<div class="form-group col-md-4">
<label for="district">District<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="district"
placeholder="Enter District" name="district" required>
<label for="district">District<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="district" placeholder="Enter District"
name="district" required>
</div>
<div class="form-group col-md-4">
<label for="city">City<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city"
placeholder="Enter City" name="city" required>
<label for="city">City<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city" placeholder="Enter City"
name="city" required>
</div>
</div>
@ -79,26 +79,37 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="first_name">Name<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
<input value="" type="text" class="form-control" placeholder="Enter Contact Name"
name="name[]" id="name" required>
</div>
<div class="form-group col-md-6">
<label for="last_name">Email<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" required>
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email"
required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="mobile">Mobile<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" onchange="checkMobileNumber(this)" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
name="mobile[]" id="mobile" onchange="checkMobileNumber(this)"
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
data-parsley-type-message="Please enter a valid 10-digit mobile number."
data-parsley-required-message="Please enter a valid 10-digit mobile number."
required>
</div>
<div class="form-group col-md-6">
<label for="designation">Designation<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
<input value="" type="text" class="form-control" placeholder="Enter Designation Name"
name="designation[]" id="designation" required>
</div>
</div>
<div class="form-group" style="display: flex;">
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="remove_btn">Remove</button>
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac"
onclick="appendContactHtml()" id="add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)"
id="remove_btn">Remove</button>
</div>
<div id="container"></div>
@ -119,23 +130,28 @@
<script>
var branch_form_action = '';
var contactCount = 1;
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
$(document).ready(function () {
$(document).ready(function() {
branch_PrimaryKey = $('#client_id_branch').val();
$('#add_branch').hide();
$('.btnBack').hide();
if(branch_PrimaryKey !== ''){
if (branch_PrimaryKey !== '') {
var branchTable = '';
var data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
var role = data.role
delete data.role;
console.log(role)
$.each(data, function(index, item) {
if(role != 3 && role != 4){
branchTable += `
<tr>
<td>${item.branch_name}</td>
@ -143,10 +159,22 @@ $(document).ready(function () {
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeClientBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
</tr>
`;
}else{
branchTable += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
</td>
</tr>
`;
}
});
$('#branch_list').append(branchTable);
}
@ -154,7 +182,7 @@ $(document).ready(function () {
});
$('#btnBranchAdd').click(function(){
$('#btnBranchAdd').click(function() {
branch_form_action = '<?= base_url("client/branch/create"); ?>';
@ -193,9 +221,9 @@ $(document).ready(function () {
localStorage.removeItem('buttonIds')
}
})
})
$('.btnBack').click(function(){
$('.btnBack').click(function() {
$('#add_branch').hide();
$('#branch_table').show();
@ -228,10 +256,10 @@ $(document).ready(function () {
}
}
})
})
$("#branch_form").submit(function(event) {
$("#branch_form").submit(function(event) {
event.preventDefault();
branch_PrimaryKey = $('#client_id_branch').val();
@ -264,7 +292,7 @@ $(document).ready(function () {
contentType: false,
success: function(res) {
if(res){
if (res) {
setTimeout(function() {
$('.loader').fadeOut();
@ -273,14 +301,25 @@ $(document).ready(function () {
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var message = (branch_PrimaryKey === '') ? 'Client Branch Created successfully' : 'Client Branch Updated successfully';
var message = (branch_PrimaryKey === '') ?
'Client Branch Created successfully' :
'Client Branch Updated successfully';
toastr.success(message, 'Success');
}, 1000);
}
$('#branch_list tr').remove();
var branchTableInsert = ''
var role = res.data.role
delete res.data.role;
console.log(role)
$.each(res.data, function(index, item) {
console.log('client_branch_data', item)
if(role != 3 && role != 4){
branchTableInsert += `
<tr>
<td>${item.branch_name}</td>
@ -291,10 +330,25 @@ $(document).ready(function () {
</td>
</tr>
`;
}else{
branchTableInsert += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
</td>
</tr>
`;
}
});
$('#branch_list').append(branchTableInsert);
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
@ -306,10 +360,10 @@ $(document).ready(function () {
});
}
contactCount = 1
});
});
$('body').on('click', '.btnBranchEdit', function () {
$('body').on('click', '.btnBranchEdit', function() {
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
@ -336,10 +390,10 @@ $(document).ready(function () {
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
$.ajax({
url: '<?php echo base_url('client/branch/list/');?>'+branch_id,
url: '<?php echo base_url('client/branch/list/');?>' + branch_id,
type: "GET",
dataType: 'json',
success: function (res) {
success: function(res) {
setTimeout(function() {
$('.loader').fadeOut();
@ -375,7 +429,7 @@ $(document).ready(function () {
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
@ -386,18 +440,18 @@ $(document).ready(function () {
}
});
console.log(branch_form_action);
});
});
$("#remove_btn").click(function(){
$("#remove_btn").click(function() {
$("#name").val('');
$("#email").val('');
$("#mobile").val('');
$("#designation").val('');
})
})
// Initialize the contact count
function appendContactHtml(contact = false, reset = false) {
// Initialize the contact count
function appendContactHtml(contact = false, reset = false) {
console.log('appendContactHtml function called ')
contactCount++;
@ -437,7 +491,7 @@ $(document).ready(function () {
</div>
`;
if(reset == false){
if (reset == false) {
console.log(reset)
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
@ -447,15 +501,15 @@ $(document).ready(function () {
}
}
}
}
function removeContact(button) {
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount --;
contactCount--;
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
@ -464,17 +518,17 @@ $(document).ready(function () {
}
}
}
}
}
function storeButtonId(id) {
function storeButtonId(id) {
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
buttonIds.push(id);
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
}
}
function hideStoredAddButtons() {
function hideStoredAddButtons() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
storedIds.forEach(function(id) {
var addButton = document.getElementById(id);
@ -484,9 +538,9 @@ $(document).ready(function () {
first_addButton.style.display = 'none';
}
});
}
}
function showNextAddButton() {
function showNextAddButton() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false;
@ -500,9 +554,9 @@ $(document).ready(function () {
}
}
});
}
}
function validateForm() {
function validateForm() {
var isValid = true;
$('#branch_form input, #branch_form select').each(function() {
@ -517,17 +571,28 @@ $(document).ready(function () {
});
return isValid;
}
}
function onlyNumbers(event){
function onlyNumbers(event) {
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true;
if (charcode >= 48 && charcode <= 57) return true;
return false;
}
}
function removeClientBranch(element) {
function removeClientBranch(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this client branch.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("client/branch/remove/") ?>' + id;
$.ajax({
@ -538,32 +603,34 @@ $(document).ready(function () {
contentType: false,
success: function(res) {
// console.log(res.status == true);
if(res){
if (res) {
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('Client branch removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove client branch', 'warning');
}
}
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
console.log('Something Wrong!', 'warning');
}, 1000);
}
});
}
});
}
function checkMobileNumber(input){
function checkMobileNumber(input) {
console.log('function called')
console.log(input);
@ -572,12 +639,12 @@ $(document).ready(function () {
var mobileNumber = input.value;
var url = '<?php echo base_url('util/checkHRNumber/') ?>' + mobileNumber;
$.get(url, function(response){
$.get(url, function(response) {
console.log(response)
console.log(response.data)
if(response.data > 0){
if (response.data > 0) {
toastr.warning('The Mobile Number Already Exist.', 'Warning');
input.value = "";
return;
@ -588,8 +655,5 @@ $(document).ready(function () {
console.error(status, error);
});
}
}
</script>

View File

@ -59,7 +59,9 @@ table.dataTable thead th {
<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>Deposit</a>
<?php if(get_role_id() != 3 && get_role_id() != 4) { ?>
<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>
@ -111,6 +113,17 @@ table.dataTable thead th {
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) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("client/remove/") ?>' + id;
$.ajax({
@ -123,26 +136,24 @@ table.dataTable thead th {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('Client removed successfully.', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove client.', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
console.log('Something Wrong!', 'warning');
}
});
}
});
}

View File

@ -7,14 +7,15 @@
<div class="table-responsive" id="table_list">
<table class="table table-borderless table-nowrap mb-0" id="table-client-policy">
<table class="table table-borderless table mb-0" id="table-client-policy">
<thead class="thead-light">
<tr>
<th>Insurer</th>
<th>Policy</th>
<th>Client Branch</th>
<th>TPA</th>
<th>Date</th>
<th>Enrollment <br> Status</th>
<th>Enrollment Status</th>
<th>Status</th>
<th>Action</th>
</tr>
@ -263,8 +264,9 @@
<tr>
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${item.policy_name} (${item.policy_type_name})</td>
<td>${item.branch_name}</td>
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / <br> ${(item.policy_end_date)}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
@ -481,8 +483,9 @@
<tr>
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${item.policy_name} (${item.policy_type_name})</td>
<td>${item.branch_name}</td>
<td>${tpaValue}</td>
<td>${rearrangeDateFormat(item.policy_start_date)} / <br> ${rearrangeDateFormat(item.policy_end_date)}</td>
<td>${rearrangeDateFormat(item.policy_start_date)} / ${rearrangeDateFormat(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>

View File

@ -16,7 +16,7 @@
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label for="emp_code">Account Manager</label>
<label for="emp_code">Account Manager ( L2 )</label>
<select class="form-control" id="account_manager" name="account_manager[]" multiple>
<?php foreach($RM as $value) { ?>
<?php if($value['role'] === '3') { ?>
@ -26,7 +26,7 @@
</select>
</div>
<div class="form-group col-md-4">
<label for="profile">Manager</label>
<label for="profile">Manager ( L1 )</label>
<select class="form-control" id="manager" name="manager">user_id
<option value="">Select Manager</option>
<?php foreach($RM as $value) { ?>

View File

@ -473,6 +473,17 @@
function removeInsurerBranch(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this insurer branch.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/insurer/branch/remove/") ?>' + id;
$.ajax({
@ -485,26 +496,25 @@
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('Insurer branch removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove insurer branch', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove insurer branch', 'warning');
}
});
}
});
}
</script>

View File

@ -134,6 +134,17 @@ class csvExport {
function removeInsurer(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this insurer.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/insurer/remove/") ?>' + id;
$.ajax({
@ -146,26 +157,24 @@ class csvExport {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('Insurer removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove insurer', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove insurer', 'warning');
}
});
}
});
}

View File

@ -323,6 +323,17 @@ $(document).ready(function () {
function removeKYCDocs(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this!.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/kyc/kycdocs/remove/") ?>' + id;
@ -336,26 +347,26 @@ $(document).ready(function () {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('KYC docs removed successfully');
// location.reload();
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove KYC docs', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove KYC docs', 'warning');
}
});
}
});
}
</script>

View File

@ -133,6 +133,16 @@ class csvExport {
function removeKYC(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this!",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/kyc/remove/") ?>' + id;
$.ajax({
@ -145,12 +155,12 @@ function removeKYC(element) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('KYC entity removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove KYC entity', 'warning');
}
}
},
@ -164,8 +174,8 @@ function removeKYC(element) {
}, 1000);
}
});
}
});
}

View File

@ -396,6 +396,17 @@ $(document).ready(function () {
function removePolicies(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this Policy.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var policy_id_for_reload = $('#policy_type_id').val()
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/policy/policies/remove/") ?>' + id;
@ -409,29 +420,28 @@ function removePolicies(element) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('Policy removed successfully', 'success');
// $('#branch_table').empty();
// location.reload();
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove policy', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove policy', 'warning');
}
});
}
});
}
</script>

View File

@ -138,6 +138,17 @@ class csvExport {
function removePolciyType(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this!",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/policy/remove/") ?>' + id;
$.ajax({
@ -150,26 +161,24 @@ function removePolciyType(element) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('Policy type removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove policy type', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove policy type', 'warning');
}
});
}
});
}

View File

@ -507,6 +507,17 @@ function validateForm() {
function removeTPABranch(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this TPA branch.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/tpa/branch/remove/") ?>' + id;
$.ajax({
@ -519,24 +530,23 @@ function validateForm() {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('TPA branch removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove TPA branch', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove TPA branch', 'warning');
}
});
}
});
}
</script>

View File

@ -132,6 +132,17 @@ class csvExport {
function removeTPA(element) {
Swal.fire({
title: "Are you sure?",
text: "You need to remove this TPA",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/tpa/remove/") ?>' + id;
$.ajax({
@ -144,27 +155,24 @@ function removeTPA(element) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
toastr.success('TPA removed successfully', 'success');
location.reload();
} else {
toastr.warning('Remove Not Done!', 'warning');
toastr.warning('Failed to remove TPA', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
toastr.warning('Failed to remove TPA', 'warning');
}
});
}
});
}