Merge branch 'uat' of bitbucket.org:venbainformationtechnology/vb_book into uat

This commit is contained in:
VE10-Sanjeev 2023-10-12 17:52:49 +05:30
commit d0e889162e
13 changed files with 144 additions and 68 deletions

View File

@ -79,15 +79,15 @@ abstract class BaseController extends Controller
$data['loggedin_person_role'] = $details[0]['role'];
$data['favicon'] = !empty($details[0]['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'] = !empty($details[0]['profile_picture']) && file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/uploads/avatar.png");
$data['profile_picture'] = !empty($details[0]['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['company_logo_small'] = !empty($details[0]['company_logo_small']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_small']) ? base_url("public/uploads/" . $details[0]['company_logo_small']) : base_url("public/uploads/default_logo.png");
$data['company_logo_large'] = !empty($details[0]['company_logo_large']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_large']) ? base_url("public/uploads/" . $details[0]['company_logo_large']) : base_url("public/uploads/default.png");
$data['browser_title'] = $data['company_name'] . ' | ' . $data['company_short_name'] . ' ' . $data['page_name'];
$data['heading'] = $data['page_name'] === "Dashboard" ? 'Welcome to ' . $data['company_name'] : "";
$data['loggedin_person'] = $session_uname;
$session_bid = get_business_id();
$data['bid'] = $session_bid;
$data['footer_about'] = $details[0]['footer_about'];
$data['bid'] = $session_bid;
echo view('template/header.php', $data);
echo view('template/topbar.php', $data);

View File

@ -23,7 +23,7 @@ class Customer extends BaseController
$CustomerModel = new CustomerModel();
$data['page_name'] = 'Customer Listing';
$data['customer'] = $CustomerModel->where($where)->findAll();
$data['customer'] = $CustomerModel->where($where)->orderBy('customer_id', 'DESC')->findAll();
// print_r($data); die();
@ -93,8 +93,7 @@ class Customer extends BaseController
'state' => $this->request->getPost('cstate'),
'postal_code' => $this->request->getPost('czip'),
'country' => $this->request->getPost('ccountry'),
'type' => $this->request->getPost('ctype'),
'date_of_birth' => $this->request->getPost('dob'),
'date_of_birth' => $this->request->getPost('dob'),
'gender' => $this->request->getPost('gen'),
'profile_picture' => $this->request->getPost('cfile'),
'mode' => $this->request->getPost('cmode'),

View File

@ -21,9 +21,10 @@ class Scheme extends BaseController
$where = ['isactive != ' => NULL];
}
$SchemeModel = new SchemeModel();
$data['page_name'] = 'Scheme Listing';
$data['scheme'] = $SchemeModel->where($where)->findAll();
$data['scheme'] = $SchemeModel->where($where)->orderBy('book_id', 'DESC')->findAll();
$this->render_page('scheme_list', $data);
} else {
@ -65,6 +66,7 @@ class Scheme extends BaseController
'description' => $this->request->getPost('sdescription'),
'price' => $this->request->getPost('sprice'),
'duration' => $this->request->getPost('sduration'),
'sku' => $this->request->getPost('sku'),
'business_id' => $this->request->getPost('business_id')
];
@ -73,10 +75,33 @@ class Scheme extends BaseController
if (empty($scheme_id)) {
// It's an insert operation
$data['isactive'] = 1;
$data['category'] = 2;
$data['created_by'] = $session_uid;
$SchemeModel->insert($data);
} else {
// $last_inserted_id = 100;
$last_inserted_id = $SchemeModel->insertID();
// Retrieve the category name 'membership'
$category_name = 'membership';
// Find the category ID for 'membership' from the category table
$db = db_connect();
$category = $db->table('category')
->select('id')
->where('name', $category_name)
->get()
->getRow();
// Check if the category exists
if ($category) {
// Insert data into book_categories table
$db->table('book_categories')->insert([
'book_id' => $last_inserted_id,
'category_id' => $category->id
]);
}
}
else {
// It's an update operation
$isactive = $this->request->getPost('isactive');
$data['isactive'] = ($isactive == 'on') ? 1 : 0;

View File

@ -10,7 +10,7 @@ class AuthenticationModel extends Model
public function getheringDetailsForHeader($user_id)
{
$builder = $this->db->table('users');
$builder->select('users.user_id,users.business_id,users.profile_picture,users.role,settings.site_name,settings.site_title,settings.favicon,settings.logo as company_logo_large,business.business_logo as company_logo_small,business.email as company_email,business.address as company_address,business.mobile_no as company_mobile_no,business.title,settings.footer_about');
$builder->select('users.user_id,users.business_id,users.profile_picture,users.role,settings.site_name,settings.site_title,settings.favicon,settings.logo as company_logo_large,business.business_logo as company_logo_small,business.email as company_email,business.address as company_address,business.mobile_no as company_mobile_no,business.title');
$builder->join('settings', 'settings.business_id = users.business_id', 'left');
$builder->join('business', 'business.business_id = users.business_id', 'left');
$builder->where('user_id', $user_id);

View File

@ -162,3 +162,4 @@ public function insertSubscriptionData($data)

View File

@ -9,7 +9,7 @@ class SchemeModel extends Model
{
protected $table = 'books';
protected $primaryKey = 'book_id';
protected $allowedFields = ['book_id ','title','description','price','features','duration','business_id','updated_by','category','isactive'];
protected $allowedFields = ['book_id ','title','sku','description','price','features','duration','business_id','updated_by','category','isactive'];
public function insertScheme($data)
{
@ -102,6 +102,23 @@ public function getAllSchemes()
{
return $this->findAll();
}
public function getCategoryName($book_id)
{
$builder = $this->builder();
$builder->select('category.name AS category_name');
$builder->join('book_categories', 'book_categories.book_id = books.book_id');
$builder->join('category', 'category.id = book_categories.category_id');
$builder->where('books.book_id', $book_id);
$query = $builder->get();
if ($query->getNumRows() === 1) {
$row = $query->getRow();
return $row->category_name;
} else {
return null;
}
}
}

View File

@ -17,7 +17,7 @@
href="#subscriptionDetails" role="tab" aria-controls="subscriptionDetails"
aria-selected="false">Subscription Details</a>
</li>
<li class="nav-item">
<li class="nav-item">
<a class="nav-link" id="invoiceDetails-tab" data-toggle="tab" href="#invoiceDetails"
role="tab" aria-controls="invoiceDetails" aria-selected="false">Invoice Details</a>
</li>
@ -75,8 +75,7 @@
</div>
</div>
<div class="form-group col-md-4">
<label for="dob" class="col-form-label">Date Of Birth<span
class="text-danger">*</span></label>
<label for="dob" class="col-form-label">Date Of Birth</label>
<input type="date" class="form-control" name="dob"
value="<?= isset($customer['date_of_birth']) ? $customer['date_of_birth'] : '' ?>"
placeholder="Date Of Birth" />
@ -94,15 +93,8 @@
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="ctype" class="col-form-label">Type<span class="text-danger">*</span></label>
<select class="form-control" name="ctype" required>
<option value="customer" <?= isset($customer['type']) && $customer['type'] == 'customer' ? 'selected' : '' ?>>Customer</option>
<option value="subscriber" <?= isset($customer['type']) && $customer['type'] == 'subscriber' ? 'selected' : '' ?>>Member</option>
</select>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="cmode" class="col-form-label">Mode<span class="text-danger">*</span></label>
<select class="form-control" name="cmode" required>
<option value="offline" <?= isset($customer['mode']) && $customer['mode'] == 'offline' ? 'selected' : '' ?>>Offline</option>

View File

@ -11,22 +11,23 @@
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>First Name</th>
<th>Last Name</th>
<th>Mobile Number</th>
<th>Email</th>
<th>Type</th>
<th>Mode</th>
<th>Action</th>
</tr>
</thead>
<?php foreach ($customer as $value) :?>
<tr>
<td hidden><?$value['customer_id'];?></td>
<td><?= $value['first_name']; ?></td>
<td><?= $value['last_name']; ?></td>
<td><?= $value['mobile_no']; ?></td>
<td><?= $value['email']; ?></td>
<td><?= $value['type']; ?></td>
<td><?= $value['mode']; ?></td>
<td>
<a href="<?= "new_customer/" . $value['customer_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
@ -42,4 +43,12 @@
</div><!-- end col-->
</div>
<!-- end row-->
<!-- end row-->
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>

View File

@ -55,9 +55,10 @@
<?php endif; ?>
<?php endif; ?>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<table id="scroll-horizontal-datatable_wrapper" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Invoice Number</th>
<th>Invoice Date</th>
<th>Customer Name</th>
@ -76,6 +77,7 @@
<tbody>
<?php foreach ($invoice as $row): ?>
<tr>
<td hidden><?= $row['invoice_id'] ?></td>
<td><?= $row['invoice_number']; ?></td>
<td><?= $row['invoice_date']; ?></td>
<td><?= $row['customer_name']; ?></td>
@ -133,6 +135,14 @@ $(document).ready(function() {
});
});
</script>
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>

View File

@ -26,6 +26,11 @@
<input type="text" class="form-control" name="sduration" value="<?= isset($scheme['duration']) ? $scheme['duration'] : '' ?>" placeholder="Duration (eg: 1 Month / 3 months / 1 Year ... )" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="sku" class="col-form-label">Sku ID<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="sku" value="<?= isset($scheme['sku']) ? $scheme['sku'] : '' ?>" placeholder="Duration (eg: 1 Month / 3 months / 1 Year ... )" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="sdescription" class="col-form-label">Description<span class="text-danger"></span></label>
@ -33,7 +38,7 @@
</div>
</div>
<input type="hidden" id="scheme_id" name="scheme_id" placeholder="hidden for scheme id" value="<?= isset($scheme['book_id']) ? $scheme['book_id'] : '' ?>" />
<input type="hidden" id="book_id" name="book_id" placeholder="hidden for scheme id" value="<?= isset($scheme['book_id']) ? $scheme['book_id'] : '' ?>" />
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
<?php if (!empty($scheme)) { ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple">

View File

@ -12,27 +12,40 @@
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Scheme Name</th>
<th>Price</th>
<th>Duration</th>
<th>Action</th>
</tr>
</thead>
<?php foreach ($scheme as $value) :?>
<tr>
<td><?= $value['title']; ?></td>
<td><?= $value['price']; ?></td>
<td><?= $value['duration']; ?></td>
<td>
<?php foreach ($scheme as $value) :?>
<tr>
<td hidden><? $value['book_id'];?></td>
<td><?= $value['title']; ?></td>
<td><?= $value['price']; ?></td>
<td><?= $value['duration']; ?></td>
<td>
<a href="<?= "new_scheme/" . $value['book_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
<a href="<?php echo "delete_scheme/" . $value['book_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div><!-- end row-->
</div><!-- end row-->
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>

View File

@ -9,19 +9,14 @@
<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 autofocus />
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-6">
<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>
<?php if (empty($details)) { ?>
<div class="form-group col-md-4">
<div class="form-group col-md-6">
<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 />
@ -34,8 +29,8 @@
<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-6">
<label for="last_name" class="col-form-label">Last Name<span class="text-danger">*</span></label>
<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 />
<label for="last_name" class="col-form-label">Last Name<span class="text-danger"></span></label>
<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'] : '' ?>" />
</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>
@ -47,21 +42,11 @@
<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="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus>
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
</div>
<!-- ... (other form elements) ... -->
<div class="form-group col-md-4">
<label for="gender" class="col-form-label">Gender<span class="text-danger">*</span></label>
<select id="gender" name="gender" class="form-control" required>
<option value="">Select Gender</option>
<option value="male" <?= isset($details['gender']) && $details['gender'] === 'male' ? 'selected' : '' ?>>Male</option>
<option value="female" <?= isset($details['gender']) && $details['gender'] === 'female' ? 'selected' : '' ?>>Female</option>
</select>
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-4">
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
<select id="role" name="role" class="form-control" required>
<option value="">Select Role</option>
@ -69,30 +54,40 @@
<option value="manager" <?= isset($details['role']) && $details['role'] === 'manager' ? 'selected' : '' ?>>Manager</option>
</select>
</div>
<div class="form-group col-md-4">
<label for="gender" class="col-form-label">Gender<span class="text-danger"></span></label>
<select id="gender" name="gender" class="form-control" >
<option value="">Select Gender</option>
<option value="male" <?= isset($details['gender']) && $details['gender'] === 'male' ? 'selected' : '' ?>>Male</option>
<option value="female" <?= isset($details['gender']) && $details['gender'] === 'female' ? 'selected' : '' ?>>Female</option>
</select>
</div>
</div>
<!-- ... (rest of the form) ... -->
<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'] : '' ?>" />
<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)" 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'] : '' ?>" />
<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" 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'] : '' ?>" />
<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" 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" />
<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)" 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">
@ -113,7 +108,7 @@
<?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>
<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) { ?>

View File

@ -31,6 +31,7 @@
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
@ -56,6 +57,7 @@
?>
<tr>
<td hidden><?= $row['user_id'] ?></td>
<td><?php echo $row['first_name'].' '.$row['last_name'] ; ?></td>
<td><?php echo $row['email'] ; ?></td>
<td><?php echo $row['role'] ; ?></td>
@ -79,4 +81,12 @@
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- end row-->
<!-- end row-->
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>