bug fixes : ps
This commit is contained in:
parent
de10490b4e
commit
c1a0c5b1a9
@ -36,7 +36,7 @@ class Authentication extends BaseController
|
||||
$username = $this->request->getPost('username');
|
||||
$password = $this->request->getPost('password');
|
||||
|
||||
$user = $auth_model->where('email', $username)->first();
|
||||
$user = $auth_model->where(['email'=>$username,'isactive'=>1])->first();
|
||||
// $this->logger->info("Authenticate: Function Called.");
|
||||
|
||||
if (is_null($user)) {
|
||||
@ -260,12 +260,13 @@ class Authentication extends BaseController
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_uname = get_logged_name();
|
||||
$auth_model = new AuthenticationModel();
|
||||
|
||||
|
||||
|
||||
$details = $auth_model->getheringDetailsForHeader($session_uid);
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = file_exists(base_url()."public/uploads/".$details[0]['favicon']) ? base_url()."public/uploads/".$details[0]['favicon'] : base_url()."public/uploads/default.ico";
|
||||
$data['profile_picture'] = file_exists(base_url()."public/uploads/".$details[0]['profile_picture']) ? base_url()."public/uploads/".$details[0]['profile_picture'] : base_url()."public/assets/images/users/avatar-9.jpg";
|
||||
$data['favicon'] = file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico");
|
||||
$data['profile_picture'] = file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/assets/images/users/avatar-9.jpg");
|
||||
$successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
// Load and display the form view with the above data
|
||||
|
||||
@ -74,8 +74,8 @@ abstract class BaseController extends Controller
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_id'] = $session_uid;
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = file_exists(base_url()."public/uploads/".$details[0]['favicon']) ? base_url()."public/uploads/".$details[0]['favicon'] : base_url()."public/uploads/default.ico";
|
||||
$data['profile_picture'] = file_exists(base_url()."public/uploads/".$details[0]['profile_picture']) ? base_url()."public/uploads/".$details[0]['profile_picture'] : base_url()."public/assets/images/users/avatar-9.jpg";
|
||||
$data['favicon'] = file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico");
|
||||
$data['profile_picture'] = file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/assets/images/users/avatar-9.jpg");
|
||||
$data['browser_title'] = $data['company_name'] . ' | ' . $data['company_short_name'] . ' ' . $data['page_name'];
|
||||
$data['heading'] = $data['page_name'] == "Dashboard" ? 'Welcome to ' . $data['company_name'] : "";
|
||||
echo view('template/header.php', $data);
|
||||
|
||||
@ -12,17 +12,21 @@ class Users extends BaseController
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$this->logger->info("Users: Listing In admin role .");
|
||||
$where = ['users.business_id' => (int)$session_bid, 'users.isactive' => 1];
|
||||
} else {
|
||||
$this->logger->info("Users: Listing In Super-admin role .");
|
||||
$where = ['users.isactive !=' => NULL];
|
||||
}
|
||||
$model = new UsersModel();
|
||||
$model->setTable('users');
|
||||
$user_details = $model->where($where)->orderBy('user_id', 'DESC')->findAll();
|
||||
$this->logger->info("Users: Listing Count .".count($user_details));
|
||||
$data['page_name'] = 'User Details';
|
||||
$data['details'] = $user_details;
|
||||
$this->render_page('user_list', $data);
|
||||
@ -35,9 +39,11 @@ class Users extends BaseController
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Users: In Add page");
|
||||
$data['page_name'] = 'Add User';
|
||||
$data['details'] = [];
|
||||
} else if ($id !== '0') {
|
||||
$this->logger->info("Users: In Edit page");
|
||||
$data['page_name'] = 'Edit User';
|
||||
$model = new UsersModel();
|
||||
$model->setTable('users');
|
||||
@ -67,56 +73,81 @@ class Users extends BaseController
|
||||
## For inserting/updating details of user
|
||||
public function insert_users()
|
||||
{
|
||||
// print_r($this->request->getPost());die();
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
$this->logger->info("Users: Inserting/Updating Details");
|
||||
try {
|
||||
// print_r($_FILES);die();
|
||||
## CI validation rule for profile_picture
|
||||
$validationRule = [
|
||||
'userfile' => [
|
||||
'profile_picture' => [
|
||||
'label' => 'Image File',
|
||||
'rules' => [
|
||||
'uploaded[profile_picture]',
|
||||
'is_image[profile_picture]',
|
||||
'mime_in[profile_picture,image/jpg,image/jpeg,image/gif,image/png,image/webp]',
|
||||
|
||||
],
|
||||
],
|
||||
'rules' => 'uploaded[profile_picture]|is_image[profile_picture]|mime_in[profile_picture,image/jpg,image/jpeg,image/gif,image/png,image/webp]'
|
||||
]
|
||||
];
|
||||
|
||||
if (!$this->validate($validationRule) && $this->request->getPost('profile_picture') === '') {
|
||||
$error = $this->validator->getErrors();
|
||||
throw new \Exception((string)$error);
|
||||
}
|
||||
$img = $this->request->getFile('profile_picture');
|
||||
## Declarions
|
||||
helper('session');
|
||||
$UsersModel = new UsersModel();
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
$user_id = $this->request->getPost('user_id');
|
||||
$business_id = $this->request->getPost('business_id');
|
||||
$filePath = 'public/uploads/' . $this->request->getPost('profile_picture');
|
||||
|
||||
## File Already Existing or not
|
||||
if ($img->isValid() && !$img->hasMoved()) {
|
||||
$fileName = $img->getName();
|
||||
$img->move('public/uploads/', $fileName);
|
||||
|
||||
|
||||
// Delete the previous image file if it exists
|
||||
if ($user_id) {
|
||||
$previousFileName = $this->request->getPost('previous_ufile');
|
||||
if ($previousFileName && is_file('public/uploads/' . $previousFileName)) {
|
||||
link('public/uploads/'.$previousFileName,'');
|
||||
$business_id = $this->request->getPost('business_id')?$this->request->getPost('business_id'):$session_bid;
|
||||
$img_details = $this->request->getFile('profile_picture'); // Here I Have Image details ;
|
||||
$final_img_name = NULL;//Just flag
|
||||
$existing_img_name = $this->request->getPost('existing_profile_picture_name'); // HiddenField for if have any pic name means;
|
||||
$img_path = 'public/uploads/';
|
||||
|
||||
##Step 1 : image details available
|
||||
if($img_details){
|
||||
$this->logger->info("Users: image details avaiable");
|
||||
##Step 2 : i have image details .<br/>
|
||||
if ($img_details->isValid()) {
|
||||
##Step 3 : image Name.$new_img_name."<br/>";
|
||||
$new_img_name = $img_details->getName(); // before movement name
|
||||
$this->logger->info("Users: Image Name B4 Upload".$new_img_name);
|
||||
##Step 4 : Validation Rule Apply here.if not throw the error"<br/>";
|
||||
if (!$this->validate($validationRule)) {
|
||||
if($new_img_name !== ''){
|
||||
|
||||
$error = $this->validator->getErrors();
|
||||
// echo "Error : ".(string)$error."<br/>";
|
||||
$this->logger->error("Users: Err on image upload".$error['profile_picture']);
|
||||
throw new \Exception((string)$error['profile_picture']);
|
||||
}
|
||||
}
|
||||
##Step 5 : Check Existing and New Image Name Same Or not same no use to move on target folder
|
||||
if($new_img_name !== $existing_img_name){
|
||||
$this->logger->info("Users: Image Name are Differ".$new_img_name." & ".$existing_img_name);
|
||||
## Step 6 : Different Image Name means removed on target folder using Unlink;
|
||||
if ($existing_img_name && is_file($img_path.$existing_img_name)) {
|
||||
$this->logger->info("Users: already Image Available on target Folder Path : ".$img_path.$existing_img_name." So, Deleted.");
|
||||
// echo "Deleted_file : ".(string)$img_path.$existing_img_name."<br/>";
|
||||
unlink($img_path.$existing_img_name);
|
||||
}
|
||||
## Step 7 : Moved to target;
|
||||
$img_details->move($img_path, $new_img_name);
|
||||
$final_img_name = $img_details->getName(); // after movement name
|
||||
$this->logger->info("Users: Image Name After Upload".$final_img_name);
|
||||
}else{
|
||||
$final_img_name = $existing_img_name;
|
||||
$this->logger->info("Users: Image Name are same".$new_img_name." & ".$existing_img_name." Can't Upload");
|
||||
}
|
||||
}
|
||||
else{
|
||||
## Step 8 : Not a Vaild Image File so replace Existing file name;
|
||||
$final_img_name = $existing_img_name;
|
||||
$this->logger->info("Users: Not a Vaild Image File Nothing To Update/Upload");
|
||||
// throw new \Exception("Not a Vaild Image File");
|
||||
}
|
||||
} else {
|
||||
$fileName = $this->request->getPost('previous_ufile')?$this->request->getPost('previous_ufile'):""; // Use the previous filename if no new image is provided
|
||||
}
|
||||
else{
|
||||
## Step 9 : Testing Purpose File Details Not Available. so i can't move it.;
|
||||
$this->logger->info("Users: Testing Purpose Image Details Not Available. so i can't move it.");
|
||||
$final_img_name = $existing_img_name;
|
||||
//throw new \Exception("Testing Purpose File Details Not Available so i can't move it if you have existing filee means save it or your choice");
|
||||
}
|
||||
|
||||
|
||||
$UsersModel = new UsersModel();
|
||||
$data = [
|
||||
|
||||
'user_name' => $this->request->getPost('user_name'),
|
||||
'profile_picture' => $fileName,
|
||||
'profile_picture' => $final_img_name,
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'email' => $this->request->getPost('email'),
|
||||
@ -131,7 +162,6 @@ class Users extends BaseController
|
||||
'gender' => $this->request->getPost('gender'),
|
||||
'business_id' => $business_id
|
||||
];
|
||||
$user_id = $this->request->getPost('user_id'); // Get the business ID for update
|
||||
|
||||
if (empty($user_id)) {
|
||||
// It's an insert operation
|
||||
@ -141,19 +171,36 @@ class Users extends BaseController
|
||||
$data['password'] = $hash_password;
|
||||
$data['created_by'] = $session_uid;
|
||||
//print_r($data);die;
|
||||
($UsersModel->insert($data)) ? session()->setFlashdata('success', 'User has been added successfully.')
|
||||
: session()->setFlashdata('error', 'User could not be added. Please try again.');
|
||||
// ($UsersModel->insert($data)) ? session()->setFlashdata('success', 'User has been added successfully.')
|
||||
// : session()->setFlashdata('error', 'User could not be added. Please try again.');
|
||||
if ($UsersModel->insert($data)) {
|
||||
session()->setFlashdata('success', 'User has been added successfully.');
|
||||
$this->logger->info("Users: has been added successfully. Inserted ID = ".$UsersModel->insertID());
|
||||
} else {
|
||||
session()->setFlashdata('error', 'User could not be added. Please try again.');
|
||||
$this->logger->error("Users: Err could not be added. Please try again.");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// It's an update operation
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||
if($session_uid == $user_id && $data['isactive'] == 0){
|
||||
throw new \Exception("Cant able to Update Because logged-In persons can't remove. Please Contact your Admin!....");
|
||||
}
|
||||
$data['updated_by'] = $session_uid;
|
||||
// $UsersModel->update($user_id, $data);
|
||||
($UsersModel->update($user_id, $data)) ? session()->setFlashdata('success', 'User has been updated successfully.')
|
||||
: session()->setFlashdata('error', 'User update failed. Please try again.');
|
||||
|
||||
if ($UsersModel->update($user_id, $data)) {
|
||||
session()->setFlashdata('success', 'User has been updated successfully.');
|
||||
$this->logger->info("Users: has been updated successfully. Updated ID = ".$user_id);
|
||||
} else {
|
||||
session()->setFlashdata('error', 'User update failed. Please try again.');
|
||||
$this->logger->error("Users: Err Failed to update ID =".$user_id);
|
||||
}
|
||||
}
|
||||
}catch(\Exception $e) {
|
||||
$this->logger->error("Users: Err Occur =".$e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
|
||||
}
|
||||
return redirect()->route('user_list');
|
||||
@ -165,19 +212,37 @@ class Users extends BaseController
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
try {
|
||||
if($id == $session_uid){
|
||||
throw new \Exception("Your Logged-In, Can't able delete");
|
||||
}
|
||||
$model = new UsersModel();
|
||||
$existingBook = $model->find($id);
|
||||
if ($existingBook) {
|
||||
// $data=[];
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$existingUser = $model->where($where)->find($id);
|
||||
$this->logger->Info("Users: Going to Inactive ID = ".$id);
|
||||
|
||||
if ($existingUser) {
|
||||
$data['isactive'] = 0;
|
||||
$data['updated_by'] = $session_uid;
|
||||
($model->update($id, $data)) ? session()->setFlashdata('success', 'Deleted successfully.')
|
||||
: throw new \Exception("Data Not able to Deleted");
|
||||
if(!empty($existingUser['profile_picture']) && file_exists(FCPATH."public/uploads/".$existingUser['profile_picture'])){
|
||||
unlink('public/uploads/'.$existingUser['profile_picture']);
|
||||
$data['profile_picture'] = NULL;
|
||||
}
|
||||
|
||||
|
||||
if ($model->update($id, $data)) {
|
||||
session()->setFlashdata('success', 'Deleted successfully.');
|
||||
$this->logger->info("Users: has been Inactived successfully. Inactived ID = ".$id);
|
||||
} else {
|
||||
$this->logger->error("Users: Not able to Inactive ID =".$id);
|
||||
throw new \Exception("Data Not able to Deleted");
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw new \Exception("Data Not Available");
|
||||
$this->logger->error("Users: Does Not Exist To Inactive, ID = ".$id);
|
||||
throw new \Exception("User Already Deleted");
|
||||
}
|
||||
}catch(\Exception $e) {
|
||||
$this->logger->error("Users: Err Occur = ".$e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
|
||||
}
|
||||
return redirect()->route('user_list');
|
||||
|
||||
@ -11,7 +11,7 @@ class AuthenticationModel extends Model
|
||||
{
|
||||
$builder = $this->db->table('users');
|
||||
$builder->select('user_id,user_name,email,first_name,last_name,password,mobile_no,date_of_birth,address,gender,profile_picture,city,state,postal_code,users.country,role,setting_id,site_name,site_title,favicon,logo,terms_service,footer_about,admin_email,mobile,copyright,pagination_limit,site_info,about_info,mail_protocol,mail_title,mail_host,mail_port,mail_encryption,mail_username,mail_password,currency,settings.country');
|
||||
$builder->join('settings', 'settings.admin_email = users.email', 'left');
|
||||
$builder->join('settings', 'settings.business_id = users.business_id', 'left');
|
||||
$builder->where('user_id', $user_id);
|
||||
//$template_mapping_details['fk_entity_id'];
|
||||
$query = $builder->get();
|
||||
|
||||
@ -466,6 +466,9 @@
|
||||
<!-- Datatables init -->
|
||||
<script src="<?= base_url()."public/assets/js/pages/datatables.init.js" ?>"></script>
|
||||
|
||||
<script src="<?= base_url()."public/assets/libs/parsleyjs/parsley.min.js" ?>"></script>
|
||||
<script src="<?= base_url()."public/assets/js/pages/form-validation.init.js"?>"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url()."public/assets/js/app.min.js" ?>"></script>
|
||||
|
||||
@ -474,7 +477,6 @@
|
||||
|
||||
<!-- Init js -->
|
||||
<script src="<?= base_url()."public/assets/js/pages/form-summernote.init.js" ?>"></script>
|
||||
|
||||
<script>
|
||||
// Automatically close both success and error messages after 5 seconds (5000 milliseconds)
|
||||
setTimeout(function () {
|
||||
|
||||
@ -6,37 +6,36 @@
|
||||
<!-- <?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?> -->
|
||||
<form class="needs-validation" novalidate action="<?= base_url() . "insert_users"; ?>" method="post" enctype="multipart/form-data">
|
||||
<form class="parsley-examples" action="<?= base_url() . "insert_users"; ?>" 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 />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<input type="text" class="form-control" id="user_name" name="user_name" value="<?= isset($details['user_name']) ? $details['user_name'] : '' ?>" placeholder="User Name" required autofocus />
|
||||
|
||||
</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 />
|
||||
<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 />
|
||||
<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>
|
||||
<input data-parsley-type="alphanum" type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="<?= isset($details['first_name']) ? $details['first_name'] : '' ?>" required />
|
||||
</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>
|
||||
<input data-parsley-type="alphanum" type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name" value="<?= isset($details['last_name']) ? $details['last_name'] : '' ?>" required />
|
||||
</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>
|
||||
@ -48,8 +47,8 @@
|
||||
|
||||
<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>
|
||||
<input data-parsley-type="number" type="text" 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'] : '' ?>" pattern="[0-9]{10}" maxlength="10" autofocus />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
@ -58,71 +57,61 @@
|
||||
</div>
|
||||
<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'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<input type="text" class="form-control" id="role" name="role" placeholder="Role" required value="<?= isset($details['role']) ? $details['role'] : '' ?>" autofocus />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<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-group col-md-4">
|
||||
<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>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<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>
|
||||
|
||||
<input type="text" class="form-control" id="city" name="city" placeholder="City" required value="<?= isset($details['city']) ? $details['city'] : '' ?>" />
|
||||
</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'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<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>
|
||||
|
||||
|
||||
<?php if (!empty($details['profile_picture'])) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<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" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<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="text" class="form-control" id="state" name="state" placeholder="State" required value="<?= isset($details['state']) ? $details['state'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="postal_code" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="number" type="text" class="form-control" id="postal_code" name="postal_code" placeholder="Postal Code (PIN)" required value="<?= isset($details['postal_code']) ? $details['postal_code'] : '' ?>" pattern="[0-9]{6}" maxlength="6" />
|
||||
</div>
|
||||
<?php if (!empty($details['profile_picture'])) { ?>
|
||||
<div class="form-group col-md-4 mt-3">
|
||||
<div class="media">
|
||||
<img src="<?= base_url('public/uploads/' . $details['profile_picture']) ?>" alt="Business Logo" height="50" class="preview-image d-flex align-self-start rounded mr-2">
|
||||
<div class="media-body">
|
||||
<h5 class="mt-0">Existing Profile Picture</h5>
|
||||
<p class="mb-1"><?= $details['profile_picture']; ?></p>
|
||||
<input type="hidden" id="existing_profile_picture_name" name="existing_profile_picture_name" placeholder="hidden Field for profile picture name" readonly value="<?= $details['profile_picture']; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="profile_picture" class="col-form-label">Profile Picture</label>
|
||||
<input type="file" name="profile_picture" value="<?= isset($details['profile_picture']) ? $details['profile_picture'] : '' ?>" />
|
||||
</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>
|
||||
<select id="business_id" name="business_id" class="form-control">
|
||||
<option value=null>Choose your Buiness</option>
|
||||
<?php if ($loggedin_person_role === 'sadmin') { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="business_id" class="col-form-label">Buiness<span class="text-danger">*</span></label>
|
||||
<select id="business_id" name="business_id" class="form-control" required>
|
||||
<option value="">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>
|
||||
<?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'] : $session_bid ?>" />
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<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">
|
||||
@ -140,8 +129,7 @@
|
||||
</button>
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add New </a>
|
||||
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
|
||||
0
public/uploads/default.ico
Normal file → Executable file
0
public/uploads/default.ico
Normal file → Executable file
|
Before Width: | Height: | Size: 383 KiB After Width: | Height: | Size: 383 KiB |
0
public/uploads/default.png
Normal file → Executable file
0
public/uploads/default.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
public/uploads/default_logo.png
Normal file → Executable file
0
public/uploads/default_logo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
Loading…
Reference in New Issue
Block a user