CHANGE_jobcard_module:ss

This commit is contained in:
sriramv 2024-04-26 15:27:43 +05:30
commit 4b4ecd8ce9
32 changed files with 907 additions and 419 deletions

View File

@ -23,12 +23,14 @@ $routes->post("add_account", "Users::add_account");
//end Login//
//Users//
// $routes->get('/', 'Users::index');
$routes->get('user_list/(:any)', 'Users::user_list/$1');
$routes->get('index/', 'Users::index');
$routes->post("add_user", "Users::add_user");
$routes->post("get_branch", "Users::get_branch");
$routes->get("new_user/(:any)", "Users::new_user/$1");
$routes->get("delete_user/(:any)", "Users::delete_user/$1");
$routes->get("new_user_super_admin/(:any)", "Users::new_user_super_admin/$1");
$routes->get("edit_user_super_admin/(:any)", "Users::edit_user_super_admin/$1");
$routes->get("delete_user/(:any)", "Users::delete_user/$1");
//end users//
//Business//
@ -117,62 +119,74 @@ $routes->get('dashboard', 'Users::dashboard');
//---------------------- Make And Model | Service | Manufacturer | Inventory->Purchase | Complaint
// 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');
// Service
$routes->get('service_index', 'Service::service_index');
$routes->get("new_service/(:any)", "Service::new_service/$1");
$routes->post("add_service", "Service::add_service");
$routes->post("get_models_service", "Service::get_models");
$routes->get("delete_service/(:any)", "Service::delete_service/$1");
//Spare manufacturer
$routes->get('spare_manufacturer_index', 'Manufacturer::index');
$routes->post('create_manufacturer', 'Manufacturer::create_manufacturer');
//---------------------- Make And Model | Service | Manufacturer | Inventory->Purchase
//---------------------- Reorder Level | Return Order | Complaint
// Make //
$routes->get('make_index', 'Make::index');
$routes->post('create_make/(:any)', 'Make::create_make/$1');
$routes->post('status_make', 'Make::status_make');
// Make End's //
// Purchase
// Model //
$routes->get('bike_model_index/(:any)', 'Model::index/$1');
$routes->post('create_model/(:any)', 'Model::create_model/$1');
$routes->post('status_model', 'Model::status_model');
// Model End's//
// Service //
$routes->get('service_index', 'Service::service_index');
$routes->get("new_service/(:any)", "Service::new_service/$1");
$routes->post("add_service", "Service::add_service");
$routes->post("get_models_service", "Service::get_models");
$routes->get("delete_service/(:any)", "Service::delete_service/$1");
// Service End's//
//Spare manufacturer//
$routes->get('spare_manufacturer_index', 'Manufacturer::index');
$routes->post('create_manufacturer/(:any)', 'Manufacturer::create_manufacturer/$1');
//Spare manufacturer End's//
// Purchase//
$routes->get('purchase_index', 'Purchase::purchase_index');
$routes->get("new_purchase/(:any)", "Purchase::new_purchase/$1");
$routes->get('get_vendor/(:any)', 'Purchase::get_vendor/$1');
$routes->post("add_purchase", "Purchase::add_purchase");
$routes->get("delete_purchase/(:any)", "Purchase::delete_purchase/$1");
$routes->post("getVendorProducts", "Purchase::getVendorProducts");
$routes->post("delete_purchase_product", "Purchase::delete_purchase_product");
$routes->get("download_purchase_invoice/(:any)", "Purchase::download_purchase_invoice/$1");
$routes->get("reorder_purchase/(:any)", "Purchase::reorder_purchase/$1");
// Purchase End's//
$routes->get('purchase_index', 'Purchase::purchase_index');
$routes->get("new_purchase/(:any)", "Purchase::new_purchase/$1");
$routes->get('get_vendor/(:any)', 'Purchase::get_vendor/$1');
$routes->post("add_purchase", "Purchase::add_purchase");
$routes->get("delete_purchase/(:any)", "Purchase::delete_purchase/$1");
$routes->post("getVendorProducts", "Purchase::getVendorProducts");
$routes->post("delete_purchase_product", "Purchase::delete_purchase_product");
$routes->get("download_purchase_invoice/(:any)", "Purchase::download_purchase_invoice/$1");
$routes->get("reorder_purchase/(:any)", "Purchase::reorder_purchase/$1");
// Reorder Level//
$routes->get('reorder_level_index', 'Reorderlevel::reorder_level_index');
$routes->get('rise_order/(:any)', 'Reorderlevel::rise_order/$1');
$routes->get('reorder_level_index', 'Reorderlevel::reorder_level_index');
$routes->get('rise_order/(:any)', 'Reorderlevel::rise_order/$1');
// Reorder Level//
// Return Order//
$routes->get('return_order_index', 'ReturnOrder::return_order_index');
$routes->get('return_order', 'ReturnOrder::return_order');
$routes->get("new_return/(:any)", "ReturnOrder::new_return/$1");
$routes->post("add_return_purchase", "ReturnOrder::add_return_purchase");
$routes->get('get_vendor/(:any)', 'Purchase::get_vendor/$1');
$routes->get('edit_return_order/(:any)', 'ReturnOrder::edit_return_order/$1');
$routes->get('return_order_index', 'ReturnOrder::return_order_index');
$routes->get('return_order', 'ReturnOrder::return_order');
$routes->get("new_return/(:any)", "ReturnOrder::new_return/$1");
$routes->post("add_return_purchase", "ReturnOrder::add_return_purchase");
$routes->get('get_vendor/(:any)', 'Purchase::get_vendor/$1');
$routes->get('edit_return_order/(:any)', 'ReturnOrder::edit_return_order/$1');
// Return Order End's//
// Complaint
$routes->get('complaint_index', 'Complaint::complaint_index');
$routes->post('create_complaint/(:any)', 'Complaint::create_complaint/$1');
$routes->get('edit_complaint/(:any)', 'Complaint::edit_complaint/$1');
$routes->get("delete_complaint/(:any)", "Complaint::delete_complaint/$1");
$routes->get('complaint_index', 'Complaint::complaint_index');
$routes->post('create_complaint/(:any)', 'Complaint::create_complaint/$1');
$routes->get('edit_complaint/(:any)', 'Complaint::edit_complaint/$1');
$routes->get("delete_complaint/(:any)", "Complaint::delete_complaint/$1");
// Complaint End's//

View File

