From 3c26494a55787db8e086c8f736f714e3e22298d7 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Mon, 8 Apr 2024 17:50:50 +0530 Subject: [PATCH] FEATURE_MAKE_AND_MODEL_MODEL:AADHAVAN --- app/Config/Routes.php | 23 +++- app/Controllers/Make.php | 55 ++++++++++ app/Controllers/Model.php | 99 +++++++++++++++++ app/Views/bike_model_list.php | 194 ++++++++++++++++++++++++++++++++++ app/Views/layout/header.php | 13 ++- app/Views/make_list.php | 177 +++++++++++++++++++++++++++++++ 6 files changed, 559 insertions(+), 2 deletions(-) create mode 100644 app/Controllers/Make.php create mode 100644 app/Controllers/Model.php create mode 100644 app/Views/bike_model_list.php create mode 100644 app/Views/make_list.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0ddab8a..94a9c4a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -74,4 +74,25 @@ $routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1"); //dashboard -$routes->get('dashboard', 'Users::dashboard'); \ No newline at end of file +$routes->get('dashboard', 'Users::dashboard'); + + + + + +//---------------------- Make And Model +// Make +$routes->get('make_index', 'Make::index'); +$routes->post('create_make', 'Make::create_make'); + + + +// Model +$routes->get('bike_model_index/(:any)', 'Model::index/$1'); + +$routes->post('create_model', 'Model::create_model'); + +$routes->post('status_model', 'Model::status_model'); + + + diff --git a/app/Controllers/Make.php b/app/Controllers/Make.php new file mode 100644 index 0000000..d6d2763 --- /dev/null +++ b/app/Controllers/Make.php @@ -0,0 +1,55 @@ +session = session(); + $this->BikemakeModel = new BikemakeModel(); + } + + public function index() + { + + $BikemakeModel = new BikemakeModel(); + $make = $BikemakeModel->findAll(); + $data['make']=$make; + + return view('make_list',$data); + } + + + + public function create_make() + { + try { + $make_name = $this->request->getPost('makename'); + $BikemakeModel = new BikemakeModel(); + $data = [ + 'make' => $make_name + ]; + $inserted = $BikemakeModel->insert($data); + if ($inserted) { + $result = $data; + return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + } else { + $result = "No Match's"; + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + } + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e],500); + } + } + +} \ No newline at end of file diff --git a/app/Controllers/Model.php b/app/Controllers/Model.php new file mode 100644 index 0000000..e5e6d5a --- /dev/null +++ b/app/Controllers/Model.php @@ -0,0 +1,99 @@ +session = session(); + $this->BikemodelsModel = new BikemodelsModel(); + $this->BikemakeModel = new BikemakeModel(); + + } + + public function index($make_id) + { + $BikemodelsModel = new BikemodelsModel(); + $BikemakeModel = new BikemakeModel(); + + $make_value = $BikemakeModel->where('make_id',$make_id)->select('make_id,make')->find(); + $make_name= $make_value[0]['make']; + $make_id= $make_value[0]['make_id']; + + $model = $BikemodelsModel->where('make_id',$make_id)->findAll(); + $data['model']=$model; + $data['make_name'] =$make_name; + $data['make_id'] =$make_id; + + return view('bike_model_list',$data); + } + + + public function create_model() + { + try { + $make_id = $this->request->getPost('make_id'); + $model_name = $this->request->getPost('modelname'); + + $BikemodelsModel = new BikemodelsModel(); + $data = [ + 'make_id' => $make_id, + 'model_name' => $model_name + ]; + + $inserted = $BikemodelsModel->insert($data); + if ($inserted) { + $result = $data; + return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + } else { + $result = "No Match's"; + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + } + } catch (\Exception $exception) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500); + } + } + + + + public function status_model() + { + + try { + $model_id = $this->request->getPost('model_id'); + $isactive = $this->request->getPost('isactive'); + + $BikemodelsModel = new BikemodelsModel(); + $data = [ + 'isactive' => $isactive + ]; + + $updated = $BikemodelsModel->update($model_id, $data); + $model_list = $BikemodelsModel->findAll(); + if ($updated) { + $result = $data; + return $this->respond(['status' => 'success','code' => 200,'data' => $model_list],200); + } else { + $result = "No Match's"; + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + } + } catch (\Exception $exception) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500); + } + } + + + +} \ No newline at end of file diff --git a/app/Views/bike_model_list.php b/app/Views/bike_model_list.php new file mode 100644 index 0000000..8b981d9 --- /dev/null +++ b/app/Views/bike_model_list.php @@ -0,0 +1,194 @@ + +
+
+
+
+

Bike Model List -

+
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Model NameStatusAction
+ + Active + + Inactive + + + + + + + + +
+
+ +
+
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index ece5dfa..36c6a83 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -38,6 +38,11 @@ background-color: #2aa762 !important; /* Set background color to a solid color */ opacity: 1 !important; /* Set opacity to 1 to remove transparency */ } + + .icon-large { + font-size: 1.5em; /* Adjust the font size as needed */ + } + @@ -127,7 +132,13 @@ - + +
  • + + + Make + +
  • get('logged_user_role') == 'Floor Manager' || session()->get('logged_user_role') == 'Job Card Manager') { ?> diff --git a/app/Views/make_list.php b/app/Views/make_list.php new file mode 100644 index 0000000..f6a55ea --- /dev/null +++ b/app/Views/make_list.php @@ -0,0 +1,177 @@ + + +
    +
    +
    +
    +

    Make List

    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    Bike MakeAction
    + + + + " class="view-list-button" title="Model List"> + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + +