heama
This commit is contained in:
parent
8962ee5ad4
commit
4d3a4bab85
4
.env
4
.env
@ -30,7 +30,7 @@ CI_ENVIRONMENT = development
|
||||
# DATABASE
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
database.default.hostname = localhost
|
||||
database.default.hostname = 127.0.0.1
|
||||
database.default.database = bbbp_uat
|
||||
database.default.username = root
|
||||
database.default.password = ''
|
||||
@ -38,7 +38,7 @@ CI_ENVIRONMENT = development
|
||||
database.default.DBPrefix =
|
||||
database.default.port = 3306
|
||||
|
||||
database.tests.hostname = localhost
|
||||
database.tests.hostname = 127.0.0.1
|
||||
database.tests.database = BBVPB-local
|
||||
database.tests.username = root
|
||||
database.tests.password = ''
|
||||
|
||||
@ -61,8 +61,10 @@ $routes->get("subscribers_list/", "Home::subscribers_list");
|
||||
$routes->get("add_subscribers/", "Home::add_subscribers");
|
||||
$routes->get("edit_subscribers/", "Home::edit_subscribers");
|
||||
|
||||
|
||||
|
||||
#custome routes
|
||||
$routes->get("customer_list/", "Customer::index");
|
||||
$routes->get("new_customer/(:any)", "Customer::new_customer/$1");
|
||||
$routes->post("insert_customer/", "Customer::insert_customer");
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
|
||||
@ -76,14 +76,20 @@ class Business extends BaseController
|
||||
'business_logo'=>$this->request->getPost('bfile'),
|
||||
'isactive' => $this->request->getPost('bcheckbox') ? 1 : 0
|
||||
];
|
||||
|
||||
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
|
||||
|
||||
if (empty($business_id)) {
|
||||
// It's an insert operation
|
||||
$BusinessModel->insert($data);
|
||||
|
||||
} else {
|
||||
// It's an update operation
|
||||
$BusinessModel->update($business_id, $data);
|
||||
}
|
||||
|
||||
$this->index();
|
||||
}
|
||||
public function delete_business($id)
|
||||
}
|
||||
public function delete_business($id)
|
||||
{
|
||||
$BusinessModel = new BusinessModel();
|
||||
|
||||
@ -98,7 +104,8 @@ class Business extends BaseController
|
||||
$BusinessModel->delete($id);
|
||||
|
||||
// return redirect()->to(base_url('Business/index'))->with('success', 'Business deleted successfully.');
|
||||
return redirect()->route('business_list')->with('success', 'Business deleted successfully.');
|
||||
return redirect()->route('business_list');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
70
app/Controllers/Customer.php
Normal file
70
app/Controllers/Customer.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\CustomerModel;
|
||||
|
||||
class Customer extends BaseController
|
||||
{
|
||||
|
||||
## For Business Listing
|
||||
public function index()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session_role = $session->get('user_role');
|
||||
$session_bid = $session->get('business_id');
|
||||
$CustomerModel =new CustomerModel();
|
||||
|
||||
$data['page_name'] = 'Customer Listing';
|
||||
$data['customer'] = $CustomerModel->findAll();
|
||||
// print_r($data); die();
|
||||
|
||||
$this->render_page('customer_list', $data);
|
||||
}
|
||||
public function new_customer($id)
|
||||
{
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Customer';
|
||||
$data['customer'] = [];
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Customer';
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business');
|
||||
$edit_user_details = $model->where(['business_id ' => $id])->first();
|
||||
|
||||
$data['businesses'] = $edit_user_details;
|
||||
}
|
||||
|
||||
|
||||
$this->render_page('customer_form', $data);
|
||||
}
|
||||
public function insert_customer()
|
||||
{
|
||||
|
||||
$CustomerModel =new CustomerModel();
|
||||
$data = [
|
||||
'first_name' => $this->request->getPost('cfname'),
|
||||
'last_name' => $this->request->getPost('csname'),
|
||||
'mobile_no' => $this->request->getPost('cmobile'),
|
||||
'address' => $this->request->getPost('address'),
|
||||
'city' => $this->request->getPost('ccity'),
|
||||
'email' => $this->request->getPost('cmail'),
|
||||
'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'),
|
||||
'gender'=>$this->request->getPost('gen'),
|
||||
'profile_picture'=>$this->request->getPost('cfile'),
|
||||
'mode'=>$this->request->getPost('cmode'),
|
||||
'isactive' => $this->request->getPost('ccheckbox') ? 1 : 0
|
||||
];
|
||||
|
||||
|
||||
|
||||
$CustomerModel->insert($data);
|
||||
|
||||
|
||||
$this->index();
|
||||
}
|
||||
}
|
||||
19
app/Models/CustomerModel.php
Normal file
19
app/Models/CustomerModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
|
||||
class CustomerModel extends Model
|
||||
{
|
||||
protected $table = 'customers';
|
||||
protected $primaryKey = 'customer_id ';
|
||||
protected $allowedFields = ['customer_id ','first_name','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','type','isactive'];
|
||||
|
||||
public function insertCustomer($data)
|
||||
{
|
||||
return $this->insert($data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
131
app/Views/customer_form.php
Normal file
131
app/Views/customer_form.php
Normal file
@ -0,0 +1,131 @@
|
||||
<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>
|
||||
<form method="POST" enctype="multipart/form-data" action="<?php echo base_url(); ?>insert_customer">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cfname" class="col-form-label">First Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cfname" name="cfname" placeholder=" Name" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="csname" class="col-form-label">Last Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="csname" placeholder="" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cmail" class="col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="cmail" placeholder="" required />
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cmobile" class="col-form-label">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="cmobile" placeholder="" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="dob" class="col-form-label">D.O.B<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="dob" placeholder="" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="gen" class="col-form-label">Gender<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="gen" placeholder="" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cfile" class="col-form-label">File<span class="text-danger">*</span></label>
|
||||
|
||||
<input type="file" name="cfile"class="form-control" multiple />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="caddress" class="col-form-label">Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="address" placeholder="1234 Main St" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="ccountry" class="col-form-label">Country<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="ccountry" placeholder="country" required />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="ccity" class="col-form-label">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="ccity" placeholder="city" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cstate" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<select name="cstate" class="form-control" required >
|
||||
<option>Choose</option>
|
||||
<option> 1</option>
|
||||
<option> 2</option>
|
||||
<option> 3</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="czip" class="col-form-label">Zip<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="czip" placeholder="Zip" required />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="ctype" class="col-form-label">Type<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="ctype" placeholder="customer/subscriebr" required />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cmode" class="col-form-label">Mode<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="cmode" placeholder="Zip" required />
|
||||
</div>
|
||||
<?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>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<script src="../assets/js/vendor.min.js"></script>
|
||||
|
||||
<!-- Plugins js -->
|
||||
|
||||
|
||||
<!-- App js -->
|
||||
<script src="../assets/js/app.min.js"></script>
|
||||
64
app/Views/customer_list.php
Normal file
64
app/Views/customer_list.php
Normal file
@ -0,0 +1,64 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
|
||||
<div class="float-right">
|
||||
<a href="new_customer/0" class="btn btn-primary"><i class="ri-map-pin-user-fill"></i> Add New </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<div class="table-responsive">
|
||||
<!-- <table class="table table-borderless table-hover table-centered m-0"> -->
|
||||
<!-- <table id="alternative-page-datatable" class="table table-borderless table-hover table-centered m-0"> -->
|
||||
<!-- <table id="alternative-page-datatable" class="table dt-responsive nowrap w-100"> -->
|
||||
<!-- <table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100"> -->
|
||||
<table id="datatable-buttons" class="table dt-responsive w-100">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>Mobile Number</th>
|
||||
<th>Email</th>
|
||||
<th>Address</th>
|
||||
<th>Country</th>
|
||||
<th>State</th>
|
||||
<th>City</th>
|
||||
<th>Type</th>
|
||||
<th>Mode</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach ($customer as $value):
|
||||
// $edit_page_route = "new_bussiness/".$row['business_id'];
|
||||
?>
|
||||
<tr>
|
||||
|
||||
<td><?= $value['first_name']; ?></td>
|
||||
<td><?= $value['last_name']; ?></td>
|
||||
<td><?= $value['mobile_no']; ?></td>
|
||||
<td><?= $value['email'] ; ?></td>
|
||||
<td><?= $value['address']; ?></td>
|
||||
<td><?= $value['country']; ?></td>
|
||||
<td><?= $value['state']; ?></td>
|
||||
<td><?= $value['city']; ?></td>
|
||||
<td><?= $value['type']; ?></td>
|
||||
<td><?= $value['mode']; ?></td>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
|
||||
<!-- end row-->
|
||||
@ -132,26 +132,23 @@
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."business_list"; ?>">
|
||||
<i class="fa fa-industry"></i>
|
||||
<i class="ri-briefcase-4-fill"></i>
|
||||
<span> Business </span>
|
||||
</a>
|
||||
<li>
|
||||
<a href="#sidebarIcons" data-toggle="collapse">
|
||||
<i class="ri-shield-user-line"></i>
|
||||
<span> Customers </span>
|
||||
<span class="menu-arrow"></span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."customer_list"; ?>">
|
||||
<i class="ri-map-pin-user-fill"></i>
|
||||
<span> Customer </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarIcons">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="javascript:void(0);">Customers list</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0);">Subscribers</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."subscription_list"; ?>">
|
||||
<i class="ri-currency-line"></i>
|
||||
<span> Subscription </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user