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,11 +1,12 @@
<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">
<tr>
@ -23,52 +24,51 @@
<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">
<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"/>
<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" />
<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) { ?>
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
<?php } ?>
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
<?php } ?>
</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,168 +130,196 @@
<script>
var branch_form_action = '';
var contactCount = 1;
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
$(document).ready(function () {
$(document).ready(function() {
branch_PrimaryKey = $('#client_id_branch').val();
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 data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
var role = data.role
delete data.role;
console.log(role)
$.each(data, function(index, item) {
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>
<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>
`;
if(role != 3 && role != 4){
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>
<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);
$('#branch_list').append(branchTable);
}
});
});
$('#btnBranchAdd').click(function(){
$('#btnBranchAdd').click(function() {
branch_form_action = '<?= base_url("client/branch/create"); ?>';
branch_form_action = '<?= base_url("client/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#branch_form')[0].reset();
$('.ac').css('display', 'block');
contactCount = 1
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#branch_form')[0].reset();
$('.ac').css('display', 'block');
contactCount = 1
var addButton = document.getElementById('add');
if (addButton.style.display === 'none') {
addButton.style.display = 'block';
}
var addButton = document.getElementById('add');
if (addButton.style.display === 'none') {
addButton.style.display = 'block';
}
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
})
})
$('.btnBack').click(function(){
$('.btnBack').click(function() {
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#branch_form')[0].reset();
$('.ac').css('display', 'block');
$('.parsley-errors-list').remove();
$('#branch_form').parsley().reset();
contactCount = 1
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#branch_form')[0].reset();
$('.ac').css('display', 'block');
$('.parsley-errors-list').remove();
$('#branch_form').parsley().reset();
contactCount = 1
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
elementToRemove.parentNode.removeChild(elementToRemove);
}
}
})
})
$("#branch_form").submit(function(event) {
$("#branch_form").submit(function(event) {
event.preventDefault();
branch_PrimaryKey = $('#client_id_branch').val();
event.preventDefault();
branch_PrimaryKey = $('#client_id_branch').val();
console.log('branch_PrimaryKey', branch_PrimaryKey)
if (branch_PrimaryKey === '') {
toastr.error('Client is required', 'Error');
$('#insurer').val('');
$('#tpa').val('');
$('#policy').html('<option value="" selected>Select Policy</option>');
return;
}
console.log('branch_PrimaryKey', branch_PrimaryKey)
var isValid = $('#branch_form').parsley().validate();
if (branch_PrimaryKey === '') {
toastr.error('Client is required', 'Error');
$('#insurer').val('');
$('#tpa').val('');
$('#policy').html('<option value="" selected>Select Policy</option>');
return;
}
if (isValid) {
var isValid = $('#branch_form').parsley().validate();
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
if (isValid) {
var formData = new FormData($('#branch_form')[0]);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
data: formData,
url: branch_form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
var formData = new FormData($('#branch_form')[0]);
if(res){
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var message = (branch_PrimaryKey === '') ? 'Client Branch Created successfully' : 'Client Branch Updated successfully';
toastr.success(message, 'Success');
}, 1000);
}
$.ajax({
data: formData,
url: branch_form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
if (res) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
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){
$('#branch_list tr').remove();
var branchTableInsert = ''
$.each(res.data, function(index, item) {
branchTableInsert += `
<tr>
<td>${item.branch_name}</td>
@ -290,92 +329,26 @@ $(document).ready(function () {
<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>
`;
});
$('#branch_list').append(branchTableInsert);
},
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);
}
});
}
contactCount = 1
});
`;
}else{
$('body').on('click', '.btnBranchEdit', function () {
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>
`;
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
contactCount = 1
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var branch_id = $(this).attr('data-id');
$('#branch_id_primarykey').val(branch_id);
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
$.ajax({
url: '<?php echo base_url('client/branch/list/');?>'+branch_id,
type: "GET",
dataType: 'json',
success: function (res) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 500);
// console.log('branch contact : ',res.contact)
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val(res.data.branch_name);
$('#branch_code').val(res.data.branch_code);
$('#state option[value="' + res.data.state + '"]').prop('selected', true);
$('#district').val(res.data.district);
$('#branch_city').val(res.data.city);
$('#branch_PrimaryKey').val(res.data.id);
$('#name').val(res.contact[0].name);
$('#email').val(res.contact[0].email);
$('#mobile').val(res.contact[0].mobile);
$('#designation').val(res.contact[0].designation);
res.contact.shift();
// console.log(res.contact.length)
for (let index = 0; index < res.contact.length; index++) {
const contact = res.contact[index];
if (contact !== undefined) {
appendContactHtml(contact);
}
}
});
$('#branch_list').append(branchTableInsert);
},
error: function (xhr, status, error) {
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
@ -383,29 +356,110 @@ $(document).ready(function () {
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
}
});
console.log(branch_form_action);
}
contactCount = 1
});
$('body').on('click', '.btnBranchEdit', function() {
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
contactCount = 1
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var branch_id = $(this).attr('data-id');
$('#branch_id_primarykey').val(branch_id);
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
$.ajax({
url: '<?php echo base_url('client/branch/list/');?>' + branch_id,
type: "GET",
dataType: 'json',
success: function(res) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 500);
// console.log('branch contact : ',res.contact)
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val(res.data.branch_name);
$('#branch_code').val(res.data.branch_code);
$('#state option[value="' + res.data.state + '"]').prop('selected', true);
$('#district').val(res.data.district);
$('#branch_city').val(res.data.city);
$('#branch_PrimaryKey').val(res.data.id);
$('#name').val(res.contact[0].name);
$('#email').val(res.contact[0].email);
$('#mobile').val(res.contact[0].mobile);
$('#designation').val(res.contact[0].designation);
res.contact.shift();
// console.log(res.contact.length)
for (let index = 0; index < res.contact.length; index++) {
const contact = res.contact[index];
if (contact !== undefined) {
appendContactHtml(contact);
}
}
},
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(branch_form_action);
});
$("#remove_btn").click(function(){
$("#name").val('');
$("#email").val('');
$("#mobile").val('');
$("#designation").val('');
})
$("#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++;
console.log('appendContactHtml function called ')
contactCount++;
var container = document.getElementById('container');
var uniqueId = Date.now().toString();
var container = document.getElementById('container');
var uniqueId = Date.now().toString();
var html = `
var html = `
<div id="${uniqueId}">
<hr>
<h6 class="header-title">Contact ${contactCount}</h6>
@ -437,159 +491,169 @@ $(document).ready(function () {
</div>
`;
if(reset == false){
console.log(reset)
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
if (reset == false) {
console.log(reset)
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
if (contactCount >= 3) {
hideStoredAddButtons();
}
}
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount --;
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
if (addButton) {
addButton.style.display = 'block';
}
}
if (contactCount >= 3) {
hideStoredAddButtons();
}
}
function storeButtonId(id) {
}
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
buttonIds.push(id);
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount--;
function hideStoredAddButtons() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
storedIds.forEach(function(id) {
var addButton = document.getElementById(id);
var first_addButton = document.querySelector('.ac')
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
if (addButton) {
addButton.style.display = 'none';
first_addButton.style.display = 'none';
addButton.style.display = 'block';
}
});
}
}
}
function showNextAddButton() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false;
function storeButtonId(id) {
// Iterate through the stored IDs to find the next "Add" button to show
storedIds.forEach(function(id) {
if (!addButtonShown) {
var addButton = document.getElementById(id);
if (addButton && addButton.style.display === 'none') {
addButton.style.display = 'block';
addButtonShown = true; // Set to true once an "Add" button is shown
}
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
buttonIds.push(id);
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
}
function hideStoredAddButtons() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
storedIds.forEach(function(id) {
var addButton = document.getElementById(id);
var first_addButton = document.querySelector('.ac')
if (addButton) {
addButton.style.display = 'none';
first_addButton.style.display = 'none';
}
});
}
function showNextAddButton() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false;
// Iterate through the stored IDs to find the next "Add" button to show
storedIds.forEach(function(id) {
if (!addButtonShown) {
var addButton = document.getElementById(id);
if (addButton && addButton.style.display === 'none') {
addButton.style.display = 'block';
addButtonShown = true; // Set to true once an "Add" button is shown
}
});
}
}
});
}
function validateForm() {
var isValid = true;
$('#branch_form input, #branch_form select').each(function() {
function validateForm() {
var isValid = true;
if ($(this).is('input[type="text"]') || $(this).is('select')) {
if ($.trim($(this).val()) == '') {
isValid = false;
return false;
}
$('#branch_form input, #branch_form select').each(function() {
if ($(this).is('input[type="text"]') || $(this).is('select')) {
if ($.trim($(this).val()) == '') {
isValid = false;
return false;
}
}
});
});
return isValid;
}
return isValid;
}
function onlyNumbers(event){
function onlyNumbers(event) {
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true;
return false;
}
var charcode;
charcode = event.which || event.keyCode;
if (charcode >= 48 && charcode <= 57) return true;
return false;
}
function removeClientBranch(element) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("client/branch/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('Remove Done!', 'success');
function removeClientBranch(element) {
location.reload();
Swal.fire({
title: "Are you sure?",
text: "You need to remove this client branch.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
} else {
toastr.warning('Remove Not Done!', 'warning');
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("client/branch/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('Client branch removed successfully', 'success');
location.reload();
} else {
toastr.warning('Failed to remove client 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');
console.log('Something Wrong!', 'warning');
}, 1000);
}
}
},
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);
}
});
}
});
}
});
}
function checkMobileNumber(input){
function checkMobileNumber(input) {
console.log('function called')
console.log(input);
console.log('Input Value', input.value);
console.log('function called')
console.log(input);
console.log('Input Value', input.value);
var mobileNumber = input.value;
var url = '<?php echo base_url('util/checkHRNumber/') ?>' + mobileNumber;
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;
}
}).fail(function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
});
}).fail(function(xhr, status, error) {
console.error(xhr.responseText);
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>
<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 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,38 +113,47 @@ table.dataTable thead th {
function removeClient(element) {
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) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Remove Done!', 'success');
location.reload();
Swal.fire({
title: "Are you sure?",
text: "You need to remove this client.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
} else {
toastr.warning('Remove Not Done!', 'warning');
}
if (result.isConfirmed) {
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) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Client removed successfully.', 'success');
location.reload();
} else {
toastr.warning('Failed to remove client.', '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');
}
});
}
},
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);
}
});
});
}

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,38 +473,48 @@
function removeInsurerBranch(element) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/insurer/branch/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('Remove Done!', 'success');
location.reload();
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({
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('Insurer branch removed successfully', 'success');
location.reload();
} else {
toastr.warning('Failed to remove insurer branch', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove insurer branch', 'warning');
}
});
} else {
toastr.warning('Remove Not Done!', '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);
}
});
}
});
}
</script>