@ -5,40 +5,42 @@ namespace App\Controllers;
use App\Models\ComplaintModel;
use CodeIgniter\API\ResponseTrait;
class Complaint extends BaseController
{
public $session;
use ResponseTrait;
public function __construct()
{
$this->session = session();
$this->session = session();
}
public function complaint_index()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ComplaintModel = new ComplaintModel();
$complaint = $ComplaintModel->findAll();
$data['complaint']=$complaint;
return view('complaint_list',$data);
}
public function create_complaint($complaint_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
try {
$data = [
"name" => $this->request->getPost('name'),
"labour_charge" => $this->request->getPost('labour_charge'),
"cgst" => $this->request->getPost('tax')/2,
"sgst" => $this->request->getPost('tax')/2,
"tax" => $this->request->getPost('tax')
];
if (!$complaint_id) {
$ComplaintModel = new ComplaintModel();
$data = $this->request->getPost();
// $data = $this->request->getPost();
$inserted = $ComplaintModel->insert($data);
if ($inserted) {
$result = $data;
@ -49,7 +51,7 @@ class Complaint extends BaseController
}
} else {
$ComplaintModel = new ComplaintModel();
$data = $this->request->getPost();
// $data = $this->request->getPost();
$updated = $ComplaintModel->update($complaint_id,$data);
if ($updated) {
$result = $data;
@ -65,39 +67,31 @@ class Complaint extends BaseController
}
}
public function edit_complaint($complaint_id)
{
$data['page_name']= 'Edit Complaint';
$complaintModel = new ComplaintModel();
$complaint = $complaintModel->where('complaint_id',$complaint_id)->findAll();
$data['complaint']=$complaint;
$data['page_name']= 'Edit Complaint';
$data['complaint']=$complaint;
return json_encode($data);
}
public function delete_complaint($complaint_id)
{
if (!empty($complaint_id)) {
$ComplaintModel = new ComplaintModel();
$data['isactive'] = 0;
if ($ComplaintModel->update($complaint_id, $data)) {
// Return success response
return redirect()->to('complaint_index');
if (!empty($complaint_id)) {
$ComplaintModel = new ComplaintModel();
$data['isactive'] = 0;
if ($ComplaintModel->update($complaint_id, $data)) {
// Return success response
return redirect()->to('complaint_index');
}
}
}
// Return error response if deletion fails
return $this->response->setJSON(['success' => false]);
}
// Return error response if deletion fails
return $this->response->setJSON(['success' => false]);
}
}
?>

View File

@ -34,10 +34,9 @@ class Login extends BaseController
// Check if user with provided email exists
$user = $loginModel->where('email', $email)->first();
// echo $user['password'];die;
if ($user && password_verify($password, $user['password'])) {
$Data = $this->UsersModel->select('users.* , roles.roles')
->join('roles', 'users.role = roles.role_id', 'left')
->where('users.email',$email)
@ -52,17 +51,23 @@ class Login extends BaseController
return redirect()->to('dashboard');
} else {
// echo "Stored Password: " . $user['password'] . "<br>";
// echo "Input Password: " . $password . "<br>";
// echo password_verify($password, $user['password']) ? 'Password match' : 'Password does not match';die;
// echo "pass wrong";die;
// Invalid credentials, show error message
return redirect()->back()->withInput()->with('error', 'Invalid email or password');
// Store error message and input data in session flash data
$this->session->setFlashdata('error', 'Invalid email or password');
$this->session->setFlashdata('email_input', $email);
// Redirect back to login page
return redirect()->to('/');
}
} else {
// Validation failed, show error messages
return redirect()->back()->withInput()->with('error', $this->validator->listErrors());
// Store validation errors and input data in session flash data
$this->session->setFlashdata('errors', $this->validator->listErrors());
$this->session->setFlashdata('email_input', $this->request->getPost('email'));
// Redirect back to login page
return redirect()->to('/');
}
}
}

View File

