CHANGE_CLAIM_PUSH_CLAIM_FILE_UPLOAD
This commit is contained in:
parent
54fb5576a1
commit
ea7b5e807c
@ -2334,6 +2334,10 @@ class TicketController extends BaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
$get_file_data = $this->request->getFiles('file_upload') ?? [];
|
||||||
|
$ticket_id = $data['ticket_id_url'];
|
||||||
|
|
||||||
|
if(empty($get_file_data)){
|
||||||
|
|
||||||
$insertArr = [];
|
$insertArr = [];
|
||||||
|
|
||||||
@ -2359,23 +2363,32 @@ class TicketController extends BaseController
|
|||||||
$insert = $this->claimFilesModel->insertBatch($insertArr);
|
$insert = $this->claimFilesModel->insertBatch($insertArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($insert) && !empty($insert)) {
|
if (isset($insert) && !empty($insert)) {
|
||||||
|
|
||||||
if (isset($data['ticket_id_url']) && !empty($data['ticket_id_url'])) {
|
|
||||||
// this call for TPA integration
|
|
||||||
$ticket_id = $data['ticket_id_url'];
|
|
||||||
$apiServiceController = new ApiServiceController();
|
|
||||||
$apiServiceController->pushClaims($ticket_id);
|
|
||||||
log_message('error', "pushClaims function called with Ticket ID: {$ticket_id}, In Ticket Controller while claim file upload");
|
|
||||||
} else {
|
|
||||||
log_message('error', "Failed to call the pushClaims function in TicketController during claim file upload because the ticket id was not found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$get_docs_name = $data['docs_name'];
|
||||||
|
$file_data = [];
|
||||||
|
if(isset($get_file_data) && !empty($get_file_data)){
|
||||||
|
$file_path = WRITEPATH . 'uploads/claim_files/';
|
||||||
|
$file_data = multi_file_Upload($get_file_data, $file_path, $get_docs_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($file_data)){
|
||||||
|
$employeeRest = new EmployeeRestController();
|
||||||
|
$result = $employeeRest->handleCliamFiles($file_data, $ticket_id);
|
||||||
|
if(!empty($result)){
|
||||||
|
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUrlDataByTicketId()
|
public function getUrlDataByTicketId()
|
||||||
@ -2391,9 +2404,16 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$urlData = $this->claimFilesModel
|
$urlData = $this->claimFilesModel
|
||||||
|
->select("
|
||||||
|
*,
|
||||||
|
CASE
|
||||||
|
WHEN file_type = 2 AND url IS NOT NULL AND url != ''
|
||||||
|
THEN CONCAT('" . base_url('downloadClaimFile/') . "', id)
|
||||||
|
ELSE url
|
||||||
|
END AS url
|
||||||
|
")
|
||||||
->where('ticket_id', $ticket_id)
|
->where('ticket_id', $ticket_id)
|
||||||
->where('is_active',1)
|
->where('is_active', 1)
|
||||||
->where('file_type',1)
|
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
|
|||||||
@ -133,7 +133,8 @@ if (!function_exists('multi_file_Upload')) {
|
|||||||
$uploadedFiles[] = [
|
$uploadedFiles[] = [
|
||||||
'file_name' => $fileName,
|
'file_name' => $fileName,
|
||||||
'doc_name' => $docs_name[$index] ?? $fileName,
|
'doc_name' => $docs_name[$index] ?? $fileName,
|
||||||
'file_path' => $filepath . $fileRandomName
|
// 'file_path' => $filepath . $fileRandomName
|
||||||
|
'file_path' => $fileRandomName
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,14 @@
|
|||||||
|
|
||||||
<div id="dynamic-form-container">
|
<div id="dynamic-form-container">
|
||||||
<div align="right">
|
<div align="right">
|
||||||
<a class="btn btn-primary waves-effect waves-light mr-1"
|
<a id="toggle-upload-btn" class="btn btn-info waves-effect waves-light mr-1" onclick="toggleUploadType(this)">
|
||||||
onclick="addHTMLInput(this)">
|
File Upload
|
||||||
+ Add
|
|
||||||
</a>
|
</a>
|
||||||
|
<a class="btn btn-primary waves-effect waves-light" id="add_btn_for_claim_file_upload" onclick="addHTMLInput(this)">+ Add</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
@ -39,7 +40,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -112,6 +112,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
|
||||||
@ -180,8 +181,7 @@ $("#drive_file_upload_form").submit(function(event) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function addHTMLInput()
|
function addHTMLInput() {
|
||||||
{
|
|
||||||
const container = document.getElementById('dynamic-form-container');
|
const container = document.getElementById('dynamic-form-container');
|
||||||
const newRow = document.createElement('div');
|
const newRow = document.createElement('div');
|
||||||
newRow.className = 'form-row dynamic-form-row';
|
newRow.className = 'form-row dynamic-form-row';
|
||||||
@ -208,8 +208,7 @@ function addHTMLInput()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeHTMLInput(element)
|
function removeHTMLInput(element) {
|
||||||
{
|
|
||||||
const container = document.getElementById('dynamic-form-container');
|
const container = document.getElementById('dynamic-form-container');
|
||||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||||
|
|
||||||
@ -219,7 +218,7 @@ function removeHTMLInput(element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUrlDataByTicketId(ticket_id) {
|
function getUrlDataByTicketId(ticket_id) {
|
||||||
|
|
||||||
// Show loader
|
// Show loader
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -262,7 +261,6 @@ function openEditModal(id, docName, url) {
|
|||||||
$('#edit_url_modal').modal('show'); // Bootstrap modal
|
$('#edit_url_modal').modal('show'); // Bootstrap modal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function create_url_list(data) {
|
function create_url_list(data) {
|
||||||
$('#table_bd').empty(); // clear existing rows
|
$('#table_bd').empty(); // clear existing rows
|
||||||
|
|
||||||
@ -276,7 +274,7 @@ function create_url_list(data) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">${index + 1}</td>
|
<td class="text-center">${index + 1}</td>
|
||||||
<td>${item.doc_name}</td>
|
<td>${item.doc_name}</td>
|
||||||
<td><a href="${item.url}" target="_blank">${item.url}</a></td>
|
<td><a href="${item.url}" target="_blank">${item.file_type == 1 ? item.url : item.doc_name}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="javascript:void(0);" class="delete-url"
|
<a href="javascript:void(0);" class="delete-url"
|
||||||
style="bacolor:black;"
|
style="bacolor:black;"
|
||||||
@ -293,6 +291,7 @@ function create_url_list(data) {
|
|||||||
$('#table_bd').html('<tr><td colspan="4">No Data Found</td></tr>');
|
$('#table_bd').html('<tr><td colspan="4">No Data Found</td></tr>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.delete-url', function (e) {
|
$(document).on('click', '.delete-url', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const url = $(this).data('href');
|
const url = $(this).data('href');
|
||||||
@ -332,7 +331,68 @@ $(document).on('click', '.delete-url', function (e) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function addFileUploadHtml() {
|
||||||
|
const container = document.getElementById('dynamic-form-container');
|
||||||
|
const newRow = document.createElement('div');
|
||||||
|
newRow.className = 'form-row dynamic-form-row';
|
||||||
|
newRow.innerHTML = `
|
||||||
|
<div class="form-group col-md-5">
|
||||||
|
<label for="file_name">Document Name <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="docs_name" name="docs_name[]" placeholder="Enter file name" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-5">
|
||||||
|
<label for="file">Choose File <span class="text-danger">*</span></label>
|
||||||
|
<input type="file" class="form-control" id="file_upload" name="file_upload[]" accept=".pdf,.jpg,.jpeg,.png" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2" style="position: relative; top: 28px;">
|
||||||
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)" style="background-color: #BD0707;">
|
||||||
|
<i class="mdi mdi-delete"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
container.appendChild(newRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleUploadType(btn) {
|
||||||
|
|
||||||
|
const $btn = $(btn);
|
||||||
|
const $addBtn = $('#add_btn_for_claim_file_upload');
|
||||||
|
console.log('addBtn', $addBtn);
|
||||||
|
const $container = $('#dynamic-form-container');
|
||||||
|
const currentType = $btn.text().trim();
|
||||||
|
console.log('currentType', currentType);
|
||||||
|
|
||||||
|
// Remove all existing dynamic rows when mode changes
|
||||||
|
$container.find('.dynamic-form-row').remove();
|
||||||
|
|
||||||
|
if (currentType === 'URL Upload') {
|
||||||
|
|
||||||
|
$btn.text('File Upload').removeClass('btn-success').addClass('btn-info');
|
||||||
|
|
||||||
|
// Change the Add button action
|
||||||
|
$addBtn.attr('onclick', 'addHTMLInput(this)');
|
||||||
|
|
||||||
|
// Handle switching to file upload mode here
|
||||||
|
console.log('Switched to File Upload mode');
|
||||||
|
|
||||||
|
// call the function
|
||||||
|
addHTMLInput();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$btn.text('URL Upload').removeClass('btn-info').addClass('btn-success');
|
||||||
|
|
||||||
|
// Change the Add button action
|
||||||
|
$addBtn.attr('onclick', 'addFileUploadHtml(this)');
|
||||||
|
|
||||||
|
// Handle switching to URL upload mode here
|
||||||
|
console.log('Switched to URL Upload mode');
|
||||||
|
|
||||||
|
// call the function
|
||||||
|
addFileUploadHtml();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -484,13 +484,26 @@
|
|||||||
if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){
|
if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){
|
||||||
$("#event_type").removeAttr("multiple");
|
$("#event_type").removeAttr("multiple");
|
||||||
$("#event_type").attr("name", "event_type");
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
$("#event_type").select2('destroy');
|
$("#event_type").select2('destroy');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#event_type').on('change', function() {
|
$('#event_type').on('change', function() {
|
||||||
|
|
||||||
var selectedVal = $(this).val();
|
var selectedVal = $(this).val();
|
||||||
// console.log(selectedVal);
|
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||||
|
var action_type = $('#action_type').val()
|
||||||
|
|
||||||
|
console.log({tpa_api_sevice, selectedVal, insurer_or_tpa, action_type});
|
||||||
|
|
||||||
|
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer" || (selectedVal == 'correction' || selectedVal == 'deletion' || selectedVal == 'si_enhancement')) {
|
||||||
|
$('.fetch_tpa').hide();
|
||||||
|
} else {
|
||||||
|
$('.fetch_tpa').show();
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedVal === 'correction') {
|
if (selectedVal === 'correction') {
|
||||||
$('#policy').prop('required', false);
|
$('#policy').prop('required', false);
|
||||||
@ -502,12 +515,137 @@
|
|||||||
|
|
||||||
console.log('tpa_api_sevice', tpa_api_sevice);
|
console.log('tpa_api_sevice', tpa_api_sevice);
|
||||||
console.log('tpa_api_sevice type', typeof tpa_api_sevice);
|
console.log('tpa_api_sevice type', typeof tpa_api_sevice);
|
||||||
|
});
|
||||||
|
|
||||||
if (tpa_api_sevice == 0 || (selectedVal == 'correction' || selectedVal == 'deletion' || selectedVal == 'si_enhancement')) {
|
$('#insurer_or_tpa').on('change', function() {
|
||||||
|
|
||||||
|
var insurer_or_tpa = $(this).val()
|
||||||
|
var policy_value = $('#policy').val()
|
||||||
|
var event_type_data = $('#event_type_data').val();
|
||||||
|
var action_type = $('#action_type').val()
|
||||||
|
var event_string = $('#event_type').val();
|
||||||
|
|
||||||
|
console.log({tpa_api_sevice, insurer_or_tpa, policy_value, event_type_data, action_type, event_string});
|
||||||
|
|
||||||
|
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer" || (event_string == 'correction' || event_string == 'deletion' || event_string == 'si_enhancement')) {
|
||||||
$('.fetch_tpa').hide();
|
$('.fetch_tpa').hide();
|
||||||
} else {
|
} else {
|
||||||
$('.fetch_tpa').show();
|
$('.fetch_tpa').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
||||||
|
if(insurer_or_tpa == 'tpa'){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
}else if(insurer_or_tpa == 'insurer' && action_type == 'import'){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 1){
|
||||||
|
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
|
||||||
|
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 0){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if(policy_value != 0){
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#action_type').on('change', function() {
|
||||||
|
|
||||||
|
var action_type = $(this).val()
|
||||||
|
var policy_value = $('#policy').val()
|
||||||
|
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
||||||
|
var event_string = $('#event_type').val();
|
||||||
|
var event_type_data = $('#event_type_data').val();
|
||||||
|
|
||||||
|
console.log({tpa_api_sevice, action_type, policy_value, insurer_or_tpa, event_string, event_type_data})
|
||||||
|
|
||||||
|
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer" || (event_string == 'correction' || event_string == 'deletion' || event_string == 'si_enhancement')) {
|
||||||
|
$('.fetch_tpa').hide();
|
||||||
|
} else {
|
||||||
|
$('.fetch_tpa').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(action_type == 'import'){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
} else if(action_type == 'export' && insurer_or_tpa == 'tpa'){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 1){
|
||||||
|
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
|
||||||
|
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 0){
|
||||||
|
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
if ($.fn.select2 && $('#event_type').data('select2')) {
|
||||||
|
$('#event_type').select2('destroy');
|
||||||
|
}
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if(policy_value != 0){
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||||
|
$('#event_type').on('change', function() {
|
||||||
|
|
||||||
|
var selectedValue = $(this).val();
|
||||||
|
if (selectedValue !== '') {
|
||||||
|
$('#import_excel_download').show();
|
||||||
|
var fullURL = '<?= base_url("util/download_import_excel/"); ?>' + selectedValue;
|
||||||
|
$('#import_excel_download').attr('href', fullURL);
|
||||||
|
} else {
|
||||||
|
$('#import_excel_download').hide();
|
||||||
|
$('#import_excel_download').removeAttr('href');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#action_type').on('change', function() {
|
$('#action_type').on('change', function() {
|
||||||
@ -538,120 +676,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#insurer_or_tpa').on('change', function() {
|
|
||||||
|
|
||||||
var insurer_or_tpa = $(this).val()
|
|
||||||
var policy_value = $('#policy').val()
|
|
||||||
var event_type_data = $('#event_type_data').val();
|
|
||||||
var action_type = $('#action_type').val()
|
|
||||||
var event_type_data = $('#event_type_data').val();
|
|
||||||
|
|
||||||
console.log('policy_value', policy_value)
|
|
||||||
|
|
||||||
// if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
|
||||||
if(insurer_or_tpa == 'tpa'){
|
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
|
||||||
$("#event_type").attr("name", "event_type");
|
|
||||||
$("#event_type").select2('destroy');
|
|
||||||
|
|
||||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'import'){
|
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
|
||||||
$("#event_type").attr("name", "event_type");
|
|
||||||
$("#event_type").select2('destroy');
|
|
||||||
|
|
||||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 1){
|
|
||||||
|
|
||||||
$("#event_type").attr("multiple", "multiple");
|
|
||||||
$("#event_type").attr("name", "event_type[]");
|
|
||||||
$("#event_type").select2();
|
|
||||||
|
|
||||||
}else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 0){
|
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
|
||||||
$("#event_type").attr("name", "event_type");
|
|
||||||
$("#event_type").select2('destroy');
|
|
||||||
|
|
||||||
}else{
|
|
||||||
if(policy_value != 0){
|
|
||||||
$("#event_type").attr("multiple", "multiple");
|
|
||||||
$("#event_type").attr("name", "event_type[]");
|
|
||||||
$("#event_type").select2();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer") {
|
|
||||||
$('.fetch_tpa').hide();
|
|
||||||
} else {
|
|
||||||
$('.fetch_tpa').show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#action_type').on('change', function() {
|
|
||||||
|
|
||||||
var action_type = $(this).val()
|
|
||||||
var policy_value = $('#policy').val()
|
|
||||||
var insurer_or_tpa = $('#insurer_or_tpa').val()
|
|
||||||
|
|
||||||
var event_type_data = $('#event_type_data').val();
|
|
||||||
|
|
||||||
console.log('policy_value', policy_value)
|
|
||||||
// if(insurer_or_tpa == 'import' || event_type_data == 0){
|
|
||||||
|
|
||||||
if(action_type == 'import'){
|
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
|
||||||
$("#event_type").attr("name", "event_type");
|
|
||||||
$("#event_type").select2('destroy');
|
|
||||||
|
|
||||||
} else if(action_type == 'export' && insurer_or_tpa == 'tpa'){
|
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
|
||||||
$("#event_type").attr("name", "event_type");
|
|
||||||
$("#event_type").select2('destroy');
|
|
||||||
|
|
||||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 1){
|
|
||||||
|
|
||||||
$("#event_type").attr("multiple", "multiple");
|
|
||||||
$("#event_type").attr("name", "event_type[]");
|
|
||||||
$("#event_type").select2();
|
|
||||||
|
|
||||||
}else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 0){
|
|
||||||
|
|
||||||
$("#event_type").removeAttr("multiple");
|
|
||||||
$("#event_type").attr("name", "event_type");
|
|
||||||
$("#event_type").select2('destroy');
|
|
||||||
|
|
||||||
}else{
|
|
||||||
if(policy_value != 0){
|
|
||||||
$("#event_type").attr("multiple", "multiple");
|
|
||||||
$("#event_type").attr("name", "event_type[]");
|
|
||||||
$("#event_type").select2();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tpa_api_sevice == 0 || action_type == 'export' || insurer_or_tpa == "insurer") {
|
|
||||||
$('.fetch_tpa').hide();
|
|
||||||
} else {
|
|
||||||
$('.fetch_tpa').show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
|
||||||
$('#event_type').on('change', function() {
|
|
||||||
|
|
||||||
var selectedValue = $(this).val();
|
|
||||||
if (selectedValue !== '') {
|
|
||||||
$('#import_excel_download').show();
|
|
||||||
var fullURL = '<?= base_url("util/download_import_excel/"); ?>' + selectedValue;
|
|
||||||
$('#import_excel_download').attr('href', fullURL);
|
|
||||||
} else {
|
|
||||||
$('#import_excel_download').hide();
|
|
||||||
$('#import_excel_download').removeAttr('href');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Function to convert object to query parameters
|
// Function to convert object to query parameters
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user