diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 78636294..77d42124 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -392,4 +392,15 @@ $routes->get('sales_invoice', 'Sales::sales_invoice'); // transporter Routes $routes->get('transporterListing', 'Supplier::transporterListing'); $routes->post('fetchTransporterDetails', 'Supplier::fetchTransporterDetails');// for Ajax both add and edit.... -$routes->get('deleteTransporter', 'Supplier::deleteTransporter'); \ No newline at end of file +$routes->get('deleteTransporter', 'Supplier::deleteTransporter'); + +//Factory Machine Master Routes + +$routes->post('createFactoryMachineMasterDetails' , 'FactoryMachineController::createFactoryMachineMasterDetails'); +$routes->get ('readFactoryMachineMasterDetails' , 'FactoryMachineController::readFactoryMachineMasterDetails'); +$routes->get ('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById'); +$routes->post ('updateFactoryMachineMasterDetails' , 'FactoryMachineController::updateFactoryMachineMasterDetails'); +$routes->post('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 new file mode 100644 index 00000000..0e6155e5 --- /dev/null +++ b/app/Controllers/FactoryMachineController.php @@ -0,0 +1,142 @@ +factoryMachineMaster_model = new FactoryMachineModel; + + $this->session = session(); + helper('form'); //$this->load->library('form_validation'); + + $this->isLoggedIn(); + } + + public function index() + { + // + } + + public function createFactoryMachineMasterDetails(){ + + + $this->global['pageTitle'] = 'Create Factory Machine '; + + $postData=[ + 'machine_name'=> $this->request->getPost('machineName'), + 'machine_type'=> $this->request->getPost('machineType'), + 'energy_type' => $this->request->getPost('energyType'), + ]; + + + + $data = $this->factoryMachineMaster_model->insert($postData); + + + + $this->readFactoryMachineMasterDetails(); + + //check above data is successfully created. + + + + } + + public function loadView_createFactoryMachineMasterDetail(){ + + $this->global['pageTitle'] = 'Create Factory Machine Master Detail '; + + $data['masterData']=''; + + return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL); + + } + + public function loadView_updateFactoryMachineMasterDetail(){ + + + $this->global['pageTitle'] = 'Edit Factory Machine Master Detail '; + + $id = $this->request->getGet('id'); + + $data['masterData'] = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first(); + + //here we are using create Factory Machine Master Detail view for + // updating Factory Machine Master Detail + + return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL); + + } + + public function readFactoryMachineMasterDetails(){ + + + + $this->global['pageTitle'] = 'Factory Machine Master Details '; + + $data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1)->findAll(); + + return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); + + + + } + + public function readFactoryMachineMasterDetailsById(){ + + $this->global['pageTitle'] = 'Factory Machine Master Detail '; + + $id = $this->request->getPost('id'); + + $data = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first(); + + return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); + + } + + public function updateFactoryMachineMasterDetails(){ + + $this->global['pageTitle'] = 'Edit Factory Machine Master Detail '; + + $id = $this->request->getPost('id'); + + $postData=[ + 'machine_name'=> $this->request->getPost('machineName'), + 'machine_type'=> $this->request->getPost('machineType'), + 'energy_type' => $this->request->getPost('energyType'), + ]; + + $data = $this->factoryMachineMaster_model->update($id,$postData); + + $this->readFactoryMachineMasterDetails(); + + + + } + + public function deleteFactoryMachineMasterDetails(){ + + $this->global['pageTitle'] = 'Delete Factory Machine Master Detail '; + + $id = $this->request->getPost('id'); + + $data['is_active']=0; + + $data = $this->factoryMachineMaster_model->update($id,$data); + + } + +} diff --git a/app/Database/Migrations/2024-10-03-042354_CreateFactoryMachineMasterTable.php b/app/Database/Migrations/2024-10-03-042354_CreateFactoryMachineMasterTable.php new file mode 100644 index 00000000..5f274dcf --- /dev/null +++ b/app/Database/Migrations/2024-10-03-042354_CreateFactoryMachineMasterTable.php @@ -0,0 +1,34 @@ +forge->addField([ + 'id' => ['type' => 'INT', 'auto_increment' => true], + 'machine_name' => ['type' => 'VARCHAR', 'constraint' => '255'], + 'machine_type' => ['type' => 'VARCHAR', 'constraint' => '255'], + 'fuel_type' => ['type' => 'VARCHAR', 'constraint' => '255'], + + 'is_active' => ['type' => 'TINYINT', 'constraint' => 1, 'default' => 1], + + 'created_at' => ['type' => 'DATETIME', 'null' => true], + 'updated_at' => ['type' => 'DATETIME', 'null' => true] + ]); + + $this->forge->addKey('id', true); + $this->forge->createTable('t_factoryMachineMaster'); + } + + public function down() + { + $this->forge->dropTable('t_factoryMachineMaster'); + } +} + + + + diff --git a/app/Models/FactoryMachineModel.php b/app/Models/FactoryMachineModel.php new file mode 100644 index 00000000..1dfae473 --- /dev/null +++ b/app/Models/FactoryMachineModel.php @@ -0,0 +1,42 @@ + 'required|max_length[255]', + 'machine_type' => 'required|max_length[255]', + 'energy_type' => 'required|max_length[255]', + + ]; + + // Validation messages (optional) + protected $validationMessages = []; + + // Skip validation (set to true to skip validation rules) + protected $skipValidation = false; +} + diff --git a/app/Views/factoryMachineMasterDetails.php b/app/Views/factoryMachineMasterDetails.php new file mode 100644 index 00000000..ce4aa781 --- /dev/null +++ b/app/Views/factoryMachineMasterDetails.php @@ -0,0 +1,203 @@ + + + + + + +
+
+ +
+ +
+ getFlashdata('error'); + if ($error) { + $type = "error"; + echo show_alert($type, $error); + } + $success = session()->getFlashdata('success'); + if ($success) { + $type = "success"; + echo show_alert($type, $success); + } + ?> +
+ +
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
Machine NameMachine TypeEnergy TypeAction
+ +     + +
+
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/app/Views/factoryMachineMasterDetailsCreate.php b/app/Views/factoryMachineMasterDetailsCreate.php new file mode 100644 index 00000000..4858a6ec --- /dev/null +++ b/app/Views/factoryMachineMasterDetailsCreate.php @@ -0,0 +1,108 @@ + + + + +
+
+ +
+ +
+
+
+

+ + +
+
+
+ + +
+
+
+
+ +
" method="post" class="form-label-left " > +
+ + +
+ + * + +
+ +
+ + * + +
+
+ + +
+
+ +
+ +
+ + +   + +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index 5ce67adc..a77ce46c 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -602,6 +602,7 @@ --> +