Merge branch 'main' of bitbucket.org:venbainformationtechnology/the_mechanic
This commit is contained in:
commit
c3e481a30c
@ -15,9 +15,11 @@ $routes->get('/', 'Login::index');
|
||||
$routes->get('log_out', 'Login::index');
|
||||
$routes->post("authenticate", "Login::authenticate");
|
||||
$routes->get("edit_account/(:any)", "Users::edit_account/$1");
|
||||
$routes->post("edit_mail/(:any)", "Users::edit_mail/$1");
|
||||
$routes->post("change_password/(:any)", "Users::change_password/$1");
|
||||
$routes->post("add_account", "Users::add_account");
|
||||
// $routes->get("new_user/(:any)", "Users::new_user/$1");
|
||||
// $routes->get("delete_user/(:any)", "Users::delete_user/$1");
|
||||
// $routes->get("delete_user/(:any)", "Users::delete_user/$1");
|
||||
//end Login//
|
||||
|
||||
//Users//
|
||||
@ -40,8 +42,12 @@ $routes->get("delete_business/(:any)", "Business::delete_business/$1");
|
||||
$routes->get('branch_index/(:any)', 'Branch::branch_index/$1');
|
||||
$routes->post('add_branch/(:any)', 'Branch::new_branch/$1');
|
||||
$routes->post('edit_branch/(:any)', 'Branch::edit_branch/$1');
|
||||
$routes->post('edit_branch_form/(:any)', 'Branch::edit_branch_form/$1');
|
||||
$routes->get("get_branch/(:any)", "Branch::get_branch/$1");
|
||||
$routes->get("delete_branch/(:any)", "Branch::delete_branch/$1");
|
||||
$routes->get('business_branches',"Branch::business_branches");
|
||||
$routes->get('get_branch_edit_form/(:any)',"Branch::get_branch_edit_form/$1");
|
||||
|
||||
// end Branch//
|
||||
|
||||
// Products//
|
||||
|
||||
@ -68,6 +68,7 @@ class Branch extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function edit_branch($branch_id)
|
||||
{
|
||||
if ($branch_id) {
|
||||
@ -98,4 +99,33 @@ class Branch extends BaseController
|
||||
return redirect()->to('branch_index/' . $existingBranch['business_id']);
|
||||
}
|
||||
|
||||
|
||||
public function get_branch_edit_form($branch_id){
|
||||
|
||||
|
||||
if ($branch_id) {
|
||||
|
||||
$BranchModel = new BranchModel();
|
||||
$branchs =$BranchModel->where('branch_id',$branch_id)->first();
|
||||
$branch['page_name'] = "Edit Branch";
|
||||
$branch['branch'] = $branchs;
|
||||
return view('branch_edit_form',$branch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function edit_branch_form($branch_id)
|
||||
{
|
||||
if ($branch_id) {
|
||||
$data = $this->request->getPost();
|
||||
$BranchModel = new BranchModel();
|
||||
|
||||
// print_r($data);die;
|
||||
$BranchModel->update($branch_id,$data);
|
||||
|
||||
return view('dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -23,7 +23,9 @@ class Users extends BaseController
|
||||
public function index()
|
||||
{
|
||||
$UsersModel = new UsersModel();
|
||||
$users = $UsersModel->findAll();
|
||||
$business_id =session()->get('logged_user_business_id');
|
||||
$branch_id =session()->get('logged_user_branch_id');
|
||||
$users = $UsersModel->where('business_id',$business_id)->where('branch_id',$branch_id)->findAll();
|
||||
$data['users']=$users;
|
||||
|
||||
$roleModel = new RoleModel();
|
||||
@ -58,22 +60,36 @@ class Users extends BaseController
|
||||
|
||||
$data['users'] = [];
|
||||
$BusinessModel=new BusinessModel();
|
||||
$BranchModel=new BranchModel();
|
||||
$business=$BusinessModel->findAll();
|
||||
$business_select = $BusinessModel->where('business_id',session()->get('logged_user_business_id'))->findAll();
|
||||
|
||||
$branch_list = $BranchModel->where('business_id',session()->get('logged_user_business_id'))->findAll();
|
||||
// print_r($business);die;
|
||||
$rolemodel = new RoleModel();
|
||||
|
||||
$roles =$rolemodel->getRoles();
|
||||
|
||||
$data['business'] = $business;
|
||||
// $data['business'] = $business;
|
||||
$data['business'] = $business_select;
|
||||
$data['branch'] = $branch_list;
|
||||
$data['roles'] = $roles;
|
||||
} else if ($user_id !== '0') {
|
||||
|
||||
$UsersModel = new UsersModel();
|
||||
$users=$UsersModel->getUserById($user_id);
|
||||
$BusinessModel=new BusinessModel();
|
||||
$BranchModel=new BranchModel();
|
||||
$business=$BusinessModel->findAll();
|
||||
$business_select = $BusinessModel->where('business_id',session()->get('logged_user_business_id'))->findAll();
|
||||
|
||||
|
||||
$data['users']=$users;
|
||||
$data['business'] = $business;
|
||||
|
||||
$branch = $BranchModel->where('branch_id',$users['branch_id'])->findAll();
|
||||
|
||||
$data['branch'] = $branch;
|
||||
$data['business'] = $business_select;
|
||||
$rolemodel = new RoleModel();
|
||||
|
||||
$roles =$rolemodel->getRoles();
|
||||
@ -117,9 +133,11 @@ class Users extends BaseController
|
||||
$data['branches'] = $branch;
|
||||
$rolemodel = new RoleModel();
|
||||
|
||||
$role = $rolemodel->where('role_id',$users['role'])->first();
|
||||
$roles =$rolemodel->getRoles();
|
||||
|
||||
$data['roles'] = $roles;
|
||||
$data['role'] = $role;
|
||||
|
||||
}
|
||||
$data['user_id'] = $user_id;
|
||||
@ -256,4 +274,56 @@ class Users extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function edit_mail($user_id){
|
||||
|
||||
$UsersModel = new UsersModel();
|
||||
|
||||
$data = [
|
||||
'email' => $this->request->getPost('email'),
|
||||
];
|
||||
|
||||
$UsersModel->update($user_id, $data);
|
||||
|
||||
$user_mail =$UsersModel->where('user_id',$user_id)->first();
|
||||
|
||||
return json_encode($user_mail);
|
||||
}
|
||||
|
||||
public function change_password($user_id){
|
||||
|
||||
$old_password =$this->request->getPost('old_password');
|
||||
$new_password =$this->request->getPost('new_password');
|
||||
$confirm_password =$this->request->getPost('confirm_password');
|
||||
|
||||
$UsersModel = new UsersModel();
|
||||
$user = $UsersModel->where('user_id',$user_id)->first();
|
||||
$data_old_password = $user['password'];
|
||||
|
||||
if (!password_verify($old_password, $data_old_password)) {
|
||||
$response = array(
|
||||
'status' => 'error',
|
||||
'message' => 'Old Password Not Match...'
|
||||
);
|
||||
return json_encode($response);
|
||||
}
|
||||
|
||||
if($new_password != $confirm_password){
|
||||
$response = array(
|
||||
'status' => 'error',
|
||||
'message' => 'New Password And Confirm Password Not Match...'
|
||||
);
|
||||
return json_encode($response);
|
||||
}
|
||||
|
||||
$hashedPassword = password_hash($new_password, PASSWORD_DEFAULT);
|
||||
$data['password'] = $hashedPassword;
|
||||
|
||||
if ($UsersModel->update($user_id, $data)) {
|
||||
$response = array(
|
||||
'status' => 'success',
|
||||
'message' => 'Password Change Succuessfully'
|
||||
);
|
||||
return json_encode($response);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
app/Views/branch_edit_form.php
Normal file
56
app/Views/branch_edit_form.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"><?php echo $page_name ?></h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<form action="<?= base_url() . "edit_branch_form/". session()->get('logged_user_branch_id'); ?>" method="post">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputEmail4" class="col-form-label">Branch Name</label>
|
||||
<input type="text" class="form-control" name="branch_name" placeholder="Name" value="<?= isset($branch['branch_name']) ? $branch['branch_name'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputAddress" class="col-form-label">Mobile</label>
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($branch['mobile_no']) ? $branch['mobile_no'] : '' ?>" required maxlength="10" minlength="10">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Address</label>
|
||||
<input type="text" class="form-control" name="address" placeholder="Address"value="<?= isset($branch['address']) ? $branch['address'] : '' ?>" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="hidden" id="business_id" name="business_id" value="<?= isset($branch['business_id']) ? $branch['business_id'] : '' ?>">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">City</label>
|
||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($branch['city']) ? $branch['city'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">State</label>
|
||||
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($branch['state']) ? $branch['state'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Postal Code</label>
|
||||
<input type="text" class="form-control" name="postal_code" placeholder="Postal Code"value="<?= isset($branch['postal_code']) ? $branch['postal_code'] : '' ?>" required maxlength="6" minlength="6">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
@ -1,43 +1,49 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Add User</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
|
||||
</li>
|
||||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
||||
<li class="breadcrumb-item active">Datatables</li> -->
|
||||
</ol>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Profile</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<form action="<?= base_url() . "add_account"; ?>" method="post">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputEmail4" class="col-form-label">Name</label>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name" value="<?= isset($users['name']) ? $users['name'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputEmail4" class="col-form-label">Email</label>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email" value="<?= isset($users['email']) ? $users['email'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputPassword4" class="col-form-label">Password</label>
|
||||
<input type="password" class="form-control" name="password" placeholder="Password" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputAddress" class="col-form-label">Mobile</label>
|
||||
<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?= isset($users['mobile_no']) ? $users['mobile_no'] : '' ?>" maxlength="10" minlength="10"required>
|
||||
<div class="col-lg-4 col-xl-4">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h4 class="mt-3 mb-0"><?php echo $users['name']; ?></h4>
|
||||
<p class="text-muted">@<?php echo $role['roles']; ?></p>
|
||||
|
||||
|
||||
<div class="text-left mt-3" style=" margin-bottom: 16px;">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Full Name :</th>
|
||||
<td class="text-muted"><?php echo $users['name']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Mobile :</th>
|
||||
<td class="text-muted"><?php echo $users['mobile_no']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Email :</th>
|
||||
<td class="text-muted"><?php echo $users['email']; ?></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="user_id" name="user_id" value="<?= isset($users['user_id']) ? $users['user_id'] : '' ?>">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
@ -66,48 +72,252 @@
|
||||
<?php foreach ($branches as $branch): ?>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-8 col-xl-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="tab-pane show active" id="settings">
|
||||
<form>
|
||||
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Personal Info</h5>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" class="form-control" id="name" value="<?php echo $users['name']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="mobile_no">Mobile Number</label>
|
||||
<input type="text" class="form-control" id="mobile_no" value="<?php echo $users['mobile_no']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="user_id" value="<?php echo $users['user_id']; ?>" hidden>
|
||||
<label for="useremail">Email Address</label>
|
||||
<input type="email" class="form-control" id="useremail" value="<?php echo $users['email']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" style="margin-top: 28px;">
|
||||
<button type="button" class="btn btn-primary" onclick="submitPersonalInfo()">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<!-- end settings content-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-12 col-xl-12">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<div class="text-left mt-3">
|
||||
|
||||
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Change Password</h5>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="old_password">Old Password</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" id="old_password" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
<i class="fa fa-eye" id="toggleOldPassword"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="new_password">New Password</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" id="new_password" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
<i class="fa fa-eye" id="toggleNewPassword"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">Confirm Password</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" id="confirm_password" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
<i class="fa fa-eye" id="toggleConfirmPassword"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6" style="margin-top: 27px;">
|
||||
<button type="submit" class="btn btn-primary" id="submit_password" onclick="changePassword(this)">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#business').change(function() {
|
||||
var businessId = $(this).val();
|
||||
if (businessId !== '') {
|
||||
$.ajax({
|
||||
url: '<?php echo base_url(),"get_branch"?>', // Update 'your_controller' with the actual controller name
|
||||
type: 'post',
|
||||
data: {business_id: businessId},
|
||||
dataType: 'json',
|
||||
success:function(response) {
|
||||
var len = response.length;
|
||||
$("#branch").empty();
|
||||
$("#branch").append("<option value=''>Select Branch</option>");
|
||||
for( var i = 0; i<len; i++) {
|
||||
var branchId = response[i]['branch_id'];
|
||||
var branchName = response[i]['branch_name'];
|
||||
$("#branch").append("<option value='"+branchId+"'>"+branchName+"</option>");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function submitPersonalInfo(params) {
|
||||
|
||||
var user_id = $('#user_id').val();
|
||||
|
||||
var formData = {
|
||||
email: $('#useremail').val(),
|
||||
mobile_no: $('#mobile_no').val(),
|
||||
name: $('#name').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."edit_mail/"?>' + user_id,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function changePassword(params) {
|
||||
|
||||
var user_id = $('#user_id').val();
|
||||
|
||||
var formData = {
|
||||
old_password: $('#old_password').val(),
|
||||
new_password: $('#new_password').val(),
|
||||
confirm_password: $('#confirm_password').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."change_password/"?>' + user_id,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status == 'error') {
|
||||
toastr.warning(response.message, 'Warning');
|
||||
}else{
|
||||
toastr.success(response.message, 'Success');
|
||||
|
||||
$('#old_password').val('');
|
||||
$('#new_password').val('');
|
||||
$('#confirm_password').val('');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
var oldPasswordField = document.getElementById("old_password");
|
||||
var toggleOldPassword = document.getElementById("toggleOldPassword");
|
||||
|
||||
var newPasswordField = document.getElementById("new_password");
|
||||
var toggleNewPassword = document.getElementById("toggleNewPassword");
|
||||
|
||||
var confirmField = document.getElementById("confirm_password");
|
||||
var toggleConfirmPassword = document.getElementById("toggleConfirmPassword");
|
||||
|
||||
toggleOldPassword.addEventListener("click", function() {
|
||||
togglePasswordVisibility(oldPasswordField, toggleOldPassword);
|
||||
});
|
||||
|
||||
toggleNewPassword.addEventListener("click", function() {
|
||||
togglePasswordVisibility(newPasswordField, toggleNewPassword);
|
||||
});
|
||||
|
||||
toggleConfirmPassword.addEventListener("click", function() {
|
||||
togglePasswordVisibility(confirmField, toggleConfirmPassword);
|
||||
});
|
||||
|
||||
function togglePasswordVisibility(field, toggle) {
|
||||
if (field.type === "password") {
|
||||
field.type = "text";
|
||||
toggle.className = "fa fa-eye-slash";
|
||||
} else {
|
||||
field.type = "password";
|
||||
toggle.className = "fa fa-eye";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var newPasswordField = document.getElementById('new_password');
|
||||
var confirmPasswordField = document.getElementById('confirm_password');
|
||||
var submitButton = document.getElementById('submit_password');
|
||||
|
||||
// Add an event listener to the "Confirm Password" field
|
||||
confirmPasswordField.addEventListener('input', function() {
|
||||
// Check if the passwords match
|
||||
if (newPasswordField.value === confirmPasswordField.value) {
|
||||
// Enable the submit button
|
||||
submitButton.disabled = false;
|
||||
} else {
|
||||
$("#branch").empty();
|
||||
$("#branch").append("<option value=''>Select Branch</option>");
|
||||
// Disable the submit button
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -181,24 +181,6 @@
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ) { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url('index') ?>">
|
||||
@ -212,7 +194,11 @@
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Administrator') { ?>
|
||||
<li class="menu-title mt-2">Apps</li>
|
||||
<li> <a href="<?php echo base_url('business_index') ?>"><i class="ri-layout-line"></i><span> Business </span></a></li>
|
||||
<li>
|
||||
<!-- <a href="<?php echo base_url('branch_index/'. session()->get('logged_user_business_id')) ?>"> -->
|
||||
<!-- <i class="ri-layout-line"></i><span> Branches </span> -->
|
||||
<!-- </a> -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('index') ?>"><i class="fas fa-user"></i><span> Users</span></a></li>
|
||||
<?php } ?>
|
||||
@ -291,8 +277,19 @@
|
||||
<span>My Account</span>
|
||||
</a>
|
||||
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Administrator') { ?>
|
||||
<a href="<?= base_url("new_business/". session()->get("logged_user_business_id")); ?>" class="dropdown-item notify-item">
|
||||
<i class="ri-layout-line"></i>
|
||||
<span>Business</span>
|
||||
</a>
|
||||
<a href="<?= base_url("get_branch_edit_form/".session()->get('logged_user_branch_id')); ?>" class="dropdown-item notify-item">
|
||||
<i class="fas fa-code-branch"></i>
|
||||
<span>Branches</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<!-- <div class="dropdown-divider"></div> -->
|
||||
|
||||
<!-- item-->
|
||||
<a href="<?php echo base_url("log_out")?>" class="dropdown-item notify-item">
|
||||
|
||||
@ -50,23 +50,27 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputState" class="col-form-label">Business</label>
|
||||
<select id="business" class="form-control" name="business" required>
|
||||
<option value="">Select Business</option>
|
||||
<?php foreach ($business as $busin): ?>
|
||||
<option value="<?= $busin['business_id'] ?>" <?= isset($users['business_id']) && $users['business_id'] == $busin['business_id'] ? 'selected' : '' ?>><?= $busin['business_name'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputState" class="col-form-label">Branch</label>
|
||||
<select id="branch" class="form-control" name="branch" required>
|
||||
<option value="">Select Branch</option>
|
||||
<!-- Branch options will be populated dynamically using JavaScript -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputState" class="col-form-label">Business</label>
|
||||
<select id="business" class="form-control" name="business" required>
|
||||
<!-- <option value="">Select Business</option> -->
|
||||
<?php foreach ($business as $busin): ?>
|
||||
<option value="<?= $busin['business_id'] ?>" <?= isset($users['business_id']) && $users['business_id'] == $busin['business_id'] ? 'selected' : '' ?>><?= $busin['business_name'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="inputState" class="col-form-label">Branch</label>
|
||||
<select id="branch" class="form-control" name="branch" required>
|
||||
<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>
|
||||
<?php endforeach; } ?>
|
||||
<!-- Branch options will be populated dynamically using JavaScript -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user