Merge branch 'uat' of bitbucket.org:venbainformationtechnology/vb_book into uat
This commit is contained in:
commit
00f667ea7d
@ -41,14 +41,18 @@ $routes->get('dashboard/', 'Home::index');
|
||||
|
||||
# Users Routes
|
||||
$routes->get("user_list/", "Users::index");
|
||||
// $routes->get('user-list/', 'Users::index', ['as' => 'user_list']);
|
||||
$routes->get("user_page/(:any)", "Users::user_page/$1");
|
||||
$routes->post("user_synchronization", "Users::user_synchronization");
|
||||
|
||||
# Books Routes
|
||||
$routes->get("book_list/", "Books::index");
|
||||
$routes->get("add_book/", "Books::add_book");
|
||||
$routes->get("edit_book/", "Books::edit_book");
|
||||
$routes->get("book_page/(:any)", "Books::book_page/$1");
|
||||
$routes->post("book_synchronization", "Books::book_synchronization");
|
||||
|
||||
# Site-Setting Routes
|
||||
$routes->get("sitesetting_list/", "Settings::index");
|
||||
$routes->get("sitesetting_page/(:any)", "Settings::sitesetting_page/$1");
|
||||
$routes->post("sitesetting_synchronization", "Settings::sitesetting_synchronization");
|
||||
|
||||
# Business Routes
|
||||
$routes->get("business_list/", "Business::index");
|
||||
|
||||
@ -49,45 +49,50 @@ class Authentication extends BaseController
|
||||
if ($username === $user['email'] && $pwd_verify) {
|
||||
|
||||
// Redirect to a dashboard or other protected area
|
||||
$session = \Config\Services::session();
|
||||
$session->set('user_id', $user['user_id']);
|
||||
$session->set('user_name', $user['first_name'] . " " . $user['last_name']);
|
||||
$session->set('user_role', $user['role']);
|
||||
$session->set('business_id', $user['business_id']);
|
||||
|
||||
helper('session');
|
||||
set_logged_user_id($user['user_id']);
|
||||
set_logged_name($user['first_name'] . " " . $user['last_name']);
|
||||
set_user_role($user['role']);
|
||||
set_business_id($user['business_id']);
|
||||
return redirect()->to('dashboard');
|
||||
// $cookie = \Config\Services::cookie();
|
||||
// $cookie->setCookie('remember_username', 'Sri Harsha', 3600); // Cookie expires in 1 hour
|
||||
|
||||
return redirect()->to('dashboard');
|
||||
|
||||
} else {
|
||||
// Invalid credentials, display error message
|
||||
// return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
|
||||
}
|
||||
} else {
|
||||
// Validation failed, display errors
|
||||
// return redirect()->back()->withInput()->with('validation', $validation);
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function logout()
|
||||
{
|
||||
|
||||
// Clear session and cookies
|
||||
$session = \Config\Services::session();
|
||||
$session->remove('user_id');
|
||||
$session = session();
|
||||
|
||||
// Regenerate the session ID
|
||||
$session->regenerate();
|
||||
|
||||
// Clear session data and perform logout logic
|
||||
$session->destroy();
|
||||
|
||||
// $cookie = \Config\Services::cookie();
|
||||
// $remembered_username = $cookie->getCookie('remember_username');
|
||||
// $cookie->delete('remember_username');
|
||||
|
||||
// Redirect to a logout confirmation page or login page
|
||||
return redirect()->to('/login'); // Replace with your login route
|
||||
// return redirect()->to('/login'); // Replace with your login route
|
||||
$this->response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
||||
$this->response->setHeader('Pragma', 'no-cache');
|
||||
$this->response->setHeader('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
|
||||
|
||||
return redirect()->to('/login'); //
|
||||
}
|
||||
|
||||
public function lockscreen()
|
||||
|
||||
@ -56,33 +56,32 @@ abstract class BaseController extends Controller
|
||||
|
||||
// E.g.: $this->session = \Config\Services::session();
|
||||
}
|
||||
public function render_page($viewpage, $data){
|
||||
helper('session');
|
||||
|
||||
$session_uid = get_logged_user_id('user_id');
|
||||
$session_uname = get_logged_name('user_name');
|
||||
$session_role = get_user_role('user_role');
|
||||
if(!is_session_active()) {
|
||||
$route = base_url()."login";
|
||||
return redirect()->route($route);
|
||||
}
|
||||
|
||||
$auth_model = new AuthenticationModel();
|
||||
|
||||
public function render_page($viewpage, $data)
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
// print_r($session);die();
|
||||
$session_uid = $session->get('user_id');
|
||||
$session_uname = $session->get('user_name');
|
||||
$session_role = $session->get('user_role');
|
||||
|
||||
$auth_model = new AuthenticationModel();
|
||||
|
||||
$details = $auth_model->getheringDetailsForHeader($session_uid);
|
||||
$data['company_name'] = $details[0]['site_name'];
|
||||
$data['company_short_name'] = $details[0]['site_title'];
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = $details[0]['favicon'];
|
||||
$data['profile_picture'] = $details[0]['profile_picture'];
|
||||
$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);
|
||||
echo view('template/topbar.php', $data);
|
||||
echo view($viewpage, $data);
|
||||
echo view('template/footer.php', $data);
|
||||
|
||||
$details = $auth_model->getheringDetailsForHeader($session_uid);
|
||||
$data['company_name'] = $details[0]['site_name'];
|
||||
$data['company_short_name'] = $details[0]['site_title'];
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = $details[0]['favicon'];
|
||||
$data['profile_picture'] = $details[0]['profile_picture'];
|
||||
$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);
|
||||
echo view('template/topbar.php', $data);
|
||||
echo view($viewpage, $data);
|
||||
echo view('template/footer.php', $data);
|
||||
// $header = view('template/header.php', $data);
|
||||
// $topbar = view('template/topbar.php', $data);
|
||||
// $content = view($viewpage, $data);
|
||||
|
||||
@ -8,9 +8,11 @@ class Books extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session_role = $session->get('user_role');
|
||||
$session_bid = $session->get('business_id');
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role('user_role');
|
||||
$session_bid = get_business_id('business_id');
|
||||
|
||||
$where = ['books.isactive' => 1];
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$where = ['books.business_id' => $session_bid, 'books.isactive' => 1];
|
||||
@ -22,5 +24,52 @@ class Books extends BaseController
|
||||
$data['page_name'] = 'Book Details';
|
||||
$data['details'] = $book_details;
|
||||
$this->render_page('book_list', $data);
|
||||
} else {
|
||||
// Session is not active or user is not logged in
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
## To Load Book Add/Update page
|
||||
public function book_page($id)
|
||||
{
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Book';
|
||||
$data['details'] = [];
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Book';
|
||||
$model = new BooksModel();
|
||||
$model->setTable('books');
|
||||
$details = $model->where(['book_id' => $id, 'isactive' => 1])->first();
|
||||
$data['details'] = $details;
|
||||
}
|
||||
$this->render_page('book_form', $data);
|
||||
}
|
||||
|
||||
|
||||
## To Save/Update Book Data on DB.
|
||||
public function book_synchronization()
|
||||
{
|
||||
helper('session');
|
||||
$model = new BooksModel();
|
||||
$model->setTable('books');
|
||||
if ($this->request->is('post')) {
|
||||
$requestData = $this->request->getVar();
|
||||
}
|
||||
$requestData['business_id'] = get_business_id('business_id');
|
||||
if ($requestData['book_id']) {
|
||||
#edit
|
||||
$requestData['updated_by'] = get_logged_user_id();
|
||||
$requestData['isactive'] = isset($requestData['isactive']) && $requestData['isactive'] == 'on' ? 1 : 0;
|
||||
$model->saveData($requestData, $requestData['book_id']);
|
||||
$alert_message = "Book details successfully updated.";
|
||||
} else {
|
||||
#add
|
||||
$requestData['created_by'] = get_logged_user_id();
|
||||
$requestData['isactive'] = 1;
|
||||
$model->saveData($requestData, null);
|
||||
$alert_message = "Book details successfully created.";
|
||||
}
|
||||
return redirect()->route('book_list')->with('success', $alert_message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,9 @@ class Home extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data['page_name'] = 'Dashboard';
|
||||
$this->render_page('dashboard', $data);
|
||||
|
||||
$data['page_name'] = 'Dashboard';
|
||||
$this->render_page('dashboard', $data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
74
app/Controllers/Settings.php
Executable file
74
app/Controllers/Settings.php
Executable file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\SettingsModel;
|
||||
|
||||
class Settings extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
$session_role = get_user_role('user_role');
|
||||
$session_bid = get_business_id('business_id');
|
||||
|
||||
$where = ['settings.isactive' => 1];
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$where = ['settings.business_id' => $session_bid, 'settings.isactive' => 1];
|
||||
}
|
||||
|
||||
$model = new SettingsModel();
|
||||
$model->setTable('settings');
|
||||
$sitesetting_details = $model->where($where)->orderBy('setting_id', 'DESC')->findAll();
|
||||
$data['page_name'] = 'Site Settings Details';
|
||||
$data['details'] = $sitesetting_details;
|
||||
$data['session_role'] = $session_role;
|
||||
$this->render_page('setting_list', $data);
|
||||
}
|
||||
|
||||
## To Load Settings Add/Update page
|
||||
public function sitesetting_page($id)
|
||||
{
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Site Settings';
|
||||
$data['details'] = [];
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Site Settings';
|
||||
$model = new SettingsModel();
|
||||
$model->setTable('settings');
|
||||
$details = $model->where(['setting_id' => $id, 'isactive' => 1])->first();
|
||||
$data['details'] = $details;
|
||||
}
|
||||
$this->render_page('setting_form', $data);
|
||||
}
|
||||
|
||||
|
||||
## To Save/Update Setting Data on DB.
|
||||
public function sitesetting_synchronization()
|
||||
{
|
||||
helper('session');
|
||||
$session_bid = get_business_id('business_id');
|
||||
$session_uid = get_logged_user_id();
|
||||
|
||||
$model = new SettingsModel();
|
||||
$model->setTable('settings');
|
||||
if ($this->request->is('post')) {
|
||||
$requestData = $this->request->getVar();
|
||||
}
|
||||
$requestData['business_id'] = $session_bid;
|
||||
if ($requestData['setting_id']) {
|
||||
#edit
|
||||
$requestData['updated_by'] = $session_uid;
|
||||
$requestData['isactive'] = isset($requestData['isactive']) && $requestData['isactive'] == 'on' ? 1 : 0;
|
||||
$model->saveData($requestData, $requestData['setting_id']);
|
||||
$alert_message = "Site Settings details successfully updated.";
|
||||
} else {
|
||||
#add
|
||||
$requestData['created_by'] = $session_uid;
|
||||
$requestData['isactive'] = 1;
|
||||
$model->saveData($requestData, null);
|
||||
$alert_message = "Site Settings details successfully created.";
|
||||
}
|
||||
return redirect()->route('sitesetting_list');
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,10 @@ class Users extends BaseController
|
||||
## For User Listing
|
||||
public function index()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session_role = $session->get('user_role');
|
||||
$session_bid = $session->get('business_id');
|
||||
helper('session');
|
||||
|
||||
$session_role = get_user_role('user_role');
|
||||
$session_bid = get_business_id('business_id');
|
||||
|
||||
$where = ['users.isactive' => 1];
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
@ -38,23 +39,25 @@ class Users extends BaseController
|
||||
$edit_user_details = $model->where(['user_id' => $id, 'isactive' => 1])->first();
|
||||
$data['details'] = $edit_user_details;
|
||||
}
|
||||
$this->render_page('user', $data);
|
||||
$this->render_page('user_form', $data);
|
||||
}
|
||||
|
||||
|
||||
## To Save/Update User Data on DB.
|
||||
public function user_synchronization()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
helper('session');
|
||||
$session_bid = get_business_id('business_id');
|
||||
$session_uid = get_logged_user_id();
|
||||
$model = new UsersModel();
|
||||
$model->setTable('users');
|
||||
if ($this->request->is('post')) {
|
||||
$requestData = $this->request->getVar();
|
||||
}
|
||||
$requestData['business_id'] = $session->get('business_id');
|
||||
$requestData['business_id'] = $session_bid;
|
||||
if ($requestData['user_id']) {
|
||||
#edit
|
||||
$requestData['updated_by'] = $session->get('user_id');
|
||||
$requestData['updated_by'] = $session_uid;
|
||||
$requestData['isactive'] = isset($requestData['isactive']) && $requestData['isactive'] == 'on' ? 1 : 0;
|
||||
unset($requestData['password']);
|
||||
$model->saveData($requestData, $requestData['user_id']);
|
||||
@ -63,7 +66,7 @@ class Users extends BaseController
|
||||
#add
|
||||
$hash_password = password_hash($requestData['password'], PASSWORD_DEFAULT);
|
||||
$requestData['password'] = $hash_password;
|
||||
$requestData['created_by'] = $session->get('user_id');
|
||||
$requestData['created_by'] = $session_uid;
|
||||
$requestData['isactive'] = 1;
|
||||
$model->saveData($requestData, null);
|
||||
$alert_message = "User successfully created.";
|
||||
|
||||
90
app/Helpers/session_helper.php
Normal file
90
app/Helpers/session_helper.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
|
||||
if (!function_exists('is_session_active')) {
|
||||
function is_session_active()
|
||||
{
|
||||
//$session = \Config\Services::session();
|
||||
// echo "i am in helper ...".$session->get('user_id');die();
|
||||
return session()->get('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_logged_user_id')) {
|
||||
function get_logged_user_id()
|
||||
{
|
||||
return session('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_logged_user')) {
|
||||
function set_logged_user_id($userId)
|
||||
{
|
||||
session()->set('user_id', $userId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('unset_logged_user')) {
|
||||
function unset_logged_user()
|
||||
{
|
||||
session()->remove('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_logged_name')) {
|
||||
function get_logged_name()
|
||||
{
|
||||
return session('user_name');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_logged_name')) {
|
||||
function set_logged_name($userName)
|
||||
{
|
||||
session()->set('user_name', $userName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_logged_name')) {
|
||||
function get_logged_name()
|
||||
{
|
||||
return session('user_name');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_user_role')) {
|
||||
function set_user_role($userRole)
|
||||
{
|
||||
session()->set('user_role', $userRole);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_user_role')) {
|
||||
function get_user_role()
|
||||
{
|
||||
return session('user_role');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_business_id')) {
|
||||
function set_business_id($businessId)
|
||||
{
|
||||
session()->set('business_id', $businessId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_business_id')) {
|
||||
function get_business_id()
|
||||
{
|
||||
return session('business_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('is_session_destroy')) {
|
||||
function is_session_destroy()
|
||||
{
|
||||
session()->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -7,4 +7,15 @@ class BooksModel extends Model
|
||||
protected $primaryKey = 'book_id';
|
||||
protected $allowedFields = ['book_id','title','cover_picture','publication_date','publisher','genre','language','description','page_count','price','created_on','created_by','updated_on','updated_by','isactive','business_id'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
// Insert new record
|
||||
return $this->insert($data);
|
||||
} else {
|
||||
// Update existing record
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
22
app/Models/SettingsModel.php
Normal file
22
app/Models/SettingsModel.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class SettingsModel extends Model
|
||||
{
|
||||
protected $table = 'settings';
|
||||
protected $primaryKey = 'setting_id';
|
||||
protected $allowedFields = ['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','country','isactive','business_id'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
// Insert new record
|
||||
return $this->insert($data);
|
||||
} else {
|
||||
// Update existing record
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
82
app/Views/book_form.php
Normal file
82
app/Views/book_form.php
Normal file
@ -0,0 +1,82 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form action="<?= base_url()."book_synchronization"; ?>" method="post">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="title" class="col-form-label">Book Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="<?= isset($details['title']) ? $details['title'] : '' ?>" placeholder="Title" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publisher" class="col-form-label">Book Publisher Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Book Publisher (Authors)" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="language" class="col-form-label">Language<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="language" name="language" placeholder="Language" value="<?= isset($details['language']) ? $details['language'] : '' ?>" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="publication_date" class="col-form-label">Publication Date<span class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" id="publication_date" name="publication_date" placeholder="Publication Date (format : DD/MM/YYYY)" required data-toggle="input-mask" data-mask-format="00/00/0000" value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="genre" class="col-form-label">Genre</label>
|
||||
<input type="text" class="form-control" id="genre" name="genre" placeholder="Genre" value="<?= isset($details['genre']) ? $details['genre'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cover_picture" class="col-form-label">Book Cover Picture<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cover_picture" name="cover_picture" placeholder="Book Cover picture Name" required value="<?= isset($details['cover_picture']) ? $details['cover_picture'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description" class="col-form-label">Description<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="description" name="description" placeholder="Description" required value="<?= isset($details['description']) ? $details['description'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="price" class="col-form-label">Book Price<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="price" name="price" placeholder="Book Price" required value="<?= isset($details['price']) ? $details['price'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="page_count" class="col-form-label">Page Count<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="page_count" name="page_count" placeholder="Page Count" required value="<?= isset($details['page_count']) ? $details['page_count'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="book_id" name="book_id" placeholder="hidden for book id" value="<?= isset($details['book_id']) ? $details['book_id'] : '' ?>" />
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= isset($details['business_id']) ? $details['business_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' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
@ -2,9 +2,9 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="float-right">
|
||||
<a href="add_book" class="btn btn-primary"><i class="ri-book-3-line"></i> Add New </a>
|
||||
</div><!- end col -->
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url()."book_page/0"; ?>" class="btn btn-primary waves-effect"> <span> <i class="mdi mdi-book-plus"></i></span> Add New </a>
|
||||
</div>
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<div class="table-responsive">
|
||||
@ -23,6 +23,7 @@
|
||||
<th>Price of the Book</th>
|
||||
<th>Description</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -34,6 +35,7 @@
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
$edit_page_route = base_url()."book_page/".$row['book_id'];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $row['title'] ; ?></td>
|
||||
@ -46,6 +48,13 @@
|
||||
<td>
|
||||
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<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>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
139
app/Views/setting_form.php
Normal file
139
app/Views/setting_form.php
Normal file
@ -0,0 +1,139 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form action="<?= base_url()."sitesetting_synchronization"; ?>" method="post">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_name" class="col-form-label">Site Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="site_name" name="site_name" value="<?= isset($details['site_name']) ? $details['site_name'] : '' ?>" placeholder="Site Name" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_title" class="col-form-label">Site Title<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="site_title" name="site_title" placeholder="Site Title" value="<?= isset($details['site_title']) ? $details['site_title'] : '' ?>" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="terms_service" class="col-form-label">Terms Service<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="terms_service" name="terms_service" placeholder="Terms Service" value="<?= isset($details['terms_service']) ? $details['terms_service'] : '' ?>" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="footer_about" class="col-form-label">Footer about<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="footer_about" name="footer_about" placeholder="Footer about" value="<?= isset($details['footer_about']) ? $details['footer_about'] : '' ?>" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_info" class="col-form-label">Site Information<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="site_info" name="site_info" placeholder="Site Information" value="<?= isset($details['site_info']) ? $details['site_info'] : '' ?>" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="about_info" class="col-form-label">About Information<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="about_info" name="about_info" placeholder="About info" value="<?= isset($details['about_info']) ? $details['about_info'] : '' ?>" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="admin_email" class="col-form-label">Admin Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="admin_email" name="admin_email" placeholder="Admin Email" value="<?= isset($details['admin_email']) ? $details['admin_email'] : '' ?>" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile" class="col-form-label">Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile" name="mobile" placeholder="Mobile Number (Enter only numbers)" required data-parsley-type="number" value="<?= isset($details['mobile']) ? $details['mobile'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="copyright" class="col-form-label">Copyright</label>
|
||||
<input type="text" class="form-control" id="copyright" name="copyright" placeholder="Copy Right" value="<?= isset($details['copyright']) ? $details['copyright'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="pagination_limit" class="col-form-label">Pagination Limit<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pagination_limit" name="pagination_limit" placeholder="Pagination Limit" required value="<?= isset($details['pagination_limit']) ? $details['pagination_limit'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Favicon<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="favicon" name="favicon" placeholder="Fav-icon Name" required value="<?= isset($details['favicon']) ? $details['favicon'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="logo" class="col-form-label">logo name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="logo" name="logo" placeholder="Logo Name" required value="<?= isset($details['logo']) ? $details['logo'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="currency" class="col-form-label">Currency<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="currency" name="currency" placeholder="currency (eg : Rupees,Dollar,Euro)" required value="<?= isset($details['currency']) ? $details['currency'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="country" class="col-form-label">Country<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="country" name="country" placeholder="Country" required value="<?= isset($details['country']) ? $details['country'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_protocol" class="col-form-label">Mail Protocol<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_protocol" name="mail_protocol" placeholder="Mail Protocol (eg : zoho,gmail)" required value="<?= isset($details['mail_protocol']) ? $details['mail_protocol'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_title" class="col-form-label">Mail Title<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_title" name="mail_title" placeholder="Mail Title" required value="<?= isset($details['mail_title']) ? $details['mail_title'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mail_host" class="col-form-label">Mail Host<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_host" name="mail_host" placeholder="Mail Host" required value="<?= isset($details['mail_host']) ? $details['mail_host'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mail_port" class="col-form-label">Mail Port<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_port" name="mail_port" placeholder="Mail Port" required value="<?= isset($details['mail_port']) ? $details['mail_port'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mail_encryption" class="col-form-label">Mail Encryption<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_encryption" name="mail_encryption" placeholder="Mail Encryption" required value="<?= isset($details['mail_encryption']) ? $details['mail_encryption'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mail_username" class="col-form-label">Mail Username<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_username" name="mail_username" placeholder="Mail Username" required value="<?= isset($details['mail_username']) ? $details['mail_username'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mail_password" class="col-form-label">Mail Password<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mail_password" name="mail_password" placeholder="Mail Password" required value="<?= isset($details['mail_password']) ? $details['mail_password'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="setting_id" name="setting_id" placeholder="hidden for setting id" value="<?= isset($details['setting_id']) ? $details['setting_id'] : '' ?>" />
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= isset($details['business_id']) ? $details['business_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' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
63
app/Views/setting_list.php
Normal file
63
app/Views/setting_list.php
Normal file
@ -0,0 +1,63 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url()."sitesetting_page/0"; ?>" class="btn btn-primary"><i class="mdi mdi-playlist-plus"></i> Add New </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<?php if (session()->getFlashdata('success')): ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="table-responsive">
|
||||
<table id="datatable-buttons" class="table dt-responsive w-100">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Site Name</th>
|
||||
<th>Site Title</th>
|
||||
<th>Admin email</th>
|
||||
<th>Mobile Number</th>
|
||||
<th>Copyright</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($details as $row):
|
||||
if ($row['isactive']) {
|
||||
$class = 'badge badge-soft-success';
|
||||
$message = 'Active';
|
||||
} else {
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
$edit_page_route = base_url()."sitesetting_page/".$row['setting_id'];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $row['site_name'] ; ?></td>
|
||||
<td><?php echo $row['site_title'] ; ?></td>
|
||||
<td><?php echo $row['admin_email'] ; ?></td>
|
||||
<td><?php echo $row['mobile'] ; ?></td>
|
||||
<td><?php echo $row['copyright'] ; ?></td>
|
||||
<td>
|
||||
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<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>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
@ -130,6 +130,12 @@
|
||||
<span> Books </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."sitesetting_list"; ?>">
|
||||
<i class="ri-list-settings-line"></i>
|
||||
<span> Site Setting </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."business_list"; ?>">
|
||||
<i class="ri-briefcase-4-fill"></i>
|
||||
|
||||
@ -252,7 +252,7 @@
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
<!-- item-->
|
||||
<a href="logout" class="dropdown-item notify-item">
|
||||
<a href="<?= base_url()."logout"; ?>" class="dropdown-item notify-item">
|
||||
<i class="ri-logout-box-line"></i>
|
||||
<span>Logout</span>
|
||||
</a>
|
||||
|
||||
@ -51,7 +51,11 @@
|
||||
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php echo $edit_page_route; ?>" class="btn btn-xs btn-secondary"><i class="ri-pencil-line"></i></a>
|
||||
<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>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user