Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
880dcd1a68
@ -275,6 +275,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1");
|
$routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1");
|
||||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||||
$routes->get("send_manual_remainder/(:any)", "DashboardController::sendManualRemainder/$1");
|
$routes->get("send_manual_remainder/(:any)", "DashboardController::sendManualRemainder/$1");
|
||||||
|
$routes->get("get_insurer_by_export_templete", "MasterController::getInsurerByExportTemplete");
|
||||||
|
$routes->get("copy_insurer_templete/(:any)", "MasterController::copyInsurerTemplete/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||||
|
|||||||
@ -29,6 +29,7 @@ use App\Models\StateModel;
|
|||||||
use App\Models\PolicyTypeModel;
|
use App\Models\PolicyTypeModel;
|
||||||
use App\Models\CDMasterModel;
|
use App\Models\CDMasterModel;
|
||||||
use App\Models\ClientDepositModel;
|
use App\Models\ClientDepositModel;
|
||||||
|
use App\Models\InsurerExcelExportTemplateModel;
|
||||||
|
|
||||||
class MasterController extends AdminController
|
class MasterController extends AdminController
|
||||||
{
|
{
|
||||||
@ -52,6 +53,7 @@ class MasterController extends AdminController
|
|||||||
protected $CDMasterModel;
|
protected $CDMasterModel;
|
||||||
protected $clientModel;
|
protected $clientModel;
|
||||||
protected $clientDepositModel;
|
protected $clientDepositModel;
|
||||||
|
protected $insurerTemplateModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ class MasterController extends AdminController
|
|||||||
set_session_context('Master');
|
set_session_context('Master');
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
|
|
||||||
$this->insurerModel = new ClientModel();
|
// $this->insurerModel = new ClientModel();
|
||||||
$this->userModel = new UserModel();
|
$this->userModel = new UserModel();
|
||||||
// $this->insurerBranchModel = new ClientBranchModel();
|
// $this->insurerBranchModel = new ClientBranchModel();
|
||||||
$this->insurerKYCDocsModel = new ClientKYCDocsModel();
|
$this->insurerKYCDocsModel = new ClientKYCDocsModel();
|
||||||
@ -79,6 +81,7 @@ class MasterController extends AdminController
|
|||||||
$this->CDMasterModel = new CDMasterModel();
|
$this->CDMasterModel = new CDMasterModel();
|
||||||
$this->clientModel = new ClientModel();
|
$this->clientModel = new ClientModel();
|
||||||
$this->clientDepositModel = new ClientDepositModel();
|
$this->clientDepositModel = new ClientDepositModel();
|
||||||
|
$this->insurerTemplateModel = new InsurerExcelExportTemplateModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +153,7 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
$editData['insurer'] = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
|
$editData['insurer'] = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||||
|
$editData['insurer_templete_count'] = $this->insurerTemplateModel->where(['insurer_id' => $id, 'is_active' => 1])->countAllResults();
|
||||||
|
|
||||||
|
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
@ -209,7 +213,8 @@ class MasterController extends AdminController
|
|||||||
$insert = $this->insurerModel->insert($data);
|
$insert = $this->insurerModel->insert($data);
|
||||||
if($insert){
|
if($insert){
|
||||||
$insurer_data = $this->insurerModel->where(['id' => $insert, 'is_active' => 1])->first();
|
$insurer_data = $this->insurerModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||||
echo json_encode(array("status" => true , 'data' => $insurer_data));
|
$insurer_templete_count = $this->insurerTemplateModel->where(['insurer_id' => $insert, 'is_active' => 1])->countAllResults();
|
||||||
|
echo json_encode(array("status" => true , 'data' => $insurer_data, 'templete_count' => $insurer_templete_count));
|
||||||
}else{
|
}else{
|
||||||
echo json_encode(array("status" => false));
|
echo json_encode(array("status" => false));
|
||||||
}
|
}
|
||||||
@ -337,6 +342,44 @@ class MasterController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getInsurerByExportTemplete()
|
||||||
|
{
|
||||||
|
$insurer_data = $this->insurerModel
|
||||||
|
->select('insurers.name as insurer_name, insurers.id, insurers.is_multi_event')
|
||||||
|
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = insurers.id')
|
||||||
|
->groupBy('insurers.id')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $insurer_data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function copyInsurerTemplete($existing_insurer_id, $copy_insurer_id)
|
||||||
|
{
|
||||||
|
$insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $existing_insurer_id)->findAll();
|
||||||
|
$existing_insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $copy_insurer_id)->delete();
|
||||||
|
|
||||||
|
$data_to_insert = [];
|
||||||
|
foreach ($insurer_templete_data as $value) {
|
||||||
|
$data_to_insert[] = [
|
||||||
|
"insurer_id" => $copy_insurer_id,
|
||||||
|
"policy_type_id" => $value['policy_type_id'],
|
||||||
|
"event_name" => $value['event_name'],
|
||||||
|
"type_name" => $value['type_name'],
|
||||||
|
"jsoncolumns" => $value['jsoncolumns'],
|
||||||
|
"created_by" => get_session_user(),
|
||||||
|
"is_active" => 1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$insert_result = $this->insurerTemplateModel->insertBatch($data_to_insert);
|
||||||
|
if($insert_result){
|
||||||
|
return $this->respond(['status' => true, 'message' => 'Template added successfully', $insurer_templete_data]);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => true, 'message' => 'Failed to add template', $insurer_templete_data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
// Insurer Ends
|
// Insurer Ends
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -150,16 +150,12 @@ input:checked + .slider:before {
|
|||||||
$("#insurer_general_form").submit(function(events) {
|
$("#insurer_general_form").submit(function(events) {
|
||||||
|
|
||||||
events.preventDefault();
|
events.preventDefault();
|
||||||
// var isValid = validateForm();
|
|
||||||
|
|
||||||
var isValid = true;
|
var isValid = $('#insurer_General_PrimaryKey').parsley().validate();
|
||||||
jQuery.each(events.target, function(index, event) {
|
if (!isValid) {
|
||||||
if (event.validity.valid) {
|
console.log('Form is Empty', 'Warning');
|
||||||
|
return ;
|
||||||
} else {
|
}
|
||||||
isValid = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var PrimaryKey = $('#insurer_General_PrimaryKey').val();
|
var PrimaryKey = $('#insurer_General_PrimaryKey').val();
|
||||||
var form_action = '';
|
var form_action = '';
|
||||||
@ -193,29 +189,25 @@ input:checked + .slider:before {
|
|||||||
$('#insurer_id').val(res.data.id);
|
$('#insurer_id').val(res.data.id);
|
||||||
$('#insurer_General_PrimaryKey').val(res.data.id);
|
$('#insurer_General_PrimaryKey').val(res.data.id);
|
||||||
$('#insurer_id_branch').val(res.data.id);
|
$('#insurer_id_branch').val(res.data.id);
|
||||||
$('#insurer_branch_contacts_id').click();
|
// $('#insurer_branch_contacts_id').click();
|
||||||
|
|
||||||
$('#btnBranchAdd').show();
|
$('#btnBranchAdd').show();
|
||||||
var message = "Insurer General Info";
|
var message = "Insurer General Info";
|
||||||
toastr.success(message, 'Success');
|
toastr.success(message, 'Success');
|
||||||
|
|
||||||
// $.toast({
|
if (PrimaryKey === '') {
|
||||||
// text: 'Insurer General Info',
|
setTimeout(function(){
|
||||||
// heading: "Submitted Sucessfully",
|
window.location.href = '<?= base_url('master/insurer/list/')?>' + res.data.id
|
||||||
// position: 'top-right',
|
}, 100)
|
||||||
// icon: 'success',
|
}
|
||||||
// bgColor: !1,
|
|
||||||
// });
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
setTimeout(function() {
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$('.loader').fadeOut();
|
console.log('Something Wrong!', 'warning');
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
console.log('Something Wrong!', 'warning'); }, 1000);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -252,7 +244,8 @@ input:checked + .slider:before {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function PreviewImage() {
|
function PreviewImage()
|
||||||
|
{
|
||||||
var oFReader = new FileReader();
|
var oFReader = new FileReader();
|
||||||
oFReader.readAsDataURL(document.getElementById("insurer_logo").files[0]);
|
oFReader.readAsDataURL(document.getElementById("insurer_logo").files[0]);
|
||||||
|
|
||||||
@ -260,4 +253,9 @@ input:checked + .slider:before {
|
|||||||
document.getElementById("uploadPreview").src = oFREvent.target.result;
|
document.getElementById("uploadPreview").src = oFREvent.target.result;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
152
app/Views/insurer_export_templete.php
Normal file
152
app/Views/insurer_export_templete.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<div class="tab-pane fade" id="template-tab">
|
||||||
|
|
||||||
|
<input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="email">Existing Insurer Export<span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="insurer" name="insurer" required>
|
||||||
|
<option value="">Select Insurer</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3" style="position: relative;top: 28px;">
|
||||||
|
<label for="email"><span class="text-danger"></span></label>
|
||||||
|
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="checkInsurerTemplete(this)">Copy</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#insurer').select2();
|
||||||
|
featchInsurerList()
|
||||||
|
})
|
||||||
|
|
||||||
|
function featchInsurerList()
|
||||||
|
{
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("util/get_insurer_by_export_templete") ?>',
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('featchInsurerList list', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
appendInsurer(res.data)
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendInsurer(data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$('#insurer').empty();
|
||||||
|
$('#insurer').append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select',
|
||||||
|
selected: true
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.insurer_name
|
||||||
|
});
|
||||||
|
$('#insurer').append(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkInsurerTemplete(input)
|
||||||
|
{
|
||||||
|
var existing_insurer_id = $('#insurer').val();
|
||||||
|
var copy_insurer_id = $('#insurer_General_PrimaryKey').val()
|
||||||
|
var insurer_templete_count = $('#insurer_templete_count').val()
|
||||||
|
|
||||||
|
if(existing_insurer_id == '')
|
||||||
|
{
|
||||||
|
Swal.fire({
|
||||||
|
title: "warning!",
|
||||||
|
text: 'Please select the Insurer',
|
||||||
|
icon: "warning"
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('existing_insurer_id', existing_insurer_id)
|
||||||
|
console.log('copy_insurer_id', copy_insurer_id)
|
||||||
|
console.log('insurer_templete_count', insurer_templete_count)
|
||||||
|
|
||||||
|
$('#insurer').val('').change();
|
||||||
|
|
||||||
|
if(insurer_templete_count == 0){
|
||||||
|
copyTemplateAJAX(existing_insurer_id, copy_insurer_id)
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "The insurer already have export template?",
|
||||||
|
text: "If you want to approve this the existing template will be deleted!",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
copyTemplateAJAX(existing_insurer_id, copy_insurer_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyTemplateAJAX(existing_insurer_id, copy_insurer_id)
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("util/copy_insurer_templete/") ?>' + existing_insurer_id + '/' + copy_insurer_id,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('checkInsurerTemplete response', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == false){
|
||||||
|
toastr.error(res.message, 'ERROR');
|
||||||
|
}else{
|
||||||
|
toastr.success(res.message, 'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1,35 +1,3 @@
|
|||||||
<style>
|
|
||||||
|
|
||||||
body {
|
|
||||||
.multiselect-native-select {
|
|
||||||
position: relative;
|
|
||||||
/* bottom: 32px; */
|
|
||||||
select {
|
|
||||||
border: 0 !important;
|
|
||||||
clip: rect(0 0 0 0) !important;
|
|
||||||
height: 1px !important;
|
|
||||||
margin: -1px -1px -1px -3px !important;
|
|
||||||
overflow: hidden !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
position: absolute !important;
|
|
||||||
width: 1px !important;
|
|
||||||
left: 50%;
|
|
||||||
top: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect-container{
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect-selected-text{
|
|
||||||
float: left !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="row" id="insurer_add">
|
<div class="row" id="insurer_add">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -59,10 +27,24 @@ body {
|
|||||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<?php if(isset($insurer['id'])){ ?>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="#template-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="insurer_export_templete">
|
||||||
|
<span class="mr-1"><i class="mdi mdi-file-export font-16"></i></span>
|
||||||
|
<span class="d-none d-sm-inline-block">Insurer Export Templete</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<?php include('insurer_basic_info.php'); ?>
|
<?php include('insurer_basic_info.php'); ?>
|
||||||
<?php include('insurer_branch.php'); ?>
|
<?php include('insurer_branch.php'); ?>
|
||||||
|
<?php include('insurer_export_templete.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user