Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev
This commit is contained in:
commit
5f91f739d3
@ -183,6 +183,10 @@ class EmployeeController extends AdminController
|
|||||||
{
|
{
|
||||||
if(empty($post_data)){
|
if(empty($post_data)){
|
||||||
$post_data = $this->request->getPost();
|
$post_data = $this->request->getPost();
|
||||||
|
$post_data = array_merge($post_data, $this->request->getFiles());
|
||||||
|
$is_post_request = true;
|
||||||
|
}else{
|
||||||
|
$is_post_request = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $empDataServiceController = new EmpDataServiceController();
|
// $empDataServiceController = new EmpDataServiceController();
|
||||||
@ -339,7 +343,7 @@ class EmployeeController extends AdminController
|
|||||||
$avatar = isset($post_data['emplist']) ? $post_data['emplist'] : $this->request->getFile('emplist');
|
$avatar = isset($post_data['emplist']) ? $post_data['emplist'] : $this->request->getFile('emplist');
|
||||||
if (!$avatar) {
|
if (!$avatar) {
|
||||||
$this->myLogger->logme("error", 'File not found');
|
$this->myLogger->logme("error", 'File not found');
|
||||||
if (!empty($post_data)) {
|
if (!$is_post_request) {
|
||||||
return ['status' => false, 'message' => 'File not found'];
|
return ['status' => false, 'message' => 'File not found'];
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 400, 'message' => 'File not found'], 400);
|
return $this->respond(['dataStatus' => false, 'code' => 400, 'message' => 'File not found'], 400);
|
||||||
@ -355,7 +359,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme("error", 'File move successful');
|
$this->myLogger->logme("error", 'File move successful');
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme("error", 'File move failed');
|
$this->myLogger->logme("error", 'File move failed');
|
||||||
if (!empty($post_data)) {
|
if (!$is_post_request) {
|
||||||
return ['status' => false, 'message' => 'File move failed'];
|
return ['status' => false, 'message' => 'File move failed'];
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 500, 'message' => 'File move failed'], 500);
|
return $this->respond(['dataStatus' => false, 'code' => 500, 'message' => 'File move failed'], 500);
|
||||||
@ -363,7 +367,7 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme("error", 'Upload failed Invalid file');
|
$this->myLogger->logme("error", 'Upload failed Invalid file');
|
||||||
if (!empty($post_data)) {
|
if (!$is_post_request) {
|
||||||
return ['status' => false, 'message' => 'Invalid file'];
|
return ['status' => false, 'message' => 'Invalid file'];
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'Invalid file'], 404);
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'Invalid file'], 404);
|
||||||
@ -385,7 +389,7 @@ class EmployeeController extends AdminController
|
|||||||
$client_id = $post_data['client_id'] ?? null;
|
$client_id = $post_data['client_id'] ?? null;
|
||||||
$policy_id = $post_data['policy_id'] ?? null;
|
$policy_id = $post_data['policy_id'] ?? null;
|
||||||
$branch_id = $post_data['client_branch_id'] ?? null;
|
$branch_id = $post_data['client_branch_id'] ?? null;
|
||||||
$action = $post_data['file_action'] ?? null;
|
$action = "enrollment";
|
||||||
$enrollment_open_date = $post_data['enrollment_open_date'] ?? null;
|
$enrollment_open_date = $post_data['enrollment_open_date'] ?? null;
|
||||||
$enrollment_close_date = $post_data['enrollment_close_date'] ?? null;
|
$enrollment_close_date = $post_data['enrollment_close_date'] ?? null;
|
||||||
$status = 'inprogress';
|
$status = 'inprogress';
|
||||||
@ -405,7 +409,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
|
||||||
//endof validation process
|
//endof validation process
|
||||||
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
||||||
if(!empty($post_data)){
|
if(!$is_post_request){
|
||||||
return ['status' => false, 'message' => 'file rejected with errors', 'file_id' => $file_id];
|
return ['status' => false, 'message' => 'file rejected with errors', 'file_id' => $file_id];
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
|
||||||
@ -418,7 +422,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($post_data)) {
|
if (!$is_post_request) {
|
||||||
return ['status' => true, 'message' => 'File upload successs, Data validation is in-progress', 'file_id' => $file_id];
|
return ['status' => true, 'message' => 'File upload successs, Data validation is in-progress', 'file_id' => $file_id];
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
|
||||||
@ -507,7 +511,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
// dd($data['fileList']);die();
|
// dd($data['fileList']);die();
|
||||||
if ($_SERVER('REQUEST_METHOD') == "GET") {
|
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||||
$this->loadLayout('import_export', $data);
|
$this->loadLayout('import_export', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -687,7 +687,7 @@ class EmployeeRestController extends AdminController
|
|||||||
public function getEmployeeAndDependenceByClientId()
|
public function getEmployeeAndDependenceByClientId()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
|
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'), status_type: 'hr');
|
||||||
|
|
||||||
if ($empData) {
|
if ($empData) {
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class Cors implements FilterInterface
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected string $allowedMethods = 'GET,POST,PUT,PATCH,DELETE,OPTIONS';
|
protected string $allowedMethods = 'GET,POST,OPTIONS';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP headers allowed in CORS requests
|
* HTTP headers allowed in CORS requests
|
||||||
|
|||||||
@ -31,16 +31,16 @@ class JWTToken
|
|||||||
try{
|
try{
|
||||||
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
||||||
$id = $request_data['id'];
|
$id = $request_data['id'];
|
||||||
$data["token_time_out"] = time() + getenv('TOKENTIMEOUT');
|
$update["token_time_out"] = time() + getenv('TOKENTIMEOUT');
|
||||||
|
|
||||||
if(isset($data['emp_code'])){
|
if(isset($data['emp_code'])){
|
||||||
$model = new EmployeeModel();
|
$model = new EmployeeModel();
|
||||||
$model->update($id, $data);
|
$model->update($id, $update);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$models = new LevelContactModel();
|
$models = new LevelContactModel();
|
||||||
$id = $request_data['pre_hr_id'];
|
$id = $request_data['pre_hr_id'];
|
||||||
$models->update($id, $data);
|
$models->update($id, $update);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,10 +82,19 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "")
|
public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "", $status_type = "")
|
||||||
{
|
{
|
||||||
// dd($status);
|
// dd($status);
|
||||||
|
|
||||||
|
$status_query = "employee_polices.status"; // Default fallback
|
||||||
|
|
||||||
|
if ($status_type == "hr") {
|
||||||
|
$status_query = "CASE
|
||||||
|
WHEN employee_polices.status = 'enrolled' THEN 'under process'
|
||||||
|
ELSE employee_polices.status
|
||||||
|
END as status";
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->select([
|
$result = $this->select([
|
||||||
'employee_polices.*',
|
'employee_polices.*',
|
||||||
'policy_type.policy_type as policy_name',
|
'policy_type.policy_type as policy_name',
|
||||||
@ -147,8 +156,8 @@ class EmployeePolicyModel extends Model
|
|||||||
THEN "Newly Added"
|
THEN "Newly Added"
|
||||||
ELSE NULL
|
ELSE NULL
|
||||||
END) AS newly_added',
|
END) AS newly_added',
|
||||||
|
$status_query
|
||||||
])
|
], false)
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||||
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
|
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
|
||||||
|
|||||||
@ -302,14 +302,51 @@ function init() {
|
|||||||
function handleItemClick(e, item) {
|
function handleItemClick(e, item) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Execute the stored onclick handler
|
|
||||||
const onclickAttr = item.getAttribute('data-onclick');
|
const onclickAttr = item.getAttribute('data-onclick');
|
||||||
if (onclickAttr) {
|
if (onclickAttr) {
|
||||||
eval(onclickAttr);
|
// Regex to separate function name from the inside of the parentheses
|
||||||
|
// Example: myFunc(this, '123') -> match[1]="myFunc", match[2]="this, '123'"
|
||||||
|
const match = onclickAttr.match(/^(\w+)\((.*)\)$/);
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
const funcName = match[1];
|
||||||
|
const argsRaw = match[2];
|
||||||
|
|
||||||
|
if (typeof window[funcName] === 'function') {
|
||||||
|
// Parse the arguments string into a real array
|
||||||
|
const args = argsRaw.split(',').map(arg => {
|
||||||
|
let cleaned = arg.trim();
|
||||||
|
|
||||||
|
// 1. Handle the 'this' keyword
|
||||||
|
if (cleaned === 'this') return item;
|
||||||
|
|
||||||
|
// 2. Handle 'event' keyword
|
||||||
|
if (cleaned === 'event') return e;
|
||||||
|
|
||||||
|
// 3. Handle strings (remove single or double quotes)
|
||||||
|
if ((cleaned.startsWith("'") && cleaned.endsWith("'")) ||
|
||||||
|
(cleaned.startsWith('"') && cleaned.endsWith('"'))) {
|
||||||
|
return cleaned.substring(1, cleaned.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4. Handle numbers
|
||||||
|
if (!isNaN(cleaned) && cleaned !== "") {
|
||||||
|
return Number(cleaned);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cleaned;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Execute function:
|
||||||
|
// .apply(item, args) sets the 'this' inside the function to the clicked element
|
||||||
|
window[funcName].apply(item, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle standard navigation if it's a link
|
||||||
const href = item.getAttribute('href');
|
const href = item.getAttribute('href');
|
||||||
if (href && href !== '#') {
|
if (href && href !== '#' && !href.includes('javascript:void(0)')) {
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ option:disabled {
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Branch</label> <br />
|
<label>Branch</label> <br />
|
||||||
<select name="branch_id" class="form-control" id="branch_id" required>
|
<select name="client_branch_id" class="form-control" id="branch_id" required>
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -179,7 +179,7 @@
|
|||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<input type="hidden" id="file_client_id" name="client_id">
|
<input type="hidden" id="file_client_id" name="client_id">
|
||||||
<input type="hidden" id="file_policy_id" name="policy_id">
|
<input type="hidden" id="file_policy_id" name="policy_id">
|
||||||
<input type="hidden" id="file_branch_id" name="branch_id">
|
<input type="hidden" id="file_branch_id" name="client_branch_id">
|
||||||
<input type="hidden" id="file_enrollment_open_date" name="enrollment_open_date">
|
<input type="hidden" id="file_enrollment_open_date" name="enrollment_open_date">
|
||||||
<input type="hidden" id="file_enrollment_close_date" name="enrollment_close_date">
|
<input type="hidden" id="file_enrollment_close_date" name="enrollment_close_date">
|
||||||
<input type="hidden" id="file_upload_actions" name="upload-action-type">
|
<input type="hidden" id="file_upload_actions" name="upload-action-type">
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- JQuery CDN -->
|
<!-- JQuery CDN -->
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||||
|
|
||||||
<!-- Sweet Alert CDN -->
|
<!-- Sweet Alert CDN -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
<!-- select2 -->
|
<!-- select2 -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
|
||||||
|
|
||||||
<!-- <link rel="manifest" href="../manifest.json"> -->
|
<!-- <link rel="manifest" href="../manifest.json"> -->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user