From 0c00f37cb91be66919fbe189163f26773f79159b Mon Sep 17 00:00:00 2001 From: vadivel J Date: Wed, 23 Oct 2024 18:28:47 +0530 Subject: [PATCH 1/8] add edit employee file upload --- app/Controllers/Employeedetails.php | 85 ++++--- app/Views/addEmployeenew.php | 152 ++++++------ app/Views/editEmployeenew.php | 372 +++++++++++++++++----------- 3 files changed, 359 insertions(+), 250 deletions(-) diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index 4a150801..0c9a425f 100755 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -338,11 +338,25 @@ class Employeedetails extends BaseController if ($result) { // Get the uploaded files - $files = $this->request->getFiles(); - $fileNames = $this->request->getPost('file_name'); // Get user-entered file names - if (isset($files['emp_file'])) { - foreach ($files['emp_file'] as $index => $file) { - if ($file->isValid() && !$file->hasMoved()) { + $files1 = $this->request->getFile('emp_file1'); + $files2 = $this->request->getFile('emp_file2'); + $files3 = $this->request->getFile('emp_file3'); + $files4 = $this->request->getFile('emp_file4'); + $files5 = $this->request->getFile('emp_file5'); + + $files=[$files1,$files2,$files3,$files4,$files5]; + + $fileName1 = $this->request->getPost('file_name1'); + $fileName2 = $this->request->getPost('file_name2'); + $fileName3 = $this->request->getPost('file_name3'); + $fileName4 = $this->request->getPost('file_name4'); + $fileName5 = $this->request->getPost('file_name5'); + + $fileNames=[$fileName1,$fileName2,$fileName3,$fileName4,$fileName5]; + + if (!empty($files)) { + foreach ($files as $index => $file) { + if ($ffile && $file->isValid() && !$file->hasMoved()) { // Move the file to the desired directory $newName = $file->getRandomName(); $file->move(ROOTPATH . 'public/uploads/images/emp_files', $newName); @@ -619,12 +633,6 @@ class Employeedetails extends BaseController $EmpId = $this->request->getPost('employeeid'); - - - - - - $EmpId = $this->request->getPost('employeeid'); $PictureName = $this->request->getPost('Image'); $ModifyPictureName = $this->request->getPost('ModifyImage'); @@ -816,27 +824,42 @@ class Employeedetails extends BaseController //print_r($Employee);die(); $result = $this->employeedetails_model->UpdateEmployee($Employee, $EmpId); - // Get the uploaded files - $files = $this->request->getFiles(); - $fileNames = $this->request->getPost('file_name'); // Get user-entered file names - if (isset($files['emp_file'])) { - foreach ($files['emp_file'] as $index => $file) { - if ($file->isValid() && !$file->hasMoved()) { - // Move the file to the desired directory - $newName = $file->getRandomName(); - $file->move(ROOTPATH . 'public/uploads/images/emp_files', $newName); - $path = ROOTPATH . 'public/uploads/images/emp_files/' . $newName; - // Store the file information in the database - $this->empFiles->save([ - 'file_name' => $fileNames[$index], // User-entered file name - 'emp_file' => $newName, // New file name - 'emp_id' => $EmpId, - 'path' => $path - ]); - } - } - } + // Get the uploaded files + $files1 = $this->request->getFile('emp_file1'); + $files2 = $this->request->getFile('emp_file2'); + $files3 = $this->request->getFile('emp_file3'); + $files4 = $this->request->getFile('emp_file4'); + $files5 = $this->request->getFile('emp_file5'); + + $files=[$files1,$files2,$files3,$files4,$files5]; + + $fileName1 = $this->request->getPost('file_name1'); + $fileName2 = $this->request->getPost('file_name2'); + $fileName3 = $this->request->getPost('file_name3'); + $fileName4 = $this->request->getPost('file_name4'); + $fileName5 = $this->request->getPost('file_name5'); + + $fileNames=[$fileName1,$fileName2,$fileName3,$fileName4,$fileName5]; + + if (!empty($files)) { + foreach ($files as $index => $file) { + if ($file && $file->isValid() && !$file->hasMoved()) { + // Move the file to the desired directory + $newName = $file->getRandomName(); + $file->move(ROOTPATH . 'public/uploads/images/emp_files', $newName); + $path = ROOTPATH . 'public/uploads/images/emp_files/' . $newName; + // Store the file information in the database + $this->empFiles->save([ + 'file_name' => $fileNames[$index], // User-entered file name + 'emp_file' => $newName, // New file name + 'emp_id' => $result, + 'path' => $path + + ]); + } + } + } diff --git a/app/Views/addEmployeenew.php b/app/Views/addEmployeenew.php index e7f19309..0fe7955d 100755 --- a/app/Views/addEmployeenew.php +++ b/app/Views/addEmployeenew.php @@ -423,13 +423,7 @@ Proof - +
@@ -1004,7 +998,7 @@
-
+
@@ -1016,6 +1010,24 @@ onchange="ValidateAadhar();" class="form-control" onkeypress="return isNumberKey(event)" required>
+ +
+ + +
+
+ + +
+ + + + +
+ +
+
+ +
+ + +
+
+ + +
+ + + + + +
+ + +
+
+ +
+ + +
+
+ + +
+ +
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+
+ + +
+
+ + +
+
+ @@ -1043,48 +1114,11 @@ - - -
- -
-
-
-
-
- -
- - -
-
- - -
-
- -
-
- -
-
-
- - -
+ @@ -1123,28 +1157,6 @@ } } - function appendFilesFileds(data) { - var newRowHtml = ` -
-
- File name - -
-
- File - -
-
- - -
-
`; - - $('#filesContainer').append(newRowHtml); - $('.a1').hide(); - $('#filesContainer .pad:last .a1').show(); - } - function removeContact(button) { $(button).closest('.pad').remove(); $('#filesContainer .a1').hide(); @@ -1458,7 +1470,7 @@ var combinedFormData = new FormData(); // Use FormData to handle files // List of form IDs you want to combine - var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here + var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm',]; // Add all your form IDs here formIds.forEach(function(formId) { var $form = $(formId); diff --git a/app/Views/editEmployeenew.php b/app/Views/editEmployeenew.php index edf6deb2..968f746a 100755 --- a/app/Views/editEmployeenew.php +++ b/app/Views/editEmployeenew.php @@ -191,13 +191,7 @@ if (!empty($EmpDetails)) { Proof - +
@@ -913,44 +907,228 @@ if (!empty($EmpDetails)) {
-
+
-
-
- * - -
-
- - -
-
- - -
- + 0) { + + ?> -
+ + + + + + +
+
* + +
+ +
+ + +
+
+ + +
+
+ +
+ +
+ +
+ +
+ + +
+
+ + +
+
+ +
+ +
+ +
+ +
+ + +
+
+ + +
+ +
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+
+ + +
+
+ + +
+
+ + + + +
+
* + +
+ +
+ + +
+
+ + +
+
+ +
+ +
+ +
+ +
+ + +
+
+ + +
+
+ +
+ +
+ +
+ +
+ + +
+
+ + +
+ +
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+
+ + +
+
+ + +
+
+ +
@@ -960,96 +1138,14 @@ if (!empty($EmpDetails)) { - - -
- -
- -
-
-
-
- - - - 0) { ?> - - - - $value) { ?> - -
-
- - - - - - -
-
- - - -
-
- - -
- -
- - -
-
- - -
-
- - -
-
- -
-
- - - -
- - -
-
- - -
+ + @@ -1534,28 +1630,6 @@ if (!empty($EmpDetails)) { } } - function appendFilesFileds(data) { - var newRowHtml = ` -
-
- File name - -
-
- File - -
-
- - -
-
`; - - $('#filesContainer').append(newRowHtml); - $('.a1').hide(); - $('#filesContainer .pad:last .a1').show(); - } - function removeContact(button) { if (button.id != '') { $('#loader').show(); @@ -1773,7 +1847,7 @@ if (!empty($EmpDetails)) { var isValid = true; var combinedFormData = new FormData(); - var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here + var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm']; // Add all your form IDs here formIds.forEach(function(formId) { var $form = $(formId); From a9d0f350e82e89a24627a03f37033d1addafcd05 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Thu, 24 Oct 2024 01:36:26 +0530 Subject: [PATCH 2/8] emp module dev 24/10 changes 1 -vadivel J --- app/Controllers/Employeedetails.php | 79 +++- app/Models/EmpFilesModel.php | 1 - app/Views/addEmployeenew.php | 44 +- app/Views/editEmployeenew.php | 710 ++++++++++++++++------------ 4 files changed, 492 insertions(+), 342 deletions(-) diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index 0c9a425f..12c5e7fd 100755 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -198,6 +198,40 @@ class Employeedetails extends BaseController /** * This function is used to save the new Employee form in the database */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + /** + * This function is used to save the new Employee form in the database + */ + function AddNewEmployee() { @@ -365,16 +399,15 @@ class Employeedetails extends BaseController $this->empFiles->save([ 'file_name' => $fileNames[$index], // User-entered file name 'emp_file' => $newName, // New file name - 'emp_id' => $result, + 'emp_id' => $result['EmpID'], 'path' => $path - ]); } } } - $EmpID = $result; + $EmpID = $result['EmpID']; $Total_Salary = $this->request->getPost('Total_salary'); $Basic_Pay = $this->request->getPost('Basic_Pay'); $HRA_Rate = $this->request->getPost('HRA_Rate'); @@ -627,13 +660,46 @@ class Employeedetails extends BaseController } } + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + /* To Update the employee details*/ + + function UpdateEmployee() { - $EmpId = $this->request->getPost('employeeid'); + $EmpId = $this->request->getGet('empId'); - $EmpId = $this->request->getPost('employeeid'); $PictureName = $this->request->getPost('Image'); $ModifyPictureName = $this->request->getPost('ModifyImage'); $Picture = ""; @@ -853,9 +919,8 @@ class Employeedetails extends BaseController $this->empFiles->save([ 'file_name' => $fileNames[$index], // User-entered file name 'emp_file' => $newName, // New file name - 'emp_id' => $result, + 'emp_id' => $EmpId, 'path' => $path - ]); } } diff --git a/app/Models/EmpFilesModel.php b/app/Models/EmpFilesModel.php index 7fb6f630..78ee5d28 100755 --- a/app/Models/EmpFilesModel.php +++ b/app/Models/EmpFilesModel.php @@ -21,4 +21,3 @@ class EmpFilesModel extends Model ]; } -?> \ No newline at end of file diff --git a/app/Views/addEmployeenew.php b/app/Views/addEmployeenew.php index df24d29d..ce31e4f2 100755 --- a/app/Views/addEmployeenew.php +++ b/app/Views/addEmployeenew.php @@ -1003,19 +1003,19 @@
-
*
-
- +
+
-
+
@@ -1027,7 +1027,7 @@
-
+
-
+
-
+
- - - - - -
+
-
+
-
+
-
+
- - - - -
-
-
+
+
-
+
-
-
+
+
-
+
diff --git a/app/Views/editEmployeenew.php b/app/Views/editEmployeenew.php index 968f746a..58c6632d 100755 --- a/app/Views/editEmployeenew.php +++ b/app/Views/editEmployeenew.php @@ -58,8 +58,8 @@ $uano = ''; $is_management_team = 0; $esi_applicable = 0; $pf_applicable = 0; -$TDS_Rate=''; -$tds_apllicable=0; +$TDS_Rate = ''; +$tds_apllicable = 0; if (!empty($EmpDetails)) { foreach ($EmpDetails as $Emp) { @@ -96,8 +96,8 @@ if (!empty($EmpDetails)) { $IFSCCode = $Emp->IFSCCode; $BankBranchName = $Emp->BankBranchName; $BankAddress = $Emp->BankAddress; - $TDS_Rate=$Emp->TDS_Rate; - $tds_applicable =$Emp->tds_applicable; + $TDS_Rate = $Emp->TDS_Rate; + $tds_applicable = $Emp->tds_applicable; $PassportNo = $Emp->PassportNo; $Passport_Valid_till = $Emp->Passport_Valid_till; if ($Passport_Valid_till != '' && $Passport_Valid_till != '0000-00-00 00:00:00') { @@ -145,6 +145,7 @@ if (!empty($EmpDetails)) { } ?> +
@@ -191,7 +192,7 @@ if (!empty($EmpDetails)) { Proof - +
@@ -207,27 +208,29 @@ if (!empty($EmpDetails)) {
your image - + src="" + alt="your image" style="width: 139px;" /> +
-
+
-
@@ -305,7 +311,8 @@ if (!empty($EmpDetails)) {
* +
@@ -381,7 +389,7 @@ if (!empty($EmpDetails)) {
-
@@ -397,7 +405,7 @@ if (!empty($EmpDetails)) {
- +
@@ -495,8 +503,9 @@ if (!empty($EmpDetails)) {
* - @@ -546,8 +555,9 @@ if (!empty($EmpDetails)) {
* - @@ -569,7 +579,8 @@ if (!empty($EmpDetails)) {
@@ -619,7 +631,7 @@ if (!empty($EmpDetails)) {
- +