View File

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

View File

@ -323,38 +323,49 @@ $(document).ready(function () {
function removeKYCDocs(element) {
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;
$.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('Remove Done!', 'success');
// location.reload();
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
Swal.fire({
title: "Are you sure?",
text: "You need to remove this!.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
} else {
toastr.warning('Remove Not Done!', '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);
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;
$.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('KYC docs removed successfully');
// location.reload();
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
} else {
toastr.warning('Failed to remove KYC docs', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove KYC docs', 'warning');
}
});
}
});
}

View File

@ -133,39 +133,49 @@ class csvExport {
function removeKYC(element) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/kyc/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('Remove Done!', 'success');
location.reload();
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({
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('KYC entity removed successfully', 'success');
} else {
toastr.warning('Remove Not Done!', 'warning');
location.reload();
} else {
toastr.warning('Failed to remove KYC entity', '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);
}
}
},
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);
}
});
}
});
}

View File

@ -396,42 +396,52 @@ $(document).ready(function () {
function removePolicies(element) {
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;
$.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('Remove Done!', 'success');
// $('#branch_table').empty();
Swal.fire({
title: "Are you sure?",
text: "You need to remove this Policy.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
// location.reload();
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
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;
$.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('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');
}
}
},
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);
} else {
toastr.warning('Failed to remove policy', 'warning');
}
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Failed to remove policy', 'warning');
}
});
}
});
}
}
</script>

View File

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

View File

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

View File

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