FIX_TRACKER_ISSUE_ADD_SUPER_ADMIN_THEN_VIEW : AADHAVAN
This commit is contained in:
parent
02ca69c533
commit
873b1350cd
@ -23,11 +23,13 @@ $routes->post("add_account", "Users::add_account");
|
|||||||
//end Login//
|
//end Login//
|
||||||
|
|
||||||
//Users//
|
//Users//
|
||||||
// $routes->get('/', 'Users::index');
|
$routes->get('user_list/(:any)', 'Users::user_list/$1');
|
||||||
$routes->get('index/', 'Users::index');
|
$routes->get('index/', 'Users::index');
|
||||||
$routes->post("add_user", "Users::add_user");
|
$routes->post("add_user", "Users::add_user");
|
||||||
$routes->post("get_branch", "Users::get_branch");
|
$routes->post("get_branch", "Users::get_branch");
|
||||||
$routes->get("new_user/(:any)", "Users::new_user/$1");
|
$routes->get("new_user/(:any)", "Users::new_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");
|
$routes->get("delete_user/(:any)", "Users::delete_user/$1");
|
||||||
//end users//
|
//end users//
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,6 @@ class Login extends BaseController
|
|||||||
|
|
||||||
// Check if user with provided email exists
|
// Check if user with provided email exists
|
||||||
$user = $loginModel->where('email', $email)->first();
|
$user = $loginModel->where('email', $email)->first();
|
||||||
// echo $user['password'];die;
|
|
||||||
|
|
||||||
if ($user && password_verify($password, $user['password'])) {
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
|
||||||
@ -52,17 +51,23 @@ class Login extends BaseController
|
|||||||
|
|
||||||
return redirect()->to('dashboard');
|
return redirect()->to('dashboard');
|
||||||
} else {
|
} 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
|
// 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 {
|
} else {
|
||||||
// Validation failed, show error messages
|
// 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('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,30 @@ class Users extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
public function new_user($user_id)
|
||||||
{
|
{
|
||||||
$uri = $this->request->getUri();
|
$uri = $this->request->getUri();
|
||||||
@ -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)
|
public function edit_account($user_id)
|
||||||
{
|
{
|
||||||
$uri = $this->request->getUri();
|
$uri = $this->request->getUri();
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class RoleModel extends Model
|
|||||||
protected $primaryKey = 'role_id';
|
protected $primaryKey = 'role_id';
|
||||||
protected $allowedFields = ['role_id','roles','isactive'];
|
protected $allowedFields = ['role_id','roles','isactive'];
|
||||||
public function getRoles(){
|
public function getRoles(){
|
||||||
return $this->findAll();
|
return $this->where('roles !=', 'Super Admin')->findAll();
|
||||||
}
|
}
|
||||||
public function getRoleNameById($roleId)
|
public function getRoleNameById($roleId)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
<th>Postal Code</th>
|
<th>Postal Code</th>
|
||||||
<th>Mobile No</th>
|
<th>Mobile No</th>
|
||||||
<th>Active</th>
|
<th>Active</th>
|
||||||
|
<th>User List</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -59,8 +60,12 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<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
|
<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>
|
class="ri-pencil-line" style="margin-right: 5px;"></i></a>
|
||||||
|
|
||||||
<a href="<?= base_url("delete_branch/".$value['branch_id']); ?>"
|
<a href="<?= base_url("delete_branch/".$value['branch_id']); ?>"
|
||||||
class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
<th>State</th>
|
<th>State</th>
|
||||||
<th>Postal Code</th>
|
<th>Postal Code</th>
|
||||||
<th>Country</th>
|
<th>Country</th>
|
||||||
|
<th>Branch List</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -58,10 +59,10 @@
|
|||||||
<td><?= $value['postal_code']; ?></td>
|
<td><?= $value['postal_code']; ?></td>
|
||||||
<td><?= $value['country']; ?></td>
|
<td><?= $value['country']; ?></td>
|
||||||
<!-- Call the model method -->
|
<!-- Call the model method -->
|
||||||
|
<td> <a href="<?= base_url("branch_index/" . $value['business_id']) ?>" style="margin-left: 20px;">View</a></td>
|
||||||
<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" style="margin-right: 5px;"><i
|
||||||
<a href="<?= "new_business/" . $value['business_id']; ?>" class="edit-button"><i
|
|
||||||
class="ri-pencil-line"></i></a>
|
class="ri-pencil-line"></i></a>
|
||||||
|
|
||||||
<a href="<?= "delete_business/" . $value['business_id']; ?>"
|
<a href="<?= "delete_business/" . $value['business_id']; ?>"
|
||||||
|
|||||||
@ -105,6 +105,17 @@
|
|||||||
<li class="menu-title">Navigation</li>
|
<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' ||
|
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||||
session()->get('logged_user_role') == 'Administrator' ||
|
session()->get('logged_user_role') == 'Administrator' ||
|
||||||
session()->get('logged_user_role') == 'Sales') {
|
session()->get('logged_user_role') == 'Sales') {
|
||||||
@ -212,9 +223,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="<?php echo base_url('product_index') ?>">Products</a>
|
<a href="<?php echo base_url('product_index') ?>">Products</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- <li>
|
<li>
|
||||||
<a href="<?php echo base_url('service_index') ?>">Services</a>
|
<a href="<?php echo base_url('service_index') ?>">Services</a>
|
||||||
</li> -->
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -46,21 +46,31 @@
|
|||||||
|
|
||||||
<form action="<?= base_url() . "authenticate" ?>" method="post">
|
<form action="<?= base_url() . "authenticate" ?>" method="post">
|
||||||
|
|
||||||
|
<?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">
|
<div class="form-group">
|
||||||
<label for="email">Email:</label>
|
<label for="email">Email:</label>
|
||||||
<input type="email" class="form-control" id="email" name="email">
|
<input type="email" class="form-control" id="email" name="email" value="<?= session()->getFlashdata('email_input') ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">Password:</label>
|
<label for="password">Password:</label>
|
||||||
<input type="password" class="form-control" id="password" name="password">
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group mb-0 text-center">
|
<div class="form-group mb-0 text-center">
|
||||||
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
|
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
</div>
|
</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 id="manufacturer_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="manufacturername">Manufacturer Name </label>
|
<label for="manufacturername">Manufacturer Name </label>
|
||||||
<input type="text" id="manufacturer_id" hidden>
|
<input type="text" id="manufacturer_id" hidden>
|
||||||
<input class="form-control" type="text" id="manufacturer_name" required="" placeholder="Make Name....">
|
<input class="form-control" type="text" id="manufacturer_name" required="" placeholder="Manufacturer Name....">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="manufacturername">Quality</label>
|
<label for="manufacturername">Quality</label>
|
||||||
@ -110,6 +110,11 @@
|
|||||||
edit_manufacturer_id =0;
|
edit_manufacturer_id =0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!$('#manufacturer_name').val() || !$('#quality').val()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '<?php echo base_url()."create_manufacturer/"?>'+edit_manufacturer_id,
|
url: '<?php echo base_url()."create_manufacturer/"?>'+edit_manufacturer_id,
|
||||||
|
|||||||
@ -21,22 +21,19 @@
|
|||||||
<form action="<?= base_url() . "add_service"; ?>" method="post">
|
<form action="<?= base_url() . "add_service"; ?>" method="post">
|
||||||
<h4 class="header-title">Service Details :</h4><br>
|
<h4 class="header-title">Service Details :</h4><br>
|
||||||
<div class="form-row">
|
<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>
|
<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="">Select</option>
|
||||||
<option value="0" <?= (isset($services['category']) && $services['category'] == 0) ? 'selected' : '' ?> >Custom</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>
|
<option value="1" <?= (isset($services['category']) && $services['category'] == 1) ? 'selected' : '' ?> >Manual</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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>
|
<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>
|
<div class="form-group col-md-3" id="make_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
|
||||||
<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">
|
|
||||||
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
|
<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>
|
<select class="form-control SelExample" id="make" name="make[]" required multiple>
|
||||||
<!-- Options for make -->
|
<!-- Options for make -->
|
||||||
@ -46,7 +43,7 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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>
|
<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>
|
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
||||||
<!-- <option value="0">Custom</option> -->
|
<!-- <option value="0">Custom</option> -->
|
||||||
@ -57,10 +54,7 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-3">
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label for="model" class="col-form-label">Product<span class="text-danger">*</span></label>
|
<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>
|
<select class="form-control SelExample" id="productSelect" name="product_id[]" required multiple>
|
||||||
<option value="">Select a Product</option>
|
<option value="">Select a Product</option>
|
||||||
@ -74,7 +68,7 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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>
|
<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>
|
<select class="form-control SelExample" id="serviceSelected" name="sub_service_id[]" required multiple>
|
||||||
<option value="">Select a Service</option>
|
<option value="">Select a Service</option>
|
||||||
@ -176,7 +170,7 @@ $(document).ready(function() {
|
|||||||
$('#make').change(function() {
|
$('#make').change(function() {
|
||||||
var selected_makes = $(this).val(); // Get the selected make ID
|
var selected_makes = $(this).val(); // Get the selected make ID
|
||||||
|
|
||||||
console.log(selected_makes);
|
// console.log(selected_makes);
|
||||||
var models_id = $('#model').val();
|
var models_id = $('#model').val();
|
||||||
// AJAX request to get models based on the selected make ID
|
// AJAX request to get models based on the selected make ID
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -259,15 +253,19 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('category').addEventListener('change', function() {
|
document.getElementById('category').addEventListener('change', function() {
|
||||||
var customFields = document.getElementById('customFields');
|
// var customFields = document.getElementById('customFields');
|
||||||
var makeSelect = document.getElementById('make');
|
var makeSelect = document.getElementById('make');
|
||||||
var modelSelect = document.getElementById('model');
|
var modelSelect = document.getElementById('model');
|
||||||
if (this.value == '1') {
|
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');
|
makeSelect.setAttribute('required', 'required');
|
||||||
modelSelect.setAttribute('required', 'required');
|
modelSelect.setAttribute('required', 'required');
|
||||||
} else {
|
} else {
|
||||||
customFields.style.display = 'none';
|
// customFields.style.display = 'none';
|
||||||
|
$('#make_hide').css('display' , 'none');
|
||||||
|
$('#model_hide').css('display' ,'none');
|
||||||
makeSelect.removeAttribute('required');
|
makeSelect.removeAttribute('required');
|
||||||
modelSelect.removeAttribute('required');
|
modelSelect.removeAttribute('required');
|
||||||
}
|
}
|
||||||
@ -277,7 +275,7 @@ document.getElementById('category').addEventListener('change', function() {
|
|||||||
<script>
|
<script>
|
||||||
data = <?php echo json_encode($product) ?>;
|
data = <?php echo json_encode($product) ?>;
|
||||||
$('#productSelect').change(function() {
|
$('#productSelect').change(function() {
|
||||||
console.log('jsfd');
|
// console.log('jsfd');
|
||||||
if(this.value != 0) {
|
if(this.value != 0) {
|
||||||
// Get the selected options
|
// Get the selected options
|
||||||
var selectedOptions = this.selectedOptions;
|
var selectedOptions = this.selectedOptions;
|
||||||
@ -291,18 +289,18 @@ document.getElementById('category').addEventListener('change', function() {
|
|||||||
sum += parseInt(price);
|
sum += parseInt(price);
|
||||||
}
|
}
|
||||||
$('#productCost').val(parseInt(sum));
|
$('#productCost').val(parseInt(sum));
|
||||||
console.log(sum);
|
// console.log(sum);
|
||||||
|
|
||||||
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
||||||
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val()) + labour_cost;
|
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val()) + labour_cost;
|
||||||
console.log("New value of #serviceCost:", add);
|
// console.log("New value of #serviceCost:", add);
|
||||||
$('#price').val(add);
|
$('#price').val(add);
|
||||||
}
|
}
|
||||||
else if(this.value == '') {
|
else if(this.value == '') {
|
||||||
$('#productCost').val(0);
|
$('#productCost').val(0);
|
||||||
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val());
|
||||||
add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) + labour_cost;
|
add = parseInt($('#productCost').val()) + parseInt($('#serviceCost').val()) + labour_cost;
|
||||||
console.log("New value of #serviceCost:", add);
|
// console.log("New value of #serviceCost:", add);
|
||||||
$('#price').val(add);
|
$('#price').val(add);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -322,7 +320,7 @@ document.getElementById('category').addEventListener('change', function() {
|
|||||||
<script>
|
<script>
|
||||||
servicedata = <?php echo json_encode($service) ?>;
|
servicedata = <?php echo json_encode($service) ?>;
|
||||||
$('#serviceSelected').change(function() {
|
$('#serviceSelected').change(function() {
|
||||||
console.log(this.value);
|
// console.log(this.value);
|
||||||
if(this.value != 0) {
|
if(this.value != 0) {
|
||||||
// Get the selected options
|
// Get the selected options
|
||||||
var selectedOptions = this.selectedOptions;
|
var selectedOptions = this.selectedOptions;
|
||||||
@ -335,25 +333,25 @@ document.getElementById('category').addEventListener('change', function() {
|
|||||||
ssum += parseInt(sprice);
|
ssum += parseInt(sprice);
|
||||||
}
|
}
|
||||||
$('#serviceCost').val(parseInt(ssum));
|
$('#serviceCost').val(parseInt(ssum));
|
||||||
console.log(ssum);
|
// console.log(ssum);
|
||||||
|
|
||||||
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
|
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
|
||||||
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
|
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
|
||||||
console.log("New value of #serviceCost:", add);
|
// console.log("New value of #serviceCost:", add);
|
||||||
$('#price').val(add);
|
$('#price').val(add);
|
||||||
}
|
}
|
||||||
else if(this.value == '') {
|
else if(this.value == '') {
|
||||||
$('#serviceCost').val(0);
|
$('#serviceCost').val(0);
|
||||||
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
|
labour_cost = ($('#labour_cost').val() == '') ? 0 : parseInt($('#labour_cost').val()) + labour_cost;
|
||||||
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
|
add = parseInt($('#serviceCost').val()) + parseInt($('#productCost').val());
|
||||||
console.log("New value of #serviceCost:", add);
|
// console.log("New value of #serviceCost:", add);
|
||||||
$('#price').val(add);
|
$('#price').val(add);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Function to fetch the price for a product
|
// Function to fetch the price for a product
|
||||||
function getPriceForServiceId(serviceId) {
|
function getPriceForServiceId(serviceId) {
|
||||||
console.log(serviceId);
|
// console.log(serviceId);
|
||||||
for (var i = 0; i < servicedata.length; i++) {
|
for (var i = 0; i < servicedata.length; i++) {
|
||||||
if (servicedata[i].service_id === serviceId) {
|
if (servicedata[i].service_id === serviceId) {
|
||||||
// Return the purchase_cost if the product_id matches
|
// Return the purchase_cost if the product_id matches
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
<!-- <option value="">Select Branch</option> -->
|
<!-- <option value="">Select Branch</option> -->
|
||||||
<?php if (isset($branch) && (is_array($branch) || is_object($branch))) {
|
<?php if (isset($branch) && (is_array($branch) || is_object($branch))) {
|
||||||
foreach ($branch as $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; } ?>
|
<?php endforeach; } ?>
|
||||||
<!-- Branch options will be populated dynamically using JavaScript -->
|
<!-- Branch options will be populated dynamically using JavaScript -->
|
||||||
</select>
|
</select>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var user_id = "<?php echo $user_id; ?>";
|
var user_id = "<?php echo isset($user_id); ?>";
|
||||||
|
|
||||||
|
|
||||||
if (user_id) {
|
if (user_id) {
|
||||||
|
|||||||
59
app/Views/user_list_super_admin.php
Normal file
59
app/Views/user_list_super_admin.php
Normal 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>
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user