MERGE_BRANCH_MULTI_CONTACT_ISSUE

This commit is contained in:
velz 2024-03-30 15:21:58 +05:30
commit 2fd40d2069
9 changed files with 160 additions and 90 deletions

View File

@ -499,6 +499,8 @@ class EmployeeRestController extends AdminController
$client_id = $this->request->getPost('client_id');
// $client_id = $this->request->getJSON('client_id');
$policy_id = $this->request->getPost('policy_id');
$employee_id = $this->request->getPost('employee_id');
// $policy_id = $this->request->getJSON('policy_id');
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
@ -538,7 +540,7 @@ class EmployeeRestController extends AdminController
$extractData['status']= 'success';
$extractData['policy_id']= $policy_id;
$extractData['action']= 'enrollment';
// $extractData['created_by']=set_session_context('Employee');
$extractData['created_by']=$employee_id;
$file_data =$this->fileModel->insert($extractData);
@ -696,6 +698,7 @@ class EmployeeRestController extends AdminController
$emp_id =$employee['id'];
$id =$emp_id;
$data_after_gpa_or_gmc['id'] = $id;
$data_after_gpa_or_gmc['updated_by'] = $employee_id;
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
if ($result) {
@ -706,6 +709,7 @@ class EmployeeRestController extends AdminController
if ($dataToInsert[$a]['emp_code'] != 0) {
$result =false;
if (count($data_after_gpa_or_gmc) != 0) {
$data_after_gpa_or_gmc['created_by'] = $employee_id;
$result = $this->employeeModel->insert($data_after_gpa_or_gmc);
}
$emp_id =$result;

View File

@ -17,6 +17,7 @@ use App\Models\FileModel;
use App\Models\EmpEndorsementModel;
use App\Controllers\Jobs ;
use App\Controllers\JobWorker ;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use Kint\Kint;
@ -266,8 +267,9 @@ class EmployeeServiceController extends AdminController
{
//proceed next data level validation in JOB queue
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
$jobWorker = new JobWorker();
JobWorker::processJob($r);
}
return $result;
@ -438,6 +440,8 @@ class EmployeeServiceController extends AdminController
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
$jobWorker = new JobWorker();
JobWorker::processJob($r);
}
return $result;

View File

@ -27,6 +27,14 @@ class JobWorker extends AdminController
// }
}
public static function streamOutput($data)
{
ob_implicit_flush(true);
// try { ob_end_flush(); } catch(Exception $e) { echo $e->getMessage(); }
echo $data;
flush();
}
public static function processJobs(array $jobdata = [])
{
// echo 'listen';//die();
@ -49,6 +57,7 @@ class JobWorker extends AdminController
//sleep(1);
SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]);
usleep( 500000 );
}
}
}
@ -86,8 +95,15 @@ class JobWorker extends AdminController
{
$job = $job[0];
echo "\nProcessing job id - " . $job->id . "\n";
echo "Job name - " . $job->name . "\n";
// echo "\nProcessing job id - " . $job->id . "\n";
SELF::streamOutput("\nProcessing job id - " . $job->id . "\n");
// sleep(5);
// echo "Job name - " . $job->name . "\n";
SELF::streamOutput("Job name - " . $job->name . "\n");
// sleep(5);
// print_r(SELF::$event_class_mapping);
// echo array_key_exists($job->name,SELF::$event_class_mapping) ? 'mapped' : 'notmapped';
// die();
@ -173,7 +189,8 @@ class JobWorker extends AdminController
]);
// echo "Job $job->id $job_status. Response - $response \n";
echo "Job $job->id $job_status \n";
// echo "Job $job->id $job_status \n";
SELF::streamOutput("Job $job->id $job_status \n");
return true;
}
else

View File

@ -172,6 +172,11 @@ $(document).ready(function () {
$('.ac').css('display', 'block');
contactCount = 1
var addButton = document.getElementById('add');
if (addButton.style.display === 'none') {
addButton.style.display = 'block';
}
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
@ -205,12 +210,7 @@ $(document).ready(function () {
$('#branch_form')[0].reset();
$('.ac').css('display', 'block');
$('.parsley-errors-list').remove();
$('#branch_form').parsley().reset();
contactCount = 1
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
@ -282,14 +282,14 @@ $(document).ready(function () {
var branchTableInsert = ''
$.each(res.data, function(index, item) {
branchTableInsert += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeClientBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
</tr>
</td>
</tr>
`;
});
$('#branch_list').append(branchTableInsert);
@ -311,6 +311,22 @@ $(document).ready(function () {
$('body').on('click', '.btnBranchEdit', function () {
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
contactCount = 1
$('.loader').fadeIn();
$('.loader-mask').fadeIn();

View File

@ -132,71 +132,7 @@
insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
$('#add_branch').hide();
$('.btnBack').hide();
$('#btnBranchAdd').click(function(){
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
contactCount = 1
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
})
$('.btnBack').click(function(){
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
})
$('.btnBack').hide();
if(insurer_Branch_PrimaryKey !== ''){
@ -204,12 +140,12 @@
var data = <?= isset($insuer_branch) ? json_encode($insuer_branch) : '[]' ?>;
$.each(data, function(index, item) {
branchTable += `
<tr>
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeInsurerBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeInsurerBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
</tr>
`;
@ -220,6 +156,73 @@
});
$('#btnBranchAdd').click(function(){
$("#insurer_branch_form")[0].reset();
contactCount = 1
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
contactCount = 1
var addButton = document.getElementById('add');
if (addButton.style.display === 'none') {
addButton.style.display = 'block';
}
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
})
$('.btnBack').click(function(){
$("#insurer_branch_form")[0].reset();
contactCount = 1
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
})
$("#insurer_branch_form").submit(function(events) {
console.log(1, insurer_branch_form_action);
events.preventDefault();
@ -238,6 +241,7 @@
processData: false,
contentType: false,
success: function(res) {
$("#insurer_branch_form")[0].reset();
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
@ -254,7 +258,6 @@
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeInsurerBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
</tr>
`;
});
@ -284,7 +287,7 @@
$('body').on('click', '.btnBranchEdit', function () {
$('#container').html("");
contactCount =1;
contactCount = 1;
var branch_id = $(this).attr('data-id');
$('#insurer_Branch_PrimaryKey').val(branch_id);
@ -469,8 +472,6 @@
}
function removeInsurerBranch(element) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("master/insurer/branch/remove/") ?>' + id;

View File

@ -554,6 +554,9 @@
</li>
<li>
<a href="<?= base_url('/employee/upload')?>">Upload</a>
</li>
<li>
<a href="<?= base_url('/employee/endorsement-list')?>">Endorsement List</a>
</li>
</ul>
</div>

View File

@ -153,7 +153,10 @@ $(document).ready(function () {
$('#mobile').val('');
$('#designation').val('');
var addButton = document.getElementById('add');
if (addButton.style.display === 'none') {
addButton.style.display = 'block';
}
contactCount = 1
@ -407,7 +410,7 @@ var html = `
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
<input data-parsley-type="number" data-parsley-length="[10,10]" value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
</div>
</div>
<div class="form-group" style="display: flex;">

19
bitbucket-pipelines.yml Normal file
View File

@ -0,0 +1,19 @@
# Template PHP Build
# This template allows you to validate your PHP application.
# The workflow allows running tests and code linting on the default branch.
image: composer:2.0
pipelines:
default:
- parallel:
- step:
name: Test
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp push -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_URL
caches:
- composer

View File

@ -175,6 +175,9 @@ paths:
policy_id:
type: integer
description: policy_id
employee_id:
type: integer
description: employee_id
file:
type: string
format: binary