From 97ea5ecd5b4a42d73ad3ac3c77be70af451c9e97 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Fri, 4 Oct 2024 14:13:16 +0530 Subject: [PATCH 1/4] mini addOn in factory module -vadivel J --- app/Config/Routes.php | 2 +- app/Controllers/FactoryMachineController.php | 12 +++++-- app/Views/factoryMachineMasterDetails.php | 33 ++++++++++++++++++-- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2fcabe39..6ef0dd14 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -400,7 +400,7 @@ $routes->post('createFactoryMachineMasterDetails' , 'FactoryMachineControlle $routes->get ('readFactoryMachineMasterDetails' , 'FactoryMachineController::readFactoryMachineMasterDetails'); $routes->get ('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById'); $routes->post ('updateFactoryMachineMasterDetails' , 'FactoryMachineController::updateFactoryMachineMasterDetails'); -$routes->post('deleteFactoryMachineMasterDetails' , 'FactoryMachineController::deleteFactoryMachineMasterDetails'); +$routes->get('deleteFactoryMachineMasterDetails' , 'FactoryMachineController::deleteFactoryMachineMasterDetails'); $routes->get('loadView_createFactoryMachineMasterDetail','FactoryMachineController::loadView_createFactoryMachineMasterDetail'); $routes->get('loadView_updateFactoryMachineMasterDetail','FactoryMachineController::loadView_updateFactoryMachineMasterDetail'); diff --git a/app/Controllers/FactoryMachineController.php b/app/Controllers/FactoryMachineController.php index 29611338..e23a2c1a 100644 --- a/app/Controllers/FactoryMachineController.php +++ b/app/Controllers/FactoryMachineController.php @@ -133,11 +133,19 @@ class FactoryMachineController extends BaseController $this->global['pageTitle'] = 'Delete Factory Machine Master Detail '; - $id = $this->request->getPost('id'); + $id = $this->request->getGet('id'); $data['is_active']=0; - $data = $this->factoryMachineMaster_model->update($id,$data); + $updated = $this->factoryMachineMaster_model->update($id,$data); + + if ($updated) { + // Set flashdata for success message + return redirect()->to('/readFactoryMachineMasterDetails')->with('success', 'Machine details deleted successfully'); + } else { + // Set flashdata for error message + return redirect()->back()->with('error', 'Failed to delete machine details'); + } } diff --git a/app/Views/factoryMachineMasterDetails.php b/app/Views/factoryMachineMasterDetails.php index d6067f58..5adf4e8c 100644 --- a/app/Views/factoryMachineMasterDetails.php +++ b/app/Views/factoryMachineMasterDetails.php @@ -126,11 +126,28 @@ + href=" + loadView_updateFactoryMachineMasterDetail?id=" + > +     + + + + + +     + + + + + + + \ No newline at end of file From a36060177bf862ec895d620511dd9aabe15dd6b2 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Fri, 4 Oct 2024 14:19:10 +0530 Subject: [PATCH 2/4] minor change -vadivel J --- app/Controllers/FactoryMachineController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Controllers/FactoryMachineController.php b/app/Controllers/FactoryMachineController.php index e23a2c1a..82dbe414 100644 --- a/app/Controllers/FactoryMachineController.php +++ b/app/Controllers/FactoryMachineController.php @@ -83,7 +83,10 @@ class FactoryMachineController extends BaseController $this->global['pageTitle'] = 'Factory Machine Master Details'; - $data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1)->findAll(); + $data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1) + ->where('is_active', 1) + ->orderBy('created_at','DESC') + ->findAll(); return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); @@ -95,7 +98,10 @@ class FactoryMachineController extends BaseController $id = $this->request->getPost('id'); - $data = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first(); + $data = $this->factoryMachineMaster_model->where('id', $id) + ->where('is_active', 1) + ->orderBy('created_at','DESC') + ->first(); return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); From 5c9d1bac14334ff3bbca03b158fbae831f57e1b7 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Fri, 4 Oct 2024 16:57:07 +0530 Subject: [PATCH 3/4] added material category addition in form -vadivel J --- app/Config/Routes.php | 1 + app/Controllers/Rawmaterialdetails.php | 23 ++++++ app/Views/addRawMaterial.php | 104 ++++++++++++++++++++++++- 3 files changed, 127 insertions(+), 1 deletion(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6ef0dd14..2b6be303 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -62,6 +62,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'rawmaterialListing/(:num)', 'Ra $routes->post('materialExist','Rawmaterialdetails::checkmaterial'); $routes->get('viewRawmaterial','Rawmaterialdetails::viewRawmaterial'); $routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRawmaterial'); +$routes->post('rawmaterialdetails/addMaterialCategories', 'Rawmaterialdetails::addMaterialCategories'); $routes->get('exportmaterial' , 'Rawmaterialdetails::exportmaterial'); $routes->get('rawmaterialdetailsautocomplete' , 'Rawmaterialdetails::autocomplete'); diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index dee4db6e..ed4a2d3b 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -313,6 +313,29 @@ class Rawmaterialdetails extends BaseController } + + function addMaterialCategories(){ + + $data['category_name']=$this->request->getpost('category_name'); + + $insertResult=$this->materialCategories_model->insert($data); + + if ($insertResult) { + // Send a success response as JSON + return $this->response->setJSON([ + 'status' => '201', + 'message' => 'Category added successfully', + ]); + } else { + // Send an error response as JSON + return $this->response->setJSON([ + 'status' => '400', + 'message' => 'Failed to add category', + ]); + } + + } + function autocomplete() { diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index 66f53417..f73d5095 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -68,7 +68,12 @@
- + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 719f57ec51dbe805ee78253e311a01ab9a1b3039 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Fri, 4 Oct 2024 17:42:26 +0530 Subject: [PATCH 4/4] minor change commit - vadivel J --- app/Controllers/FactoryMachineController.php | 6 ++---- app/Views/addRawMaterial.php | 3 +-- app/Views/factoryMachineMasterDetails.php | 4 +--- ...etailsCreate.php => factoryMachineMasterDetailsForm.php} | 0 4 files changed, 4 insertions(+), 9 deletions(-) rename app/Views/{factoryMachineMasterDetailsCreate.php => factoryMachineMasterDetailsForm.php} (100%) diff --git a/app/Controllers/FactoryMachineController.php b/app/Controllers/FactoryMachineController.php index 82dbe414..d6aaa4d1 100644 --- a/app/Controllers/FactoryMachineController.php +++ b/app/Controllers/FactoryMachineController.php @@ -59,7 +59,7 @@ class FactoryMachineController extends BaseController $data['masterData']=''; - return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL); + return $this->loadViews("factoryMachineMasterDetailsForm", $this->global, $data, NULL); } @@ -72,10 +72,8 @@ class FactoryMachineController extends BaseController $data['masterData'] = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first(); - //here we are using same view - create Factory Machine Master Detail for - // updating Factory Machine Master Detail - return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL); + return $this->loadViews("factoryMachineMasterDetailsForm", $this->global, $data, NULL); } diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index f73d5095..007d554a 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -396,8 +396,7 @@ $("#MatCate").append(``) }else{ $("#addMaterialCaterogyModal").modal('hide'); - alert('Error Adding Category..!!'); - + alert('Error Adding Category..!!'); } diff --git a/app/Views/factoryMachineMasterDetails.php b/app/Views/factoryMachineMasterDetails.php index 5adf4e8c..7bd2b3a0 100644 --- a/app/Views/factoryMachineMasterDetails.php +++ b/app/Views/factoryMachineMasterDetails.php @@ -126,8 +126,7 @@ @@ -137,7 +136,6 @@