heama
This commit is contained in:
parent
0f0a5231a8
commit
2791cf9b4f
@ -128,4 +128,26 @@ class Books extends BaseController
|
||||
}
|
||||
return redirect()->route('book_list');
|
||||
}
|
||||
public function delete_book($id)
|
||||
{
|
||||
$BooksModel = new BooksModel();
|
||||
|
||||
// Check if the business ID exists
|
||||
$existingBook = $BooksModel->find($id);
|
||||
if (!$existingBook) {
|
||||
// return redirect()->to(base_url('Business/index'))->with('error', 'Business not found.');
|
||||
return redirect()->route('book_list');
|
||||
}
|
||||
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
// Delete the business record
|
||||
$data['isactive'] = 0;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BooksModel->update($id, $data);
|
||||
//$BusinessModel->delete($id);
|
||||
|
||||
// return redirect()->to(base_url('Business/index'))->with('success', 'Business deleted successfully.');
|
||||
return redirect()->route('book_list');
|
||||
}
|
||||
}
|
||||
@ -12,8 +12,8 @@ class Users extends BaseController
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
$session_role = get_user_role('user_role');
|
||||
$session_bid = get_business_id('business_id');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$where = ['users.business_id' => (int)$session_bid, 'users.isactive' => 1];
|
||||
@ -32,7 +32,8 @@ class Users extends BaseController
|
||||
public function user_page($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_role = get_user_role('user_role');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add User';
|
||||
$data['details'] = [];
|
||||
@ -50,6 +51,7 @@ class Users extends BaseController
|
||||
}
|
||||
$business_details = !empty($session_role) && $session_role === "sadmin" ? $this->business_details() : [];
|
||||
$data['business_details'] = $business_details;
|
||||
$data['session_bid'] = $session_bid;
|
||||
$this->render_page('user_form', $data);
|
||||
}
|
||||
## For SuperAdmin Role business Dropdown displayed on Userpage.otherwise Hidden fields
|
||||
@ -99,13 +101,13 @@ class Users extends BaseController
|
||||
|
||||
// Delete the previous image file if it exists
|
||||
if ($user_id) {
|
||||
$previousFileName = $this->request->getPost('previous_file');
|
||||
$previousFileName = $this->request->getPost('previous_ufile');
|
||||
if ($previousFileName && is_file('public/uploads/' . $previousFileName)) {
|
||||
link('public/uploads/' . $previousFileName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$fileName = $this->request->getPost('previous_file', ''); // Use the previous filename if no new image is provided
|
||||
$fileName = $this->request->getPost('previous_ufile', ''); // Use the previous filename if no new image is provided
|
||||
}
|
||||
|
||||
|
||||
@ -116,6 +118,7 @@ class Users extends BaseController
|
||||
'profile_picture' => $fileName,
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'email' => $this->request->getPost('email'),
|
||||
'postal_code' => $this->request->getPost('postal_code'),
|
||||
'country' => $this->request->getPost('country'),
|
||||
'role' => $this->request->getPost('role'),
|
||||
@ -138,10 +141,10 @@ class Users extends BaseController
|
||||
$UsersModel->insert($data);
|
||||
} else {
|
||||
// It's an update operation
|
||||
$isactive = $this->request->getPost('bcheckbox');
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BooksModel->update($book_id, $data);
|
||||
$UsersModel->update($user_id, $data);
|
||||
}
|
||||
return redirect()->route('user_list');
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
<ul class="list-inline table-action m-0">
|
||||
<li class="list-inline-item">
|
||||
<a href="<?php echo $edit_page_route; ?>" class="action-icon px-1"> <i class="ri ri-edit-box-fill"></i></a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
@ -6,119 +6,168 @@
|
||||
<!-- <?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?> -->
|
||||
<form class="needs-validation" novalidate action="<?= base_url() . "user_synchronization"; ?>" method="post" enctype="multipart/form-data">
|
||||
<form class="needs-validation" novalidate action="<?= base_url() . "user_synchronization"; ?>"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="user_name" class="col-form-label">User Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="user_name" name="user_name" value="<?= isset($details['user_name']) ? $details['user_name'] : '' ?>" placeholder="User Name" required />
|
||||
<label for="user_name" class="col-form-label">User Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="user_name" name="user_name"
|
||||
value="<?= isset($details['user_name']) ? $details['user_name'] : '' ?>"
|
||||
placeholder="User Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?= isset($details['email']) ? $details['email'] : '' ?>" required />
|
||||
<label for="email" class="col-form-label">Email<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="Email"
|
||||
value="<?= isset($details['email']) ? $details['email'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<?php if (empty($details)) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="password" class="col-form-label">Password<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="password" name="password" placeholder="Password" value="<?= isset($details['password']) ? $details['password'] : '' ?>" required />
|
||||
<label for="password" class="col-form-label">Password<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="password" name="password"
|
||||
placeholder="Password"
|
||||
value="<?= isset($details['password']) ? $details['password'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="first_name" class="col-form-label">First Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name"
|
||||
placeholder="First Name"
|
||||
value="<?= isset($details['first_name']) ? $details['first_name'] : '' ?>"
|
||||
required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="last_name" class="col-form-label">Last Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name"
|
||||
placeholder="Last Name"
|
||||
value="<?= isset($details['last_name']) ? $details['last_name'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="date_of_birth" class="col-form-label">Date Of Birth<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" id="date_of_birth" name="date_of_birth"
|
||||
placeholder="Date Of birth (format : DD/MM/YYYY)" required data-toggle="input-mask"
|
||||
data-mask-format="00/00/0000"
|
||||
value="<?= isset($details['date_of_birth']) ? $details['date_of_birth'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="first_name" class="col-form-label">First Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="<?= isset($details['first_name']) ? $details['first_name'] : '' ?>" required />
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile_no" class="col-form-label">Mobile Number<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="mobile_no" name="mobile_no"
|
||||
placeholder="Mobile Number (Enter only numbers)" required data-parsley-type="number"
|
||||
value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="last_name" class="col-form-label">Last Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name" value="<?= isset($details['last_name']) ? $details['last_name'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="date_of_birth" class="col-form-label">Date Of Birth<span class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" id="date_of_birth" name="date_of_birth" placeholder="Date Of birth (format : DD/MM/YYYY)" required data-toggle="input-mask" data-mask-format="00/00/0000" value="<?= isset($details['date_of_birth']) ? $details['date_of_birth'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile_no" class="col-form-label">Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" required data-parsley-type="number" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="gender" class="col-form-label">Gender</label>
|
||||
<input type="text" class="form-control" id="gender" name="gender" placeholder="Gender" value="<?= isset($details['gender']) ? $details['gender'] : '' ?>" />
|
||||
<input type="text" class="form-control" id="gender" name="gender" placeholder="Gender"
|
||||
value="<?= isset($details['gender']) ? $details['gender'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="role" name="role" placeholder="Role" required value="<?= isset($details['role']) ? $details['role'] : '' ?>" />
|
||||
<input type="text" class="form-control" id="role" name="role" placeholder="Role"
|
||||
required value="<?= isset($details['role']) ? $details['role'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<?php if (!empty($details['profile_picture'])) { ?>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="profile_picture" class="col-form-label">Current Business Logo</label>
|
||||
<img src="<?= base_url('public/uploads/'. $details['profile_picture']) ?>" alt="Business Logo" class="preview-image" />
|
||||
<img src="<?= base_url('public/uploads/'. $details['profile_picture']) ?>"
|
||||
alt="Business Logo" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="profile_picture" class="col-form-label">Profile Picture<span class="text-danger">*</span></label>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="profile_picture" class="col-form-label">Profile Picture<span
|
||||
class="text-danger">*</span></label>
|
||||
|
||||
<!-- <input type="text" class="form-control" id="profile_picture" name="profile_picture" placeholder="Profile picture Name" readonly value="<?= isset($details['profile_picture']) ? $details['profile_picture'] : '' ?>" /> -->
|
||||
|
||||
<input type="file" name="profile_picture" placeholder="hidden Field for profile picture" readonly value="<?= isset($details['profile_picture']) ? $details['profile_picture'] : '' ?>" />
|
||||
<input type="file" name="profile_picture" placeholder="hidden Field for profile picture"
|
||||
readonly
|
||||
value="<?= isset($details['profile_picture']) ? $details['profile_picture'] : '' ?>" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="address" class="col-form-label">Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="address" name="address" placeholder="Address (eg : 1234 Main St)" required value="<?= isset($details['address']) ? $details['address'] : '' ?>" />
|
||||
<label for="address" class="col-form-label">Address<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="address" name="address"
|
||||
placeholder="Address (eg : 1234 Main St)" required
|
||||
value="<?= isset($details['address']) ? $details['address'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="city" class="col-form-label">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="city" name="city" placeholder="City" required value="<?= isset($details['city']) ? $details['city'] : '' ?>" />
|
||||
<label for="city" class="col-form-label">City<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="city" name="city" placeholder="City"
|
||||
required value="<?= isset($details['city']) ? $details['city'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="state" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="state" name="state" placeholder="State" required value="<?= isset($details['state']) ? $details['state'] : '' ?>" />
|
||||
<label for="state" class="col-form-label">State<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="state" name="state" placeholder="State"
|
||||
required value="<?= isset($details['state']) ? $details['state'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="postal_code" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="postal_code" name="postal_code" placeholder="Postal Code (PIN)" required value="<?= isset($details['postal_code']) ? $details['postal_code'] : '' ?>" />
|
||||
<label for="postal_code" class="col-form-label">Postal Code<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="postal_code" name="postal_code"
|
||||
placeholder="Postal Code (PIN)" required
|
||||
value="<?= isset($details['postal_code']) ? $details['postal_code'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($loggedin_person_role === 'sadmin'){ ?>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="postal_code" class="col-form-label">Buiness<span class="text-danger">*</span></label>
|
||||
<label for="postal_code" class="col-form-label">Buiness<span
|
||||
class="text-danger">*</span></label>
|
||||
<select id="business_id" name="business_id" class="form-control">
|
||||
<option value=null>Choose your Buiness</option>
|
||||
<?php foreach ($business_details as $value) { ?>
|
||||
<option value="<?php echo $value['business_id']; ?>" <?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>><?php echo $value['title']; ?></option>
|
||||
<option value="<?php echo $value['business_id']; ?>"
|
||||
<?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
||||
<?php echo $value['title']; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{ ?>
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= isset($details['business_id']) ? $details['business_id'] : '' ?>" />
|
||||
<input type="hidden" id="business_id" name="business_id"
|
||||
placeholder="hidden for business id"
|
||||
value="<?= isset($details['business_id']) ? $details['business_id'] : $session_bid ?>" />
|
||||
<?php } ?>
|
||||
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
|
||||
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id"
|
||||
value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
|
||||
<?php if (!empty($details)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($details) && $details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control"
|
||||
<?= isset($details) && $details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
@ -130,7 +179,8 @@
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
<a href="<?= base_url() . "user_list"; ?>" class="btn btn-secondary waves-effect">Cancel </a>
|
||||
<a href="<?= base_url() . "user_list"; ?>" class="btn btn-secondary waves-effect">Cancel
|
||||
</a>
|
||||
<!-- <button id="cancelButton" type="button" class="btn btn-secondary waves-effect">Cancel</button> -->
|
||||
</div>
|
||||
</div>
|
||||
@ -138,28 +188,4 @@
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<?php if (isset($details['profile_picture']) && $details['profile_picture']) { ?>
|
||||
<!-- Standard modal content -->
|
||||
<div id="standard-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="standard-modalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="standard-modalLabel">Modal Heading</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="col-md-12">
|
||||
<img src="<?= base_url()."writable/uploads/".$details['profile_picture'] ?>" class="img-fluid rounded" />
|
||||
<!-- /opt/lampp/htdocs/vb_book/writable/uploads/writable/uploads/".$details['profile_picture'] -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary"><i class="mdi mdi-cloud-upload mr-1"></i>Another Upload</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<?php } ?>
|
||||
</div><!-- end row -->
|
||||
|
||||
BIN
public/uploads/2023-06-17_14.png
Normal file
BIN
public/uploads/2023-06-17_14.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
BIN
public/uploads/2023-06-17_15.png
Normal file
BIN
public/uploads/2023-06-17_15.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
BIN
public/uploads/Screenshot 2023-07-14 160403.png
Normal file
BIN
public/uploads/Screenshot 2023-07-14 160403.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
BIN
public/uploads/Screenshot 2023-07-14 160403_1.png
Normal file
BIN
public/uploads/Screenshot 2023-07-14 160403_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
BIN
public/uploads/Screenshot 2023-07-20 120901.png
Normal file
BIN
public/uploads/Screenshot 2023-07-20 120901.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 366 KiB |
Loading…
Reference in New Issue
Block a user