@ -2,6 +2,7 @@
namespace App\Controllers;
use App\Models\BikemodelsModel;
use App\Models\BikemakeModel;
use CodeIgniter\API\ResponseTrait;
@ -31,7 +32,7 @@ class Make extends BaseController
public function create_make()
public function create_make($make_id)
{
try {
$make_name = $this->request->getPost('makename');
@ -39,17 +40,71 @@ class Make extends BaseController
$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);
if (!$make_id) {
try {
$inserted = $BikemakeModel->insert($data);
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
return $this->respond(['status' => 'failed','code' => 404,'data' => $e->getMessage()],200);
}
if ($inserted) {
$result = $data;
$make_list = $BikemakeModel->orderBy('make','asc')->findAll();
return $this->respond(['status' => 'success','code' => 200,'data' => $result,'make_list'=>$make_list],200);
} else {
$result = "No Match's";
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
}
}else{
$updated = $BikemakeModel->update($make_id,$data);
if ($updated) {
$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);
}
}
public function status_make()
{
try {
$make_id = $this->request->getPost('make_id');
$isactive = $this->request->getPost('isactive');
$BikemakeModel = new BikemakeModel();
$BikemodelsModel = new BikemodelsModel();
$data = [
'isactive' => $isactive
];
$updated = $BikemakeModel->update($make_id, $data);
$make_list = $BikemakeModel->orderBy('make','asc')->findAll();
$model_list = $BikemodelsModel->where('make_id',$make_id)->findAll();
foreach ($model_list as $model) {
$model_id= $model['model_id'];
$model_updated = $BikemodelsModel->update($model_id, $data);
}
if ($updated) {
$result = $data;
return $this->respond(['status' => 'success','code' => 200,'data' => $make_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);
}
}
}

View File

@ -32,7 +32,7 @@ class Manufacturer extends BaseController
public function create_manufacturer()
public function create_manufacturer($manufacturer_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
try {
@ -43,14 +43,28 @@ class Manufacturer extends BaseController
'manufacturer_name' => $manufacturer_name,
'quality' => $quality,
];
$inserted = $ManufacturerModel->insert($data);
if ($inserted) {
$result = $data;
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
if (!$manufacturer_id) {
$inserted = $ManufacturerModel->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);
}
} else {
$result = "No Match's";
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
$updated = $ManufacturerModel->update($manufacturer_id,$data);
if ($updated) {
$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);
}

View File

@ -41,7 +41,7 @@ class Model extends BaseController
}
public function create_model()
public function create_model($model_id)
{
try {
$make_id = $this->request->getPost('make_id');
@ -53,14 +53,34 @@ class Model extends BaseController
'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);
if (!$model_id) {
try {
$inserted = $BikemodelsModel->insert($data);
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
return $this->respond(['status' => 'failed','code' => 404,'data' => $e->getMessage()],200);
}
if ($inserted) {
$result = $data;
$model_list = $BikemodelsModel->where('make_id',$make_id)->orderBy('make','asc')->findAll();
return $this->respond(['status' => 'success','code' => 200,'data' => $result,'model_list'=>$model_list],200);
} else {
$result = "No Match's";
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
}
}else{
$updated = $BikemodelsModel->update($model_id ,$data);
if ($updated) {
$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);
}
@ -81,10 +101,13 @@ class Model extends BaseController
];
$updated = $BikemodelsModel->update($model_id, $data);
$model_list = $BikemodelsModel->findAll();
$model = $BikemodelsModel->where('model_id',$model_id)->first();
$models = $BikemodelsModel->where('make_id', $model['make_id'])->orderBy('model_name', 'asc')->findAll();
if ($updated) {
$result = $data;
return $this->respond(['status' => 'success','code' => 200,'data' => $model_list],200);
// $result = $data;
return $this->respond(['status' => 'success','code' => 200,'data' => $models],200);
} else {
$result = "No Match's";
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);

View File

@ -69,18 +69,30 @@ class Products extends BaseController
$data['manufacturers']=$ManufacturerModel->findAll();
$data['page_name']="Add Product";
$data['vendorsProduct'] =[];
} else if ($product_id !== '0') {
} else if ($product_id !== '0') {
$data['page_name']="Edit Product";
$ProductModel = new ProductModel();
$products=$ProductModel->where('product_id', $product_id)->get()->getRowArray();
$products['make_id'] = json_decode($products['make_id'], true);
$products['models_id'] = json_decode($products['models_id'], true);
$data['products']=$products;
$BikemakeModel = new BikemakeModel();
$data['make'] = $BikemakeModel->findAll();
$BikemodelsModel = new BikemodelsModel();
$make_id = $products['make_id'];
$data['models'] = $BikemodelsModel->where('make_id', $make_id)->findAll();
$BikemodelsModel = new BikemodelsModel();
$models = [];
if( $products['make_id'] != null) {
foreach ($products['make_id'] as $make_id) {
$models[] = $BikemodelsModel->where('make_id', $make_id)->findAll();
}
}
$data['models'] = $models;
$tax=$ProductModel->getTax();
$data['tax']=$tax;
@ -89,6 +101,9 @@ class Products extends BaseController
$ManufacturerModel = new ManufacturerModel();
$data['manufacturers']=$ManufacturerModel->findAll();
$vendorIds = json_decode($products['vendor'], true);
$vendors = [];
$VendorModel = new VendorModel();
foreach ($vendorIds as $vendorId) {
@ -103,10 +118,13 @@ class Products extends BaseController
$preferredVendorId = $products['prefered_vendor'];
// Pass the preferred vendor ID to the view
$data['preferredVendorId'] = $preferredVendorId; // print_r($data);die;
// print_r($data);die;
// print_r($data);die;
}
$data['product_id'] = $product_id;
// echo "<pre>";
// print_r($data);die;
echo view('product_form',$data);
}
@ -135,7 +153,7 @@ class Products extends BaseController
'purchase_order_level' => $this->request->getPost('purchase_order_level'),
'reorder_level' => $this->request->getPost('reorder_level'),
'quality' => $this->request->getPost('quality'),
'make_id' => $this->request->getPost('make'),
'make_id' => json_encode($this->request->getPost('make')),
'models_id' => json_encode($this->request->getPost('model')),
'rack_number' => $this->request->getPost('rack_number'),
'manufacturer_id' => $this->request->getPost('manufacturer'),
@ -146,7 +164,6 @@ class Products extends BaseController
'branch_id' => $this->session->get('logged_user_branch_id')
];
$product_id = $this->request->getPost('product_id');
@ -244,92 +261,114 @@ class Products extends BaseController
public function get_models()
{
$make_id = $this->request->getPost('make_id'); // Assuming you are sending make_id via POST
// Fetch models based on the selected make ID
$BikemodelsModel = new BikemodelsModel(); // Adjust this according to your actual model name
$models = $BikemodelsModel->where('make_id', $make_id)->findAll(); // Implement this method in your model
// Return the model data as JSON
return $this->response->setJSON($models);
}
public function get_models()
{
$make_ids = $this->request->getPost('make_id'); // Assuming you are sending make_id via POST
$BikemodelsModel = new BikemodelsModel(); // Adjust this according to your actual model name
public function save_make() {
$response = []; // Initialize an empty array to hold the response data
// Assuming BikemakeModel and BikemodelsModel are properly defined
$BikemakeModel = new BikemakeModel();
$BikemodelsModel = new BikemodelsModel();
$make = $this->request->getPost('make');
$model = $this->request->getPost('model');
// Check if both make and model are provided
if (!empty($make) && !empty($model)) {
$data = [
'make' => $make
];
// Insert the make into the database
$BikemakeModel->insert($data);
$make_id = $BikemakeModel->getInsertID();
$modelData = [
'model_name' => $model,
'make_id' => $make_id,
];
// Insert the model into the database
$BikemodelsModel->insert($modelData);
// Set success status in the response
$response['success'] = true;
} else {
// If make or model is empty, set success status to false
$response['success'] = false;
$formatted_models = [];
// Iterate over each selected make ID
if ($make_ids) {
foreach ($make_ids as $make_id) {
// Fetch models based on the selected make ID
$models = $BikemodelsModel->where('make_id', $make_id)->findAll();
// Iterate over each fetched model and format it as needed
foreach ($models as $model) {
// Create an associative array with 'model_id' and 'model_name' properties
$formatted_model = [
'make_id' => $model['make_id'],
'model_id' => $model['model_id'],
'model_name' => $model['model_name']
// Add other properties if needed
];
// Push the formatted model into the array
$formatted_models[] = $formatted_model;
}
}
}
return $this->response->setJSON($formatted_models);
}
// Send JSON response back to the client
return $this->response->setJSON($response);
}
public function get_makes()
{
$BikeMakeModel = new BikeMakeModel(); // Adjust this according to your actual model name
$makes = $BikeMakeModel->findAll();
return $this->response->setJSON($makes);
}
public function save_model() {
$response = [];
$BikemodelsModel = new BikemodelsModel();
$make_id = $this->request->getPost('make_id');
$model = $this->request->getPost('modelvalue');
if (!empty($make_id) && !empty($model)) {
$modelData = [
'model_name' => $model,
'make_id' => $make_id,
];
public function save_make() {
$response = []; // Initialize an empty array to hold the response data
// Assuming BikemakeModel and BikemodelsModel are properly defined
$BikemakeModel = new BikemakeModel();
$BikemodelsModel = new BikemodelsModel();
$make = $this->request->getPost('make');
$model = $this->request->getPost('model');
// Check if both make and model are provided
if (!empty($make) && !empty($model)) {
$data = [
'make' => $make
];
// Insert the make into the database
$BikemakeModel->insert($data);
$make_id = $BikemakeModel->getInsertID();
$modelData = [
'model_name' => $model,
'make_id' => $make_id,
];
// Insert the model into the database
$BikemodelsModel->insert($modelData);
// Set success status in the response
$response['success'] = true;
} else {
// If make or model is empty, set success status to false
$response['success'] = false;
}
// Send JSON response back to the client
return $this->response->setJSON($response);
}
public function get_makes()
{
$BikeMakeModel = new BikeMakeModel(); // Adjust this according to your actual model name
$makes = $BikeMakeModel->findAll();
return $this->response->setJSON($makes);
}
public function save_model() {
$response = [];
$BikemodelsModel = new BikemodelsModel();
$make_id = $this->request->getPost('make_id');
$model = $this->request->getPost('modelvalue');
if (!empty($make_id) && !empty($model)) {
$modelData = [
'model_name' => $model,
'make_id' => $make_id,
];
$model_id = $BikemodelsModel->insert($modelData);
$modelData = $BikemodelsModel->where('make_id',$make_id)->findAll();
$model_id = $BikemodelsModel->insert($modelData);
$response['success'] = true;
$response['model_id'] = $model_id;
$response['model_value'] = $model;
} else {
$response['success'] = false;
}
$modelData = $BikemodelsModel->where('make_id',$make_id)->findAll();
$response['success'] = true;
$response['model_id'] = $model_id;
$response['model_value'] = $model;
} else {
$response['success'] = false;
return $this->response->setJSON($response);
}
return $this->response->setJSON($response);
}
}

View File

@ -31,6 +31,8 @@ class Sales extends BaseController
$sales=$SalesOrderModel->getSalesOrdersWithProducts($this->session->get('logged_user_branch_id'));
$data['sales']=$sales;
// echo"<pre>";
// print_r($data);die;
return view('sales_list',$data);
}
@ -52,17 +54,17 @@ class Sales extends BaseController
// ->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$ProductModel = new ProductModel();
$product=$ProductModel
->where('isactive',1)
->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['product']=$product;
$data['client']=$client;
$data['vehicle']=$vehicle;
$product=$ProductModel
->where('isactive',1)
->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['product']=$product;
$data['client']=$client;
$data['vehicle']=$vehicle;
} else if ($sales_order_id !== '0')
{
} else if ($sales_order_id !== '0')
{
$data['page_name']="Edit Sale Order";
@ -80,13 +82,14 @@ class Sales extends BaseController
$modelId = $vehicles['model'];
// Encode the modelId before searching
$encodedMakeId = json_encode([$makeId]);
$encodedModelId = json_encode([$modelId]);
// Load the ProductModel
$productModel = new ProductModel();
// Query the database to find the product based on make_id and model_id
$product = $productModel->where('make_id', $makeId)
$product = $productModel->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->findAll();
$data['product']=$product;
@ -426,16 +429,18 @@ public function getProducts()
$modelId = $this->request->getPost('model_id');
// Encode the modelId before searching
$encodedMakeId = json_encode([$makeId]);
$encodedModelId = json_encode([$modelId]);
// Load the ProductModel
$productModel = new ProductModel();
// Query the database to find the product based on make_id and model_id
$product = $productModel->where('make_id', $makeId)
$product = $productModel->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->where('qty_stock >',0)
->findAll();
// print_r($product);die;
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
$makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;

View File

@ -151,7 +151,7 @@ class Service extends BaseController
'category' => $this->request->getPost('category'),
'product_id' => json_encode($this->request->getPost('product_id')),
'cgst' => $tax,
'igst' => $tax,
'sgst' => $tax,
'tax' => $this->request->getPost('tax'),
'labour_cost' => $this->request->getPost('labour_cost'),
'price' => $this->request->getPost('price'),

View File

@ -43,6 +43,30 @@ class Users extends BaseController
return view('user_list',['users' => $users, 'roleModel' => $roleModel]);
}
public function user_list($branch_id)
{
$UsersModel = new UsersModel();
$users = $UsersModel->where('branch_id',$branch_id)->findAll();
$data['users']=$users;
$roleModel = new RoleModel();
// Assuming $users is an array of user data
foreach ($users as $value) {
if ($value['isactive'] == 1) {
// Call the method from the model to get the role name
$roleName = $roleModel->getRoleNameById($value['role']);
// Output the role name
// echo $roleName;
}
}
return view('user_list_super_admin',['users' => $users, 'roleModel' => $roleModel, 'branch_id' => $branch_id]);
}
public function new_user($user_id)
{
@ -94,6 +118,54 @@ class Users extends BaseController
}
public function new_user_super_admin($branch_id)
{
$BusinessModel=new BusinessModel();
$BranchModel=new BranchModel();
$branch_list = $BranchModel->where('branch_id',$branch_id)->findAll();
// $business=$BusinessModel->findAll();
$business_select = $BusinessModel->where('business_id', $branch_list[0]['business_id'])->findAll();
$rolemodel = new RoleModel();
$roles =$rolemodel->getRoles();
$data['page_name'] = "Add User";
$data['users'] = [];
$data['business'] = $business_select;
$data['branch'] = $branch_list;
$data['roles'] = $roles;
// $data['user_id'] = $user_id;
return view('user_form',$data);
}
public function edit_user_super_admin($user_id)
{
$UsersModel = new UsersModel();
$users=$UsersModel->getUserById($user_id);
$BusinessModel=new BusinessModel();
$BranchModel=new BranchModel();
$business_select = $BusinessModel->where('business_id',$users['business_id'])->findAll();
$branch = $BranchModel->where('branch_id',$users['branch_id'])->findAll();
$rolemodel = new RoleModel();
$roles =$rolemodel->getRoles();
$data['page_name'] = "Edit User";
$data['users']=$users;
$data['branch'] = $branch;
$data['business'] = $business_select;
$data['roles'] = $roles;
$data['user_id'] = $user_id;
return view('user_form',$data);
}
public function edit_account($user_id)
{
$uri = $this->request->getUri();

View File

@ -5,5 +5,5 @@ class ComplaintModel extends Model
{
protected $table = 'complaints';
protected $primaryKey = 'complaint_id';
protected $allowedFields = ['complaint_id','name','labour_charge','isactive'];
protected $allowedFields = ['complaint_id','name','labour_charge','cgst','sgst','tax','isactive'];
}

View File

@ -7,7 +7,7 @@ class RoleModel extends Model
protected $primaryKey = 'role_id';
protected $allowedFields = ['role_id','roles','isactive'];
public function getRoles(){
return $this->findAll();
return $this->where('roles !=', 'Super Admin')->findAll();
}
public function getRoleNameById($roleId)
{

View File

@ -22,7 +22,7 @@ class SalesOrderModel extends Model
public function getSalesOrdersWithProducts($logged_user_branch_id)
{
// Select required fields from both tables
$this->select('sales_order.*, COUNT(sales_order_product.sales_order_id) AS product_count,vehicle.reg_no');
$this->select('sales_order.*, COUNT(sales_order_product.sales_order_id) AS product_count,vehicle.reg_no,SUM(sales_order_product.qty) AS product_qty ');
// Join the sales_order_product table based on sales_order_id
$this->join('sales_order_product', 'sales_order_product.sales_order_id = sales_order.sales_order_id');

View File

@ -5,7 +5,7 @@ class ServiceModel extends Model
{
protected $table = 'services';
protected $primaryKey = 'service_id';
protected $allowedFields = ['service_id','branch_id','category','service_name','labour_cost','cgst','igst','price','tax','description','makes_id','models_id','product_id','sub_service_id','isactive'];
protected $allowedFields = ['service_id','branch_id','category','service_name','labour_cost','cgst','sgst','price','tax','description','makes_id','models_id','product_id','sub_service_id','isactive'];
public function getTax()

View File

@ -5,7 +5,7 @@ class ServicesModel extends Model
{
protected $table = 'services';
protected $primaryKey = 'service_id';
protected $allowedFields = ['service_id','service_name','price','commission_rate','cgst','igst','purchase_cost','description','isactive'];
protected $allowedFields = ['service_id','service_name','price','commission_rate','cgst','sgst','purchase_cost','description','isactive'];
}

View File

@ -21,7 +21,6 @@
<div class="card">
<div class="card-body">
<!-- <h4 class="header-title">Business List</h4> -->
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
<thead>
<tr>
@ -30,7 +29,6 @@
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($model as $item): ?>
<tr>
@ -43,21 +41,19 @@
<?php endif; ?>
</td>
<td>
<a data-toggle="modal" data-target="#bike_model_login-modal_1" value="<?php echo $item['model_id']; ?>" class="edit-button" onclick="editModel(this)"><i class="ri-pencil-line"></i></a>
<a data-toggle="modal" data-target="#bike_model_login-modal_1" data-value="<?php echo $item['model_id']; ?>" class="edit-button" onclick="editModel(this)"><i class="ri-pencil-line"></i></a>
<?php if($item['isactive'] == 1): ?>
<a style="color:red; margin-left:12px;" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this)" class="fa fa-user-times"></a>
<a style="color:red; margin-left:12px;" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i></a>
<?php else: ?>
<a style="color:green; margin-left:12px;" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this)" class="fa fa-user"></a>
<a style="color:green; margin-left:12px;" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i></a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
@ -65,36 +61,36 @@
<!-- Start Bike Model Create Pop-UP -->
<div id="bike_model_login-modal_1" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 id="form_add_edit">Add Models</h4>
<!-- Start Bike Model Create Pop-UP -->
<div id="bike_model_login-modal_1" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 id="form_add_edit">Add Models</h4>
</div>
<form id="model_form_data" class="px-3">
<div class="form-group">
<input type="text" id="edit_model_id" hidden>
<input class="form-control" type="text" id="make_id" required="" value="<?php echo $make_id; ?>" placeholder="Make Name...." style="display:none;">
<label for="makename">Make Name </label>
<input class="form-control" type="text" id="makename" required="" value="<?php echo $make_name; ?>" placeholder="Make Name...." disabled>
<label for="modelname">Model Name </label>
<input class="form-control" type="text" id="modelname" required="" placeholder="Model Name....">
</div>
<form id="model_form_data" class="px-3">
<div class="form-group text-center">
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitModels(this)">Submit</button>
</div>
<div class="form-group">
<input class="form-control" type="text" id="make_id" required="" value="<?php echo $make_id; ?>" placeholder="Make Name...." style="display:none;">
<label for="makename">Make Name </label>
<input class="form-control" type="text" id="makename" required="" value="<?php echo $make_name; ?>" placeholder="Make Name...." disabled>
<label for="modelname">Model Name </label>
<input class="form-control" type="text" id="modelname" required="" placeholder="Model Name....">
</div>
</form>
<div class="form-group text-center">
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitModels(this)">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- End Bike Model Create Pop-UP -->
<?php include('layout/footer.php'); ?>
@ -108,16 +104,54 @@
modelname: $('#modelname').val()
};
var edit_model_id = $('#edit_model_id').val();
if (!edit_model_id) {
edit_model_id =0;
}
$.ajax({
type: 'POST',
url: '<?php echo base_url()."create_model"?>',
url: '<?php echo base_url()."create_model/"?>'+edit_model_id,
data: formData,
dataType: 'json',
success: function(response) {
// Handle success response here
console.log(response);
if (response.status == "failed") {
toastr.warning(response.data, 'Warning');
}else{
$('#bike_model_login-modal_1').modal('hide');
$('#makename').val('');
$('#modelname').val('');
toastr.success(response.data, 'Success');
$('tbody').html('');
$.each(response.model_list, function(index, item) {
var row = '<tr>' +
'<td class="model_name">' + item.model_name + '</td>' +
'<td>';
if (item.isactive == 1) {
row += '<span style="color:green">Active</span>';
} else if (item.isactive == 0) {
row += '<span style="color:red">Inactive</span>';
}
row += '</td><td>';
row += '<a data-toggle="modal" data-target="#bike_model_login-modal_1" data-value="' + item.model_id + '" class="edit-button" onclick="editModel(this)"><i class="ri-pencil-line"></i></a>';
// Check the isactive status and set the icon color accordingly
if (item.isactive == 1) {
row += '<a style="color:red; margin-left:12px;" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i></a>';
} else if (item.isactive == 0) {
row += '<a style="color:green; margin-left:12px;" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i></a>';
}
row += '</td><td></td></tr>';
// Append the row to the tbody
$('tbody').append(row);
});
}
},
error: function(xhr, status, error) {
// Handle error response here
@ -146,29 +180,29 @@
data: formData,
dataType: 'json',
success: function(response) {
console.log(response);
if (response.status == "success") {
$('tbody').html('');
$.each(response.data, function(index, item) {
var row = '<tr>' +
'<td>' + item.model_name + '</td>' +
'<td>';
var row = '<tr>' +
'<td class="model_name">' + item.model_name + '</td>' +
'<td>';
if (item.isactive == 1) {
row += '<span style="color:green">Active</span>';
} else if (item.isactive == 0) {
row += '<span style="color:red">Inactive</span>';
}
if (item.isactive == 1) {
row += '<span style="color:green">Active</span>';
} else if (item.isactive == 0) {
row += '<span style="color:red">Inactive</span>';
}
row += '</td><td>';
row += '<a data-toggle="modal" data-target="#bike_model_login-modal_1" data-value="' + item.model_id + '" class="edit-button" onclick="editModel(this)"><i class="ri-pencil-line"></i></a>';
// Check the isactive status and set the icon color accordingly
if (item.isactive == 1) {
row += '<a style="color:red" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)" class="fa fa-user-times"></a>';
row += '<a style="color:red; margin-left:12px;" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i></a>';
} else if (item.isactive == 0) {
row += '<a style="color:green" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)" class="fa fa-user"></a>';
row += '<a style="color:green; margin-left:12px;" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i></a>';
}
row += '</td><td></td></tr>';
@ -189,6 +223,9 @@
function editModel(params) {
$('#edit_model_id').val($(params).data('value'));
$('#form_add_edit').text('Edit Models');
var full_div = $(params).parent().parent()[0];

View File

@ -38,6 +38,7 @@
<th>Postal Code</th>
<th>Mobile No</th>
<th>Active</th>
<th>User List</th>
<th>Action</th>
</tr>
</thead>
@ -59,8 +60,12 @@
<?php endif; ?>
</td>
<td>
<a data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['branch_id']; ?>" onclick="editBranch(this)" class="edit-button"><i
class="ri-pencil-line"></i></a>
<a href="<?= base_url("user_list/" . $value['branch_id']) ?>" style="margin-left: 15px;">View</a>
</td>
<td>
<a data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['branch_id']; ?>" onclick="editBranch(this)" class="edit-button"><i
class="ri-pencil-line" style="margin-right: 5px;"></i></a>
<a href="<?= base_url("delete_branch/".$value['branch_id']); ?>"
class="delete-button"><i class="ri-delete-bin-line"></i></a>

View File

@ -39,6 +39,7 @@
<th>State</th>
<th>Postal Code</th>
<th>Country</th>
<th>Branch List</th>
<th>Action</th>
</tr>
</thead>
@ -58,10 +59,10 @@
<td><?= $value['postal_code']; ?></td>
<td><?= $value['country']; ?></td>
<!-- Call the model method -->
<td> <a href="<?= base_url("branch_index/" . $value['business_id']) ?>" style="margin-left: 20px;">View</a></td>
<td>
<a href="<?= "branch_index/" . $value['business_id']; ?>" class=""><i
class="ri-list-check-2"></i></a>
<a href="<?= "new_business/" . $value['business_id']; ?>" class="edit-button"><i
<a href="<?= "new_business/" . $value['business_id']; ?>" class="edit-button" style="margin-right: 5px;"><i
class="ri-pencil-line"></i></a>
<a href="<?= "delete_business/" . $value['business_id']; ?>"

View File

@ -1,13 +1,12 @@
<?php include('layout/header.php'); ?>
<div class="container-fluid">
<div class="row">
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Complaints List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="#" data-toggle="modal" data-target="#complaint-add-modal" class="btn btn-primary waves-effect" onclick="clearDetials(this)"> <i class="ri-add-line"></i></a>
</li>
<li class=""> <a href="#" data-toggle="modal" data-target="#complaint-add-modal" class="btn btn-primary waves-effect" onclick="clearDetials(this)"> <i class="ri-add-line"></i></a></li>
</ol>
</div>
</div>
@ -17,8 +16,7 @@
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100"
style="width:100% !important;">
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
<thead>
<tr>
<th> Name</th>
@ -30,86 +28,82 @@
</thead>
<tbody>
<?php foreach ($complaint as $value) : ?>
<tr>
<td><?= $value['name']; ?></td>
<td><?= $value['labour_charge']; ?></td>
<td>
<?php if($value['isactive'] == 1): ?>
<span style="color:green">Active</span>
<?php else: ?>
<span style="color:red">Inactive</span>
<?php endif; ?>
</td>
<td>
<a data-toggle="modal" data-target="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this)" class="delete-button"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_complaint/" . $value['complaint_id']; ?>" class="delete-button"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<tr>
<td><?= $value['name']; ?></td>
<td><?= $value['labour_charge']; ?></td>
<td>
<?php if($value['isactive'] == 1): ?>
<span style="color:green">Active</span>
<?php else: ?>
<span style="color:red">Inactive</span>
<?php endif; ?>
</td>
<td>
<a data-toggle="modal" data-target="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this)" class="delete-button"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_complaint/" . $value['complaint_id']; ?>" class="delete-button"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<?php endforeach; ?>
</tr>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
</div>
<div id="complaint-add-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 id="form_add_edit">Add Complaint</h4>
</div>
<form id="model_form_data" class="px-3">
<div class="form-group">
<label for="name">Name </label>
<input class="form-control" type="text" id="complaint_id" hidden>
<input class="form-control" type="text" id="name" required="" placeholder="Name....">
</div>
<div class="form-group">
<label for="labour_charge">Labour Charge </label>
<input class="form-control" type="text" id="labour_charge" required="" placeholder="Labour Charge....">
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitComplaint(this)">Submit</button>
</div>
</form>
<!-- /.modal -->
<div id="complaint-add-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 id="form_add_edit">Add Complaint</h4>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<form id="model_form_data" class="px-3">
<div class="form-group">
<label for="name">Name </label>
<input class="form-control" type="text" id="complaint_id" hidden>
<input class="form-control" type="text" id="name" required="" placeholder="Name....">
</div>
<div class="form-group">
<label for="labour_charge">Labour Charge </label>
<input class="form-control" type="text" id="labour_charge" required="" placeholder="Labour Charge....">
</div>
<div class="form-group">
<label for="labour_charge">Tax </label>
<select class="form-control status-select" id="tax" name="tax" required data-toggle="select2">
<option value="0">0%</option>
<option value="5" >5%</option>
<option value="12">12%</option>
<option value="18">18%</option>
<option value="28" >28%</option>
</select>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitComplaint(this)">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php include('layout/footer.php'); ?>
<script>
function submitComplaint(params) {
if (!$('#name').val() || !$('#labour_charge').val()) {
return false;
}
var formData = {
name: $('#name').val(),
labour_charge: $('#labour_charge').val(),
tax: $('#tax').val()
};
var complaint_id = $('#complaint_id').val();
if (!complaint_id) {
complaint_id = 0;
}
$.ajax({
type: 'POST',
url: '<?php echo base_url()."create_complaint/"?>' + complaint_id,
@ -129,12 +123,8 @@
}
function editComplaint(params) {
var complaint_id = $(params).data('value');
$.ajax({
type: 'GET',
url: '<?php echo base_url()."edit_complaint/"?>' + complaint_id,
@ -145,6 +135,17 @@
$('#complaint_id').val(response.complaint[0].complaint_id);
$('#name').val(response.complaint[0].name);
$('#labour_charge').val(response.complaint[0].labour_charge);
var tax = parseFloat(response.complaint[0].cgst) + parseFloat(response.complaint[0].sgst);
var selectElement = document.getElementById('tax');
var options = selectElement.options;
for (var i = 0; i < options.length; i++) {
if (parseInt(options[i].value) === tax) {
options[i].selected = true;
break;
}
}
},
error: function(xhr, status, error) {
// Handle error response here
@ -156,6 +157,6 @@
function clearDetials(params) {
$('#form_add_edit').text('Add Complaint');
}
</script>

View File

@ -622,8 +622,6 @@
var product = services.find(function(item) {
return item.service_id == productId;
});
console.log("3333333");
console.log(product);
var cgst = parseFloat(product.cgst);
var igst = parseFloat(product.sgst);

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8" />
<title>Mechanic</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -105,6 +105,17 @@
<li class="menu-title">Navigation</li>
<?php if(session()->get('logged_user_role') == 'Super Admin') {
?>
<li>
<a href="<?= base_url("business_index") ?>" class="dropdown-item notify-item">
<i class="ri-layout-line"></i>
<span>Business</span>
</a>
</li>
<?php } ?>
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
session()->get('logged_user_role') == 'Administrator' ||
session()->get('logged_user_role') == 'Sales') {
@ -212,9 +223,9 @@
<li>
<a href="<?php echo base_url('product_index') ?>">Products</a>
</li>
<!-- <li>
<li>
<a href="<?php echo base_url('service_index') ?>">Services</a>
</li> -->
</li>
</ul>
</div>
</li>

View File

@ -46,21 +46,31 @@
<form action="<?= base_url() . "authenticate" ?>" method="post">
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" name="email">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password">
</div>
<?php if(session()->getFlashdata('error')): ?>
<div class="alert alert-danger mt-3">
<?= session()->getFlashdata('error') ?>
</div>
<?php endif; ?>
<!-- Display validation errors if available -->
<?php if(session()->getFlashdata('errors')): ?>
<div class="alert alert-danger mt-3">
<?= session()->getFlashdata('errors') ?>
</div>
<?php endif; ?>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" name="email" value="<?= session()->getFlashdata('email_input') ?>" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="form-group mb-0 text-center">
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
</div>
</form>
<div class="text-center">

View File

@ -26,6 +26,7 @@
<thead>
<tr>
<th>Bike Make</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
@ -34,7 +35,14 @@
<tr>
<td class="make"><?php echo $item['make']; ?></td>
<td>
<a data-toggle="modal" data-target="#bike_make_login-modal" value="<?php echo $item['make_id']; ?>" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line"></i></a>
<?php if($item['isactive'] == 1): ?>
<span style="color:green">Active</span>
<?php else: ?>
<span style="color:red">Inactive</span>
<?php endif; ?>
</td>
<td>
<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="<?php echo $item['make_id']; ?>" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line"></i></a>
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" style="margin-left: 12px;" class="add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this)">
<i class="ri-add-line icon-large"></i>
@ -42,6 +50,11 @@
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="view-list-button" title="Model List" style="margin-left: 12px;">
<i class="ri-list-check-2 icon-large"></i>
</a>
<?php if($item['isactive'] == 1): ?>
<a style="color:red; margin-left:12px;" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i></a>
<?php else: ?>
<a style="color:green; margin-left:12px;" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i></a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
@ -62,10 +75,11 @@
<h4 id="form_add_edit">Add Bike Make</h4>
</div>
<form id="model_form_data" class="px-3">
<!-- <form id="model_form_data" class="px-3"> -->
<div class="form-group">
<label for="makename">Make Name </label>
<input type="text" id="edit_make_id" hidden>
<input class="form-control" type="text" id="bike_make_name" required="" placeholder="Make Name....">
</div>
@ -73,7 +87,7 @@
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitMake(this)">Submit</button>
</div>
</form>
<!-- </form> -->
</div>
</div><!-- /.modal-content -->
@ -90,7 +104,7 @@
<h4>Add Models</h4>
</div>
<form id="model_form_data" class="px-3">
<!-- <form id="model_form_data" class="px-3"> -->
<div class="form-group">
<input class="form-control" type="text" id="make_id" required="" placeholder="Make Name...." style="display:none;">
@ -104,7 +118,7 @@
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitModel(this)">Submit</button>
</div>
</form>
<!-- </form> -->
</div>
</div><!-- /.modal-content -->
@ -126,7 +140,7 @@
function submitModel(params) {
console.log( $('#modelname').val());
// console.log( $('#modelname').val());
var formData = {
make_id: $('#make_id').val(),
modelname: $('#modelname').val()
@ -155,15 +169,61 @@
makename: $('#bike_make_name').val()
};
var edit_make_id = $('#edit_make_id').val();
if (!edit_make_id) {
edit_make_id =0;
}
$.ajax({
type: 'POST',
url: 'create_make',
url: 'create_make/'+edit_make_id,
data: formData,
dataType: 'json',
success: function(response) {
console.log(response);
$('#bike_model_login-modal').modal('hide');
$('#bike_make_name').val('');
if (response.status == "failed") {
toastr.warning(response.data, 'Warning');
}else{
$('#bike_make_login-modal').modal('hide');
$('#bike_make_name').val('');
toastr.success(response.data, 'Success');
$('tbody').html('');
$.each(response.make_list, function(index, item) {
var row = '<tr>' +
'<td class="make">' + item.make + '</td>' +
'<td>';
if (item.isactive == 1) {
row += '<span style="color:green">Active</span>';
} else if (item.isactive == 0) {
row += '<span style="color:red">Inactive</span>';
}
row += '</td><td>';
// Check the isactive status and set the icon color accordingly
row += '<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="'+ item.make_id +'" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line"></i></a>';
row +='<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" style="margin-left: 12px;" class="add-button" title="Add" data-id="'+ item.make_id+'" data-value="' +item.make+'" onclick="setMakeName(this)"><i class="ri-add-line icon-large"></i></a>';
row +='<a href="bike_model_index/' +item.make_id+'" class="view-list-button" title="Model List" style="margin-left: 12px;"><i class="ri-list-check-2 icon-large"></i></a>';
if (item.isactive == 1) {
row += '<a style="color:red; margin-left:12px;" data-id="' + item.make_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i></a>';
} else if (item.isactive == 0) {
row += '<a style="color:green; margin-left:12px;" data-id="' + item.make_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i></a>';
}
row += '</td><td></td></tr>';
// Append the row to the tbody
$('tbody').append(row);
});
}
},
error: function(xhr, status, error) {
// Handle error response here
@ -174,10 +234,12 @@
function editMake(params) {
$('#edit_make_id').val($(params).data('value'));
$('#form_add_edit').text('Edit Bike Make');
var full_div = $(params).parent().parent()[0];
console.log($(full_div));
$('#bike_make_name').val($(full_div).find('.make').text());
}
@ -188,4 +250,68 @@
}
function statusChange(params) {
var status = params.getAttribute('data-isactive');
var make_id = params.getAttribute('data-id');
if(status == 1){
var isactive= 0;
}else{
var isactive= 1;
}
var formData = {
make_id: make_id,
isactive: isactive
};
$.ajax({
type: 'POST',
url: '<?php echo base_url()."status_make"?>',
data: formData,
dataType: 'json',
success: function(response) {
console.log(response);
if (response.status == "success") {
$('tbody').html('');
$.each(response.data, function(index, item) {
var row = '<tr>' +
'<td class="make">' + item.make + '</td>' +
'<td>';
if (item.isactive == 1) {
row += '<span style="color:green">Active</span>';
} else if (item.isactive == 0) {
row += '<span style="color:red">Inactive</span>';
}
row += '</td><td>';
// Check the isactive status and set the icon color accordingly
row += '<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="'+ item.make_id +'" class="edit-button" onclick="editMake(this)"><i class="ri-pencil-line"></i></a>';
row +='<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" style="margin-left: 12px;" class="add-button" title="Add" data-id="'+ item.make_id+'" data-value="' +item.make+'" onclick="setMakeName(this)"><i class="ri-add-line icon-large"></i></a>';
row +='<a href="bike_model_index/' +item.make_id+'" class="view-list-button" title="Model List" style="margin-left: 12px;"><i class="ri-list-check-2 icon-large"></i></a>';
if (item.isactive == 1) {
row += '<a style="color:red; margin-left:12px;" data-id="' + item.make_id + '" data-isactive="' + item.isactive + '" title="Deactivate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i></a>';
} else if (item.isactive == 0) {
row += '<a style="color:green; margin-left:12px;" data-id="' + item.make_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i></a>';
}
row += '</td><td></td></tr>';
// Append the row to the tbody
$('tbody').append(row);
});
}
},
error: function(xhr, status, error) {
// Handle error response here
console.error(xhr.responseText);
}
});
}
</script>

View File

@ -36,7 +36,7 @@
<td class="manufacturer_name"><?php echo $item['manufacturer_name']; ?></td>
<td class="quality"><?php echo $item['quality']; ?></td>
<td>
<a data-toggle="modal" data-target="#manufacturer_login-modal" value="<?php echo $item['manufacturer_id']; ?>" class="edit-button" onclick="editManufacturer(this)"><i class="ri-pencil-line"></i></a>
<a data-toggle="modal" data-target="#manufacturer_login-modal" data-value="<?php echo $item['manufacturer_id']; ?>" class="edit-button" onclick="editManufacturer(this)"><i class="ri-pencil-line"></i></a>
<a href="<?= "product_index/" . $item['manufacturer_id']; ?>" class="view-list-button" title="Model List" style="margin-left: 16px;">
<i class="ri-list-check-2 icon-large"></i>
@ -52,7 +52,7 @@
</div>
<!-- Start Bike Make Create Pop-UP -->
<!-- Start Bike Manufacturer Create Pop-UP -->
<div id="manufacturer_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
@ -65,7 +65,8 @@
<div class="form-group">
<label for="manufacturername">Manufacturer Name </label>
<input class="form-control" type="text" id="manufacturer_name" required="" placeholder="Make Name....">
<input type="text" id="manufacturer_id" hidden>
<input class="form-control" type="text" id="manufacturer_name" required="" placeholder="Manufacturer Name....">
</div>
<div class="form-group">
<label for="manufacturername">Quality</label>
@ -103,9 +104,20 @@
quality: $('#quality').val()
};
var edit_manufacturer_id = $('#manufacturer_id').val();
if (!edit_manufacturer_id) {
edit_manufacturer_id =0;
}
if (!$('#manufacturer_name').val() || !$('#quality').val()) {
return false;
}
$.ajax({
type: 'POST',
url: '<?php echo base_url()."create_manufacturer"?>',
url: '<?php echo base_url()."create_manufacturer/"?>'+edit_manufacturer_id,
data: formData,
dataType: 'json',
success: function(response) {
@ -121,6 +133,8 @@
}
function editManufacturer(params) {
$('#manufacturer_id').val($(params).data('value'));
$('#form_add_edit').text('Edit Manufacturer');
var full_div = $(params).parent().parent()[0];

View File

@ -28,12 +28,12 @@
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
<select class="form-control SelExample" id="make" name="make" required>
<select class="form-control SelExample" id="make" name="make[]" required multiple>
<option value="">Select a Make</option>
<!-- Options for make -->
<?php foreach ($make as $value): ?>
<option value="<?= $value['make_id'] ?>" <?= isset($products['make_id']) && $products['make_id'] == $value['make_id'] ? 'selected' : '' ?>>
<option value="<?= $value['make_id'] ?>" <?= isset($products['make_id']) && in_array($value['make_id'], $products['make_id']) ? 'selected' : '' ?>>
<?= $value['make'] ?>
</option>
<?php endforeach; ?>
@ -46,11 +46,11 @@
<select class="form-control SelExample" id="model" name="model[]" required multiple>
<!-- Options for model will be populated dynamically via AJAX -->
<?php if(isset($models) && !empty($models)): ?>
<?php foreach($models as $model): ?>
<option value="<?= $model['model_id'] ?>" <?= isset($products['models_id']) && in_array($model['model_id'], json_decode($products['models_id'], true)) ? 'selected' : '' ?>>
<?= $model['model_name'] ?>
</option>
<?php endforeach; ?>
<?php foreach ($models as $make_models): ?>
<?php foreach ($make_models as $model): ?>
<option value="<?= $model['model_id'] ?>" <?= isset($products['models_id']) && in_array($model['model_id'], $products['models_id']) ? 'selected' : '' ?>><?= $model['model_name'] ?></option>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
@ -359,6 +359,8 @@ $(document).ready(function() {
$('#make').change(function() {
var make_id = $(this).val(); // Get the selected make ID
make_value = $('option:selected', this).text();
var models_id = $('#model').val();
$('#makeSelect').empty();
$('#makeSelect').append('<option value="' + make_id + '">' + make_value + '</option>');
$('#makeSelectMessage').hide();
@ -372,17 +374,28 @@ $(document).ready(function() {
success: function(response) {
// Update models dropdown based on the response
if (response.length > 0) {
// Clear existing options
$('#model').empty();
// Append new options
$("#model").append('<option value=""> Select a Model </option>');
$.each(response, function(index, model) {
$('#model').append('<option value="' + model.model_id + '">' + model.model_name + '</option>');
// Clear existing options
$('#model').empty();
// Iterate through response and models_id
$.each(response, function(index, model) {
var count =0;
$.each(models_id, function(index, model_id) {
if (model.model_id == model_id) {
// Append option for the model
$('#model').append('<option value="' + model.model_id + '" selected>' + model.model_name + '</option>');
count =1;
}
});
} else {
// Handle case when no models are found
$('#model').empty().append('<option value="">No models found</option>');
}
if (count == 0) {
$('#model').append('<option value="' + model.model_id + '">' + model.model_name + '</option>');
}
});
} else {
// Handle case when no models are found
$('#model').empty().append('<option value="">No models found</option>');
}
},
error: function(xhr, status, error) {
// Handle error

View File

@ -56,7 +56,7 @@
<th>Client Name</th>
<th>Items</th>
<th>Qty</th>
<th>Total</th>
<th>Status</th>
<th>Actions</th>
@ -77,6 +77,7 @@
<td><?= $value['client_name']; ?></td>
<td><?= $value['product_count']; ?></td>
<td><?= $value['product_qty']; ?></td>
<td><?= $value['total']; ?></td>
<td class="<?php

View File

@ -152,7 +152,7 @@
<!-- Dynamically add rows for item details -->
<?php if (isset($sales_product) && !empty($sales_product)) : ?>
<?php foreach ($sales_product as $salechild) :
if ($salechild['isactive'] == 1) : ?>
if ($salechild['isactive'] == 1) : ?>
<tr>
<td>
<select class="form-control book-select SelExample" name="item_details[]"

View File

@ -21,22 +21,19 @@
<form action="<?= base_url() . "add_service"; ?>" method="post">
<h4 class="header-title">Service Details :</h4><br>
<div class="form-row">
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Category<span class="text-danger">*</span></label>
<select class="form-control" id="category" name="category" required>
<select class="form-control" id="category" name="category" style="height:32px" required>
<option value="">Select</option>
<option value="0" <?= (isset($services['category']) && $services['category'] == 0) ? 'selected' : '' ?> >Custom</option>
<option value="1" <?= (isset($services['category']) && $services['category'] == 1) ? 'selected' : '' ?> >Manual</option>
</select>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Service Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="servicename" placeholder="Service Name" value="<?= isset($services['service_name']) ? $services['service_name'] : '' ?>" required>
<input type="text" class="form-control" name="servicename" style="height:32px" placeholder="Service Name" value="<?= isset($services['service_name']) ? $services['service_name'] : '' ?>" required>
</div>
</div>
<div id="customFields" <?php if(isset($services['category']) && $services['category'] == "0") { echo 'style="display: none;"'; } ?> >
<div class="form-row">
<div class="form-group col-md-4">
<div class="form-group col-md-3" id="make_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="make" name="make[]" required multiple>
<!-- Options for make -->
@ -46,7 +43,7 @@
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-3" id="model_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="model" name="model[]" required multiple>
<!-- <option value="0">Custom</option> -->
@ -57,10 +54,7 @@
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="model" class="col-form-label">Product<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="productSelect" name="product_id[]" required multiple>
<option value="">Select a Product</option>
@ -74,7 +68,7 @@
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-3">
<label for="model" class="col-form-label">Service<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" required multiple>
<option value="">Select a Service</option>
@ -105,8 +99,8 @@
<select class="form-control status-select" name="tax" required data-toggle="select2">
<?php
$cgst = isset($services['cgst']) ? $services['cgst'] : 0; // CGST value (half of the tax amount)
$igst = isset($services['igst']) ? $services['igst'] : 0; // IGST value (half of the tax amount)
$tax = $cgst + $igst; // Total tax (sum of CGST and IGST)
$sgst = isset($services['sgst']) ? $services['sgst'] : 0; // SGST value (half of the tax amount)
$tax = $cgst + $sgst; // Total tax (sum of CGST and SGST)
?>
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option>
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
@ -176,7 +170,7 @@ $(document).ready(function() {
$('#make').change(function() {
var selected_makes = $(this).val(); // Get the selected make ID
console.log(selected_makes);
// console.log(selected_makes);
var models_id = $('#model').val();
// AJAX request to get models based on the selected make ID
$.ajax({
@ -259,15 +253,19 @@ $(document).ready(function() {
<script>
document.getElementById('category').addEventListener('change', function() {
var customFields = document.getElementById('customFields');
// var customFields = document.getElementById('customFields');
var makeSelect = document.getElementById('make');
var modelSelect = document.getElementById('model');
if (this.value == '1') {
customFields.style.display = 'block';
// customFields.style.display = 'block';
$('#make_hide').css('display' , 'block');
$('#model_hide').css('display' ,'block');
makeSelect.setAttribute('required', 'required');
modelSelect.setAttribute('required', 'required');
} else {
customFields.style.display = 'none';
// customFields.style.display = 'none';
$('#make_hide').css('display' , 'none');
$('#model_hide').css('display' ,'none');
makeSelect.removeAttribute('required');
modelSelect.removeAttribute('required');
}
@ -277,7 +275,7 @@ document.getElementById('category').addEventListener('change', function() {
<script>
data = <?php echo json_encode($product) ?>;
$('#productSelect').change(function() {
console.log('jsfd');
// console.log('jsfd');
if(this.value != 0) {
// Get the selected options
var selectedOptions = this.selectedOptions;
@ -291,11 +289,12 @@ document.getElementById('category').addEventListener('change', function() {
sum += parseInt(price);
}
$('#productCost').val(parseInt(sum));
console.log(sum);
// console.log(sum);
// labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val()) //+ labour_cost;
console.log("New value of #serviceCost:", add);
$('#price').val(add);
}
else if(this.value == '') {
@ -303,6 +302,7 @@ document.getElementById('category').addEventListener('change', function() {
// labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) //+ labour_cost;
console.log("New value of #serviceCost:", add);
$('#price').val(add);
}
});
@ -322,7 +322,7 @@ document.getElementById('category').addEventListener('change', function() {
<script>
servicedata = <?php echo json_encode($service) ?>;
$('#serviceSelected').change(function() {
console.log(this.value);
// console.log(this.value);
if(this.value != 0) {
// Get the selected options
var selectedOptions = this.selectedOptions;
@ -335,25 +335,25 @@ document.getElementById('category').addEventListener('change', function() {
ssum += parseInt(sprice);
}
$('#serviceCost').val(parseInt(ssum));
console.log(ssum);
// console.log(ssum);
// labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
console.log("New value of #serviceCost:", add);
// console.log("New value of #serviceCost:", add);
$('#price').val(add);
}
else if(this.value == '') {
$('#serviceCost').val(0);
// labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
console.log("New value of #serviceCost:", add);
// console.log("New value of #serviceCost:", add);
$('#price').val(add);
}
});
// Function to fetch the price for a product
function getPriceForServiceId(serviceId) {
console.log(serviceId);
// console.log(serviceId);
for (var i = 0; i < servicedata.length; i++) {
if (servicedata[i].service_id === serviceId) {
// Return the purchase_cost if the product_id matches

View File

@ -27,7 +27,7 @@
<!-- <th>Model List</th> -->
<th>Price</th>
<th>Cgst</th>
<th>Igst</th>
<th>Sgst</th>
<th>Description</th>
<th>Action</th>
</tr>
@ -41,7 +41,7 @@
<!-- <td><?= $value['models_names']; ?></td> -->
<td><?= $value['price']; ?></td>
<td><?= $value['cgst']; ?></td>
<td><?= $value['igst']; ?></td>
<td><?= $value['sgst']; ?></td>
<td><?= $value['description']; ?></td>
<td>
<a href="<?= "new_service/" . $value['service_id']; ?>" class="edit-button">

View File

@ -36,7 +36,7 @@
<!-- <option value="">Select Branch</option> -->
<?php if (isset($branch) && (is_array($branch) || is_object($branch))) {
foreach ($branch as $branch): ?>
<option value="<?= $branch['business_id'] ?>" <?= isset($users['branch_id']) && $users['branch_id'] == $branch['branch_id'] ? 'selected' : '' ?> ><?= $branch['branch_name'] ?></option>
<option value="<?= $branch['branch_id'] ?>" <?= isset($users['branch_id']) && $users['branch_id'] == $branch['branch_id'] ? 'selected' : '' ?> ><?= $branch['branch_name'] ?></option>
<?php endforeach; } ?>
<!-- Branch options will be populated dynamically using JavaScript -->
</select>
@ -109,7 +109,7 @@
</script>
<script>
var user_id = "<?php echo $user_id; ?>";
var user_id = "<?php echo isset($user_id); ?>";
if (user_id) {

View File

@ -0,0 +1,59 @@
<?php include('layout/header.php'); ?>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">User List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="">
<a href="<?= base_url() . "new_user_super_admin/".$branch_id; ?>" class="btn btn-primary waves-effect" > <i class="ri-add-line"></i></a>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<table id="datatable-buttons" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>email</th>
<th>Mobile</th>
<th>Role</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $value) :
if ($value['isactive'] == 1) : ?>
<tr>
<td><?= $value['user_id']; ?></td>
<td><?= $value['name']; ?></td>
<td><?= $value['email']; ?></td>
<td><?= $value['mobile_no']; ?></td>
<td><?= $roleModel->getRoleNameById($value['role']); ?></td> <!-- Call the model method -->
<td>
<a href="<?= base_url("edit_user_super_admin/" . $value['user_id']) ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
<a href="<?= "delete_user/" . $value['user_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
</td>
<?php endif?>
<?php endforeach; ?>
</tr>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
<?php include('layout/footer.php'); ?>
</div>

View File

@ -6,9 +6,7 @@
<h4 class="page-title">Vehicle List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="<?= base_url() . "new_vehicle/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a>
</li>
<li class=""> <a href="<?= base_url() . "new_vehicle/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a></li>
</ol>
</div>
</div>
@ -19,15 +17,9 @@
<div class="card">
<div class="card-body">
<!-- <h4 class="header-title">Business List</h4> -->
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100"
style="width:100% !important;">
<thead>
<tr>
<th>Reg No</th>
<th>Make & Model</th>
@ -39,7 +31,6 @@
</tr>
</thead>
<tbody>
<?php foreach ($vehicle as $value) :
if ($value['isactive'] == 1) : ?>