Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
vadivelJ96 2025-11-03 10:56:11 +05:30
commit d89cfd4ed9
5 changed files with 43 additions and 12 deletions

View File

@ -3471,6 +3471,15 @@ class EmployeeRestController extends AdminController
$received_data = $this->request->getPost();
$this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? []));
$get_file_data = $this->request->getFiles('claim_docs');
$get_docs_name = $this->request->getPost('claim_doc_names') ?? [];
if (is_string($get_docs_name)) {
$decoded = json_decode($get_docs_name, true);
$get_docs_name = json_last_error() === JSON_ERROR_NONE ? $decoded : [];
} elseif (!is_array($get_docs_name)) {
$get_docs_name = [];
}
// print_r($get_file_data); die;
$employee_id = $received_data['emp_id'];
$client_policy_id = $received_data['client_policy_id'];
@ -3479,7 +3488,7 @@ class EmployeeRestController extends AdminController
$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);
$file_data = multi_file_Upload($get_file_data, $file_path, $get_docs_name);
}
@ -3629,7 +3638,8 @@ class EmployeeRestController extends AdminController
$data = [
'ticket_id' => $ticket_id,
'doc_name' => $value['file_name'],
'doc_name' => $value['doc_name'],
'file_name' => $value['file_name'],
'url' => $value['file_path'],
'file_type' => 2,
'ticket_message_id' => $ticket_message_id,

View File

@ -1281,8 +1281,12 @@ class TicketController extends BaseController
// $actionType = $this->request->getGet();
$claimFiles = new ClaimFilesModel();
$file_data = $claimFiles->where('id', $claim_file_id)->first();
$fileName = $file_data['doc_name'];
// $fileName = $file_data['doc_name'];
$url = $file_data['url'];
$parts = explode('/', $url);
$fileName = end($parts);
$filePath = WRITEPATH . '/uploads/claim_files/' . $fileName;
try {

View File

@ -112,8 +112,9 @@ if (!function_exists('file_Upload_for_lead')) {
// }
// }
// function for only using in the Flutter Claim File Upload
if (!function_exists('multi_file_Upload')) {
function multi_file_Upload($fileToUpload, $filepath)
function multi_file_Upload($fileToUpload, $filepath, $docs_name = [])
{
$uploadedFiles = [];
@ -123,13 +124,15 @@ if (!function_exists('multi_file_Upload')) {
foreach ($files as $file) {
// If file is itself an array (multiple under same input name)
if (is_array($file)) {
foreach ($file as $f) {
foreach ($file as $index => $f) {
if ($f !== null && $f->isValid() && !$f->hasMoved()) {
$fileName = $f->getRandomName(); // safer unique name
$f->move($filepath, $fileName);
$fileRandomName = $f->getRandomName(); // safer unique name
$fileName = $f->getName();
$f->move($filepath, $fileRandomName);
$uploadedFiles[] = [
'file_name' => $fileName,
'file_path' => $filepath . $fileName
'doc_name' => $docs_name[$index] ?? $fileName,
'file_path' => $filepath . $fileRandomName
];
}
}

View File

@ -19,7 +19,8 @@ class ClaimFilesModel extends Model
'updated_by',
'created_at',
'updated_at',
'is_active'
'is_active',
'file_name',
];
// Callbacks

View File

@ -81,7 +81,7 @@ table.dataTable tbody td {
<th>S. No</th>
<th style="display: none;">User</th>
<th>Month</th>
<!-- <th style="display: none;">Business Type</th> -->
<th style="display: none;">Business Type</th>
<th style="display: none;">Client Type</th>
<th>Insured Name</th>
<th>Policy/<br>Endorsement</th>
@ -125,7 +125,7 @@ table.dataTable tbody td {
?>" class="mdi mdi-pencil" ></a> </td>
<td style="display: none;"><?php echo $row['user_name'] ?: 'N/A'; ?></td>
<td><?php echo $row['policy_issue_month'] ?: 'N/A'; ?></td>
<!-- <td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td> -->
<td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td>
<td style="display: none;"><?php echo $row['client_type'] ?: 'N/A'; ?></td>
<td><?php echo $row['client_name'] ?: 'N/A'; ?></td>
<td><?php echo $row['action_type'] ?: 'N/A'; ?></td>
@ -279,9 +279,22 @@ $(document).ready(function() {
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
title: 'Policy-Tranction-BDS-List',
exportOptions: {
columns: ':visible', // or specify exact columns [0,1,2,...]
columns: function (idx, data, node) {
return true; // ✅ include all columns (even hidden)
},
format: {
body: function (data, row, column, node) {
data = data.replace(/&nbsp;/g, '').replace(/\s+/g, ' ').trim();
// If it's the first column (index 0), remove link and special chars
if (column === 0 || column === 20 || column === 11 ) {
// Remove all <a> tags and their contents
data = data.replace(/<a[^>]*>(.*?)<\/a>/gi, '');
// Also remove other HTML tags and &nbsp;
data = $('<div>').html(data).text().replace(/\u00a0/g, ' ').trim();
}
// Force K and L columns to string
if (column === 10 || column === 11) {
// Option 1: prepend single quote