MERGE_UAT_ISSUES
This commit is contained in:
commit
c9563d2b1b
@ -495,6 +495,11 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
$routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||
|
||||
$routes->get("hrFileList", "EmployeeRestController::hrFileList");
|
||||
$routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters");
|
||||
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
|
||||
$routes->post("hrFileUpload", "EmployeeRestController::hrFileUpload");
|
||||
|
||||
});
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||
|
||||
@ -133,12 +133,19 @@ class ClientController extends AdminController
|
||||
$field = $this->request->getPost('field');
|
||||
$value = $this->request->getPost('value');
|
||||
|
||||
// print_rr($value); die;
|
||||
if($value == '') return $this->response->setJSON(['isDuplicate' => false]);
|
||||
|
||||
// Load the database if not already loaded
|
||||
$db = db_connect();
|
||||
|
||||
// Perform the query
|
||||
$builder = $db->table($table);
|
||||
$isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0;
|
||||
if(is_array($value)){
|
||||
$isDuplicate = $builder->where($value)->where('is_active', 1)->countAllResults() > 0;
|
||||
}else{
|
||||
$isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0;
|
||||
}
|
||||
|
||||
// Return the result
|
||||
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||
|
||||
@ -27,6 +27,7 @@ use App\Models\ClientDepositModel;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\HrFileUploadModel;
|
||||
|
||||
|
||||
|
||||
@ -73,6 +74,7 @@ class EmployeeController extends AdminController
|
||||
protected $PolicyPremium2Model;
|
||||
protected $auditHistory;
|
||||
protected $userModel;
|
||||
protected $hrFileUploadModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -96,6 +98,7 @@ class EmployeeController extends AdminController
|
||||
$this->PolicyPremium2Model = new PolicyPremium2Model();
|
||||
$this->auditHistory = new AuditHistoryModel();
|
||||
$this->userModel = new userModel();
|
||||
$this->hrFileUploadModel = new HrFileUploadModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -1970,7 +1973,7 @@ class EmployeeController extends AdminController
|
||||
$policy_terms = isset($policy_details['policy_terms']) ? true : false;
|
||||
|
||||
$si_enhancement_true_or_false = 1;
|
||||
if($policy_terms){
|
||||
if($policy_terms == true){
|
||||
$policyTermsData = json_decode($policy_details['policy_terms']);
|
||||
|
||||
if (isset($policyTermsData->suminsuredenhancement) && $policyTermsData->suminsuredenhancement !== null) {
|
||||
@ -1983,7 +1986,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
$message = null;
|
||||
|
||||
if (!isset($policy_terms)) {
|
||||
if ($policy_terms == false) {
|
||||
$message .= 'Policy terms';
|
||||
}
|
||||
|
||||
@ -1993,7 +1996,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event']], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event'] ?? null], 200);
|
||||
|
||||
}
|
||||
|
||||
@ -2825,4 +2828,12 @@ class EmployeeController extends AdminController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ use App\Models\ClientBranchModel;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\SIMappingModel;
|
||||
use App\Models\InsurerModel;
|
||||
|
||||
use App\Models\HrFileUploadModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
@ -79,6 +79,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $siMappingModel;
|
||||
protected $employeeHelper;
|
||||
protected $insurerModel;
|
||||
protected $hrFileUploadModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -106,6 +107,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->siMappingModel = new SIMappingModel();
|
||||
$this->employeeHelper = new EmployeeHelper();
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->hrFileUploadModel = new HrFileUploadModel();
|
||||
|
||||
}
|
||||
|
||||
@ -1335,13 +1337,14 @@ class EmployeeRestController extends AdminController
|
||||
$array->family_floaters_of_dependent_and_gst_value = 0;
|
||||
}
|
||||
|
||||
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms')
|
||||
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.is_premium_summery as is_premium_summery, client_policy.enrolment_visibility')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.policy_type_id', 3 )
|
||||
->where('client_policy.is_addon', 1 )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.enrolment_visibility', 1 )
|
||||
->get()
|
||||
->getResult();
|
||||
if($checkGmcParentsPolicyExist)
|
||||
@ -1903,6 +1906,7 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('policy_status', 1)
|
||||
->where('is_active', 1)
|
||||
->where('enrolment_visibility', 1)
|
||||
->findAll();
|
||||
|
||||
if(count($clientPolicy))
|
||||
@ -3494,4 +3498,142 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
public function hrFileUpload()
|
||||
{
|
||||
try {
|
||||
// Check file
|
||||
$file = $this->request->getFile('file_name');
|
||||
if (!$file) {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => "Invalid file or file not uploaded.",
|
||||
'data' => "No Data"
|
||||
]);
|
||||
}
|
||||
|
||||
// Upload folder path
|
||||
$uploadPath = WRITEPATH . 'uploads/hr_files/';
|
||||
|
||||
// If directory not exists, create it
|
||||
if (!is_dir($uploadPath)) {
|
||||
mkdir($uploadPath, 0777, true);
|
||||
}
|
||||
|
||||
// New file name with timestamp
|
||||
$newFileName = time() . '_' . $file->getRandomName();
|
||||
|
||||
// Move file
|
||||
$file->move($uploadPath, $newFileName);
|
||||
|
||||
// Prepare data
|
||||
$data = [
|
||||
'client_id' => $this->request->getPost('client_id'),
|
||||
'client_branch_id' => $this->request->getPost('client_branch_id'),
|
||||
'policy_no' => $this->request->getPost('policy_no'),
|
||||
'file_name' => $newFileName,
|
||||
'file_action' => $this->request->getPost('file_action'),
|
||||
'status' => $this->request->getPost('status'),
|
||||
'created_by' => $this->request->getPost('created_by'),
|
||||
'updated_by' => $this->request->getPost('created_by'),
|
||||
];
|
||||
|
||||
// Save into DB
|
||||
$this->hrFileUploadModel->insert($data);
|
||||
|
||||
return $this->respondCreated([
|
||||
'status' => true,
|
||||
'message' => 'File uploaded successfully',
|
||||
'data' => $data
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hrFileDownload($id = null)
|
||||
{
|
||||
try {
|
||||
|
||||
$file_id = $this->request->getGet('id') ?? $id;
|
||||
|
||||
// Find record
|
||||
$record = $this->hrFileUploadModel->find($file_id);
|
||||
|
||||
if (!$record) {
|
||||
return $this->failNotFound("File record not found");
|
||||
}
|
||||
|
||||
$uploadPath = WRITEPATH . 'uploads/hr_files/';
|
||||
$filePath = $uploadPath . $record['file_name'];
|
||||
|
||||
if (!file_exists($filePath)) {
|
||||
return $this->failNotFound("File not found on server");
|
||||
}
|
||||
|
||||
// Force file download
|
||||
return $this->response->download($filePath, null)
|
||||
->setFileName($record['file_name']);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function hrFileList()
|
||||
{
|
||||
try {
|
||||
$request = service('request');
|
||||
$builder = $this->hrFileUploadModel;
|
||||
|
||||
// Allowed filter keys
|
||||
$filters = [
|
||||
'client_id',
|
||||
'client_branch_id',
|
||||
'policy_no',
|
||||
'file_action',
|
||||
'status',
|
||||
'created_by'
|
||||
];
|
||||
|
||||
// Apply filters dynamically
|
||||
foreach ($filters as $key) {
|
||||
$value = $request->getGetPost($key); // supports both GET and POST
|
||||
if (!empty($value)) {
|
||||
$builder->where($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch results
|
||||
$data = $builder->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'File list fetched successfully',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function hrFileUploadMasters()
|
||||
{
|
||||
try {
|
||||
//for inception upload
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'File inception upload masters',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -11,6 +11,7 @@ use App\Models\EmployeeModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\MailAttachmentModel;
|
||||
use Kint\Kint;
|
||||
|
||||
class sendMailNotification
|
||||
{
|
||||
@ -342,10 +343,10 @@ class sendMailNotification
|
||||
$gst = 0;
|
||||
}
|
||||
|
||||
// dd($payable_employee_array);
|
||||
// Kint::dump($payable_employee_array);
|
||||
// dd(count($payable_employee_array['emp_data']));
|
||||
|
||||
if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0 && $client_policy_data['is_premium_summery'] == 1){
|
||||
if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0){
|
||||
|
||||
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
|
||||
$temp_data = '';
|
||||
@ -402,7 +403,7 @@ class sendMailNotification
|
||||
// dd($si);
|
||||
|
||||
// Premium summery for show and hide the Additional premium data
|
||||
if($client_policy_data['is_premium_summery'] == 1){
|
||||
if($inner_item['payable_employee'] == 1 || $client_policy_data['is_premium_summery'] == 1){
|
||||
if($policy_premium_data['premium_type'] == 2){
|
||||
|
||||
$temp_data .= '<td>' . $si . '</td>';
|
||||
@ -458,7 +459,7 @@ class sendMailNotification
|
||||
$table_content .= '<th>Sum Insured</th>';
|
||||
|
||||
// Premium summery for show and hide the Additional premium data
|
||||
if($client_policy_data['is_premium_summery'] == 1){
|
||||
if($inner_item['payable_employee'] == 1 || $client_policy_data['is_premium_summery'] == 1){
|
||||
$table_content .= '<th>Premium</th>';
|
||||
$table_content .= '<th>GST</th>';
|
||||
}
|
||||
@ -471,7 +472,7 @@ class sendMailNotification
|
||||
$table_content .= '</table></div>';
|
||||
|
||||
// Premium summery for show and hide the Additional premium data
|
||||
if($client_policy_data['is_premium_summery'] == 1){
|
||||
if($inner_item['payable_employee'] == 1 || $client_policy_data['is_premium_summery'] == 1){
|
||||
$addon_list_array = [
|
||||
'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )',
|
||||
'addtional_premium' => round($addtional_premium),
|
||||
|
||||
34
app/Models/HrFileUploadModel.php
Normal file
34
app/Models/HrFileUploadModel.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class HrFileUploadModel extends Model
|
||||
{
|
||||
protected $table = 'hr_file_upload';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
// Allowed fields
|
||||
protected $allowedFields = [
|
||||
'client_id',
|
||||
'client_branch_id',
|
||||
'policy_no',
|
||||
'file_name',
|
||||
'file_action',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_by',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
// Automatically set timestamps
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
|
||||
// Return type
|
||||
protected $returnType = 'array';
|
||||
}
|
||||
@ -348,14 +348,14 @@
|
||||
<label for="email">Email<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email"
|
||||
name="email_corporate" data-parsley-trigger="change" data-parsley-type="email"
|
||||
onchange="validateInput(this, 'employees', 'email_corporate')" required>
|
||||
onkeyup="validateInput(this, 'employees', 'email_corporate')" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number"
|
||||
name="mobile" onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
||||
onchange="validateInput(this, 'employees', 'mobile')" required>
|
||||
onkeyup="validateInput(this, 'employees', 'mobile')" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -677,6 +677,11 @@ function send_mail_for_individual_employee_ecard(id) {
|
||||
|
||||
function validateInput(input, table, field) {
|
||||
|
||||
let emp_code = $('#emp_code_for_edit').val();
|
||||
let client_id = $('#clients').val();
|
||||
console.log("emp_code", emp_code);
|
||||
console.log("client_id", client_id);
|
||||
|
||||
let value = $(input).val();
|
||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||
|
||||
@ -685,10 +690,18 @@ function validateInput(input, table, field) {
|
||||
message = label + " already exists!";
|
||||
}
|
||||
|
||||
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
|
||||
let data = {};
|
||||
data["emp_code !="] = emp_code;
|
||||
data[field] = value;
|
||||
|
||||
console.log(data);
|
||||
|
||||
checkDuplicateTableFieldValue(table, field, data, function(isDuplicate) {
|
||||
if (isDuplicate) {
|
||||
toastr.warning(message, 'WARNING');
|
||||
$(input).val('')
|
||||
$("#btnSubmit").prop('disabled', true);
|
||||
}else{
|
||||
$("#btnSubmit").prop('disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
@ -722,7 +735,6 @@ function closeModal() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_emp_history(input, emp_id) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
@ -354,7 +354,7 @@ label {
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="waiverof30dayswaitingperiod" class="form-control waiverof30dayswaitingperiod"
|
||||
value="1">
|
||||
value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user