130 lines
3.0 KiB
PHP
130 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Controllers\BaseController;
|
|
use App\Models\CoatingMachineDetailsModel;
|
|
use App\Models\DrierMachineDetailsModel;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use DateTime;
|
|
|
|
class StockController extends BaseController
|
|
{
|
|
|
|
protected $coatingMachineDetails_model;
|
|
protected $drierMachineDetails_model;
|
|
protected $session;
|
|
|
|
/**
|
|
* This is default constructor of the class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->coatingMachineDetails_model = new CoatingMachineDetailsModel();
|
|
$this->drierMachineDetails_model = new DrierMachineDetailsModel();
|
|
|
|
$this->session = session();
|
|
helper('form');
|
|
|
|
$this->isLoggedIn();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
//
|
|
}
|
|
|
|
public function loadView_coatingMachineDetails(){
|
|
|
|
$this->global['pageTitle'] = 'Coating Machine Details ';
|
|
|
|
$data['coatingMachineDetails']= $this->coatingMachineDetails_model
|
|
->where('is_active', 1)
|
|
->orderBy('created_at','DESC')
|
|
->findAll();
|
|
|
|
return $this->loadViews("CoatingMachineDetail", $this->global, $data, NULL);
|
|
|
|
}
|
|
|
|
public function addNewCoatingMachineDetails(){
|
|
|
|
$postData=$this->request->getPost();
|
|
|
|
$inserted= $this->coatingMachineDetails_model->insert($postData);
|
|
|
|
if ($inserted) {
|
|
// Set flashdata for success message
|
|
return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details updated successfully');
|
|
} else {
|
|
// Set flashdata for error message
|
|
return redirect()->back()->with('error', 'Failed to update Coating machine details');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public function updateCoatingMachineDetails(){
|
|
|
|
$putData=$this->request->getPost();
|
|
|
|
$id = $putData['editCoatingMachineDetailId'];
|
|
|
|
$updated= $this->coatingMachineDetails_model->update($id,$putData);
|
|
|
|
if ($updated) {
|
|
// Set flashdata for success message
|
|
return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details updated successfully');
|
|
} else {
|
|
// Set flashdata for error message
|
|
return redirect()->back()->with('error', 'Failed to update Coating machine details');
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public function deleteCoatingMachineDetails(){
|
|
|
|
$id = $this->request->getGet('id');
|
|
|
|
$data['is_active']=0;
|
|
|
|
$updated = $this->coatingMachineDetails_model->update($id,$data);
|
|
|
|
if ($updated) {
|
|
// Set flashdata for success message
|
|
return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details deleted successfully');
|
|
} else {
|
|
// Set flashdata for error message
|
|
return redirect()->back()->with('error', 'Failed to delete Coating machine details');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------gwm----------------------------------------------
|
|
|
|
|
|
|
|
}
|