user,customer

This commit is contained in:
heama 2023-10-12 16:49:28 +05:30
parent 7e4572b40f
commit ee5d4797fd
11 changed files with 109 additions and 62 deletions

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();
@ -92,8 +92,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 {

View File

@ -5,12 +5,12 @@ class AuthenticationModel extends Model
{
protected $table = 'users';
protected $primaryKey = 'user_id';
protected $allowedFields = ['user_id','user_name','email','first_name','last_name','password','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id','reset_link'];
protected $allowedFields = ['user_id','email','first_name','last_name','password','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id','reset_link'];
public function getheringDetailsForHeader($user_id)
{
$builder = $this->db->table('users');
$builder->select('users.user_id,users.user_name,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->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

@ -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

@ -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>