CHANGE_CLIENT_ONBOARDING_ADD_CLIENT_LOGO_IS_DOWNLOAD_BTN_POLICY_IS_ADDON : RV
This commit is contained in:
parent
5882b2c7e0
commit
16a730b3c5
@ -230,8 +230,10 @@ class ClientController extends AdminController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$this->myLogger->logme('error','Client general info function called');
|
$this->myLogger->logme('error','Client general info function called');
|
||||||
|
$file_name = file_Upload($this->request->getFile('client_logo'));
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$data['created_by'] = get_session_userid();
|
$data['created_by'] = get_session_userid();
|
||||||
|
$data['client_logo'] = $file_name;
|
||||||
$insert = $this->clientModel->insert($data);
|
$insert = $this->clientModel->insert($data);
|
||||||
if($insert){
|
if($insert){
|
||||||
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||||
@ -246,9 +248,13 @@ class ClientController extends AdminController
|
|||||||
public function editClientGeneralInfo()
|
public function editClientGeneralInfo()
|
||||||
{
|
{
|
||||||
$this->myLogger->logme('error','edit client general info function called');
|
$this->myLogger->logme('error','edit client general info function called');
|
||||||
|
$file_name = file_Upload($this->request->getFile('client_logo'));
|
||||||
$id = $this->request->getPost('PrimaryKey');
|
$id = $this->request->getPost('PrimaryKey');
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$data['updated_by'] = get_session_userid();
|
$data['updated_by'] = get_session_userid();
|
||||||
|
if(!empty($file_name)){
|
||||||
|
$data['client_logo'] = $file_name;
|
||||||
|
}
|
||||||
$update = $this->clientModel->update($id,$data);
|
$update = $this->clientModel->update($id,$data);
|
||||||
if($update){
|
if($update){
|
||||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||||
@ -511,6 +517,8 @@ class ClientController extends AdminController
|
|||||||
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
||||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||||
|
$data['is_addon'] = $this->request->getPost('is_addon');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -565,6 +573,7 @@ class ClientController extends AdminController
|
|||||||
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
||||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||||
|
$data['is_addon'] = $this->request->getPost('is_addon');
|
||||||
|
|
||||||
$data['updated_by'] = get_session_userid();
|
$data['updated_by'] = get_session_userid();
|
||||||
$insert = $this->clientPolicyModel->update($id,$data);
|
$insert = $this->clientPolicyModel->update($id,$data);
|
||||||
@ -583,7 +592,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function createClientPolicyPremium()
|
public function createClientPolicyPremium()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$policy_type = $this->request->getPost('policy_type');
|
$policy_type = $this->request->getPost('policy_type');
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||||
@ -767,7 +776,7 @@ class ClientController extends AdminController
|
|||||||
}else{
|
}else{
|
||||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Handle exceptions here
|
// Handle exceptions here
|
||||||
echo 'Error: ' . $e->getMessage();
|
echo 'Error: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ use App\Models\FileModel;
|
|||||||
use App\Models\BatchListModel;
|
use App\Models\BatchListModel;
|
||||||
use App\Models\BatchFileModel;
|
use App\Models\BatchFileModel;
|
||||||
use App\Models\EmpEndorsementModel;
|
use App\Models\EmpEndorsementModel;
|
||||||
|
use App\Models\ClientDepositModel;
|
||||||
|
|
||||||
use App\Controllers\Jobs ;
|
use App\Controllers\Jobs ;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
@ -32,6 +33,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
protected $batchListModel;
|
protected $batchListModel;
|
||||||
protected $batchFileModel;
|
protected $batchFileModel;
|
||||||
protected $empEndorsementModel;
|
protected $empEndorsementModel;
|
||||||
|
protected $clientDepositModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -46,6 +48,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->batchListModel = new BatchListModel();
|
$this->batchListModel = new BatchListModel();
|
||||||
$this->batchFileModel = new BatchFileModel();
|
$this->batchFileModel = new BatchFileModel();
|
||||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||||
|
$this->clientDepositModel = new ClientDepositModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -366,32 +369,31 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function cashDepositCalculationForInception($arrayData = [])
|
public function cashDepositCalculationForInception($arrayData = [])
|
||||||
{
|
{
|
||||||
$arrayData = array(
|
if (!empty($arrayData)) {
|
||||||
array(
|
$query = $this->employeePolicyModel->query("
|
||||||
0 => 6,
|
SELECT SUM(rata_premimum + gst) AS total_sum
|
||||||
1 => 10,
|
FROM employee_polices
|
||||||
2 => 17,
|
WHERE id IN (" . implode(',', $arrayData) . ")
|
||||||
3 => 101,
|
");
|
||||||
4 => 102
|
$row = $query->getRow();
|
||||||
),
|
$
|
||||||
);
|
$insert = $this->clientDepositModel->insert();
|
||||||
|
$query = $this->clientDepositModel->orderBy('id', 'DESC')->limit(1)->get();
|
||||||
|
$cashDepositLastEntry = $query->getRow();
|
||||||
|
|
||||||
// Flatten the array to get all IDs in a single array
|
print_r($cashDepositLastEntry); die;
|
||||||
$idArray = call_user_func_array('array_merge', $arrayData);
|
|
||||||
|
|
||||||
// Select from the employee_policy table where the id is in the $idArray
|
|
||||||
$results = $this->employeePolicyModel
|
return $row ? $row->total_sum : 0;
|
||||||
->select('employee_polices.pro_rata_premium')
|
|
||||||
->whereIn('id', $idArray)
|
} else {
|
||||||
->get()
|
return 0;
|
||||||
->getResultArray();
|
}
|
||||||
|
|
||||||
// Output the results
|
|
||||||
print_r($results); die;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cashDepositCalculationForSIEnhancement($arrayData)
|
public function cashDepositCalculationForSIEnhancement($arrayData = [])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -399,11 +399,11 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
$action = ['action' => 'inception'];
|
$action = ['action' => 'inception'];
|
||||||
|
|
||||||
$depositeData = [
|
// $depositeData = [
|
||||||
$employeeIds,
|
// $employeeIds,
|
||||||
$action
|
// ];
|
||||||
];
|
// print_r($employeeIds); die;
|
||||||
$empDataServiceController->cashDepositCalculationForInception();
|
$empDataServiceController->cashDepositCalculationForInception($employeeIds);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($depositeData); die;
|
// print_r($depositeData); die;
|
||||||
|
|
||||||
|
|||||||
@ -44,32 +44,53 @@ if (!function_exists('change_date_format')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('file_Upload')) {
|
if (!function_exists('file_Upload')) {
|
||||||
|
|
||||||
function file_Upload($fileToUpload, $imageDetails = null)
|
function file_Upload($fileToUpload, $imageDetails = null)
|
||||||
{
|
{
|
||||||
$fileName = $fileToUpload->getClientName();
|
// Retrieve the name of the file
|
||||||
if ($fileToUpload !== NULL && $fileName !== "") {
|
$fileName = $fileToUpload->getName();
|
||||||
|
|
||||||
|
// Check if the file is not null and has a name
|
||||||
|
if ($fileToUpload !== null && $fileName !== "") {
|
||||||
|
// Check if the file is valid and has not been moved already
|
||||||
if ($fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
if ($fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
||||||
// Check if the image exists in the upload folder
|
// Construct the path where the image should exist
|
||||||
$existingImagePath = ROOTPATH . 'public/uploads/' . $imageDetails; // Adjust filename field based on your database structure
|
$existingImagePath = ROOTPATH . 'public/uploads/logo/' . $imageDetails;
|
||||||
|
|
||||||
|
// Check if imageDetails is not null and if the image exists in the upload folder
|
||||||
if ($imageDetails !== null && file_exists($existingImagePath)) {
|
if ($imageDetails !== null && file_exists($existingImagePath)) {
|
||||||
// If the image exists, delete it
|
// If the image exists, delete it
|
||||||
unlink($existingImagePath);
|
unlink($existingImagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the new image to the upload folder
|
// Move the new image to the upload folder
|
||||||
$fileToUpload->move(ROOTPATH . 'public/uploads', $fileName);
|
$fileToUpload->move(ROOTPATH . 'public/uploads/logo', $fileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Set fileName to empty string if file is null or doesn't have a name
|
||||||
$fileName = "";
|
$fileName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the file name
|
||||||
return $fileName;
|
return $fileName;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('compressImage')) {
|
||||||
|
function compressImage($file, $destinationPath, $newWidth = 100, $newHeight = 100)
|
||||||
|
{
|
||||||
|
// Load the image manipulation library
|
||||||
|
$image = \Config\Services::image();
|
||||||
|
|
||||||
|
// Resize and compress the image
|
||||||
|
$image->withFile($file)
|
||||||
|
->fit($newWidth, $newHeight, 'center')
|
||||||
|
->save($destinationPath);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('fancy_date_time_format'))
|
if (!function_exists('fancy_date_time_format'))
|
||||||
{
|
{
|
||||||
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
||||||
|
|||||||
@ -21,6 +21,8 @@ class ClientModel extends Model
|
|||||||
"city",
|
"city",
|
||||||
"state",
|
"state",
|
||||||
"pincode",
|
"pincode",
|
||||||
|
"is_download_btn",
|
||||||
|
"client_logo",
|
||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
"is_active",
|
"is_active",
|
||||||
|
|||||||
@ -33,6 +33,7 @@ class ClientPolicyModel extends Model
|
|||||||
"claims_incurred_amount",
|
"claims_incurred_amount",
|
||||||
"policy_terms",
|
"policy_terms",
|
||||||
"open_for_enrollment",
|
"open_for_enrollment",
|
||||||
|
"is_addon",
|
||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
"Is_active",
|
"Is_active",
|
||||||
|
|||||||
@ -103,6 +103,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="gst">Logo</label>
|
||||||
|
<input type="file" name="client_logo" id="client_logo" onchange="PreviewImage();"><br>
|
||||||
|
<span class="text-danger"> Image dimensions 100 x 100 pixels and size of 200KB. </span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6 float-right" style="position: relative;top: 20px;">
|
||||||
|
<img src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : 'http://ssl.gstatic.com/accounts/ui/avatar_2x.png' ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<input value="1" type="checkbox" name="is_download_btn" <?= (isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
|
||||||
|
<label>Download Excel</label>
|
||||||
|
</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"
|
||||||
@ -122,6 +137,12 @@
|
|||||||
var PrimaryKey = $('#general_PrimaryKey').val();
|
var PrimaryKey = $('#general_PrimaryKey').val();
|
||||||
var form_action = '';
|
var form_action = '';
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#client_logo').change(function() {
|
||||||
|
validateFile(this);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$("#general_form").submit(function(event) {
|
$("#general_form").submit(function(event) {
|
||||||
@ -159,6 +180,8 @@ $(document).ready(function () {
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
if(res){
|
if(res){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
||||||
@ -246,5 +269,71 @@ function onlyNumbers(event){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PreviewImage() {
|
||||||
|
var oFReader = new FileReader();
|
||||||
|
oFReader.readAsDataURL(document.getElementById("client_logo").files[0]);
|
||||||
|
|
||||||
|
oFReader.onload = function (oFREvent) {
|
||||||
|
document.getElementById("uploadPreview").src = oFREvent.target.result;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// function validateFile(input) {
|
||||||
|
// const file = input.files[0];
|
||||||
|
// const allowedExtensions = ["jpg", "jpeg", "png"];
|
||||||
|
// const fileExtension = file.name.split(".").pop().toLowerCase();
|
||||||
|
|
||||||
|
// if (!allowedExtensions.includes(fileExtension)) {
|
||||||
|
// toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
|
||||||
|
// document.getElementById("uploadPreview").src = "http://ssl.gstatic.com/accounts/ui/avatar_2x.png";
|
||||||
|
// input.value = "";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
function validateFile(input) {
|
||||||
|
const file = input.files[0];
|
||||||
|
const allowedExtensions = ["jpg", "jpeg", "png"];
|
||||||
|
const fileExtension = file.name.split(".").pop().toLowerCase();
|
||||||
|
|
||||||
|
// Check if the file extension is allowed
|
||||||
|
if (!allowedExtensions.includes(fileExtension)) {
|
||||||
|
toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
|
||||||
|
document.getElementById("uploadPreview").src = "";
|
||||||
|
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||||
|
input.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check file size
|
||||||
|
const fileSize = file.size / 1024; // in KB
|
||||||
|
if (fileSize > 200) {
|
||||||
|
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
|
||||||
|
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||||
|
input.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check image dimensions
|
||||||
|
const img = new Image();
|
||||||
|
img.onload = function() {
|
||||||
|
if (this.width !== 100 || this.height !== 100) {
|
||||||
|
toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.');
|
||||||
|
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||||
|
input.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If both size and dimensions are valid, you can proceed with your logic here
|
||||||
|
// For example, you can display the image
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = function(e) {
|
||||||
|
document.getElementById("uploadPreview").src = e.target.result;
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
};
|
||||||
|
img.src = URL.createObjectURL(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -85,13 +85,18 @@
|
|||||||
<label for="policy_status">Policy Status</label>
|
<label for="policy_status">Policy Status</label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
<div >
|
||||||
|
<input value="1" type="checkbox" name="is_addon" id="is_addon">
|
||||||
|
<label >Add On</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<!-- <hr> -->
|
||||||
|
|
||||||
<div id="policy_fields"></div>
|
<div id="policy_fields"></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"
|
||||||
id="btnSubmit">Submit</button>
|
id="btnSubmit">Submit</button>
|
||||||
@ -246,6 +251,8 @@
|
|||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
if (res.status === false) {
|
if (res.status === false) {
|
||||||
toastr.error('Policy Dose Not Create', 'Error');
|
toastr.error('Policy Dose Not Create', 'Error');
|
||||||
@ -365,6 +372,8 @@
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
console.log(res)
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -392,6 +401,12 @@
|
|||||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||||
$('#policy_status_field').show();
|
$('#policy_status_field').show();
|
||||||
|
|
||||||
|
if (res.data.is_addon == 1) {
|
||||||
|
$('#is_addon').prop('checked', true);
|
||||||
|
} else {
|
||||||
|
$('#is_addon').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
/** do not delete this comment condition
|
/** do not delete this comment condition
|
||||||
|
|
||||||
// if(res.data.policy_type_id == 1){
|
// if(res.data.policy_type_id == 1){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user