heama
This commit is contained in:
parent
00f667ea7d
commit
7fd333ff73
@ -69,7 +69,10 @@ $routes->get("edit_subscribers/", "Home::edit_subscribers");
|
|||||||
$routes->get("customer_list/", "Customer::index");
|
$routes->get("customer_list/", "Customer::index");
|
||||||
$routes->get("new_customer/(:any)", "Customer::new_customer/$1");
|
$routes->get("new_customer/(:any)", "Customer::new_customer/$1");
|
||||||
$routes->post("insert_customer/", "Customer::insert_customer");
|
$routes->post("insert_customer/", "Customer::insert_customer");
|
||||||
|
#scheme routes
|
||||||
|
$routes->get("scheme_list/", "Scheme::index");
|
||||||
|
$routes->get("new_scheme/(:any)", "Scheme::new_scheme/$1");
|
||||||
|
$routes->post("insert_scheme/", "Scheme::insert_scheme");
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
* Additional Routing
|
* Additional Routing
|
||||||
|
|||||||
@ -89,6 +89,37 @@ class Business extends BaseController
|
|||||||
$this->index();
|
$this->index();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public function update_busieness($id)
|
||||||
|
{
|
||||||
|
// print_r($_FILES);die();
|
||||||
|
|
||||||
|
$filepath = WRITEPATH . 'uploads/' . $img->store();
|
||||||
|
|
||||||
|
$BusinessModel = new BusinessModel();
|
||||||
|
$data = [
|
||||||
|
'title' => $this->request->getPost('bname'),
|
||||||
|
'email' => $this->request->getPost('bmail'),
|
||||||
|
'mobile_no' => $this->request->getPost('bmobile'),
|
||||||
|
'address' => $this->request->getPost('baddress'),
|
||||||
|
'city' => $this->request->getPost('bcity'),
|
||||||
|
'state' => $this->request->getPost('bstate'),
|
||||||
|
'postal_code' => $this->request->getPost('bzip'),
|
||||||
|
'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();
|
$BusinessModel = new BusinessModel();
|
||||||
|
|||||||
60
app/Controllers/Scheme.php
Normal file
60
app/Controllers/Scheme.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\SchemeModel;
|
||||||
|
|
||||||
|
class Scheme extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
## For Business Listing
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$session = \Config\Services::session();
|
||||||
|
$session_role = $session->get('user_role');
|
||||||
|
$session_bid = $session->get('business_id');
|
||||||
|
$SchemeModel =new SchemeModel();
|
||||||
|
|
||||||
|
$data['page_name'] = 'Scheme Listing';
|
||||||
|
$data['scheme'] = $SchemeModel->findAll();
|
||||||
|
// print_r($data); die();
|
||||||
|
|
||||||
|
$this->render_page('scheme_list', $data);
|
||||||
|
}
|
||||||
|
public function new_scheme($id)
|
||||||
|
{
|
||||||
|
if ($id === '0') {
|
||||||
|
$data['page_name'] = 'Add Scheme';
|
||||||
|
$data['scheme'] = [];
|
||||||
|
} 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('scheme_form', $data);
|
||||||
|
}
|
||||||
|
public function insert_scheme()
|
||||||
|
{
|
||||||
|
|
||||||
|
$SchemeModel =new SchemeModel();
|
||||||
|
$data = [
|
||||||
|
'scheme_name' => $this->request->getPost('sname'),
|
||||||
|
'description' => $this->request->getPost('sdescription'),
|
||||||
|
'price' => $this->request->getPost('sprice'),
|
||||||
|
'duration' => $this->request->getPost('sduration')
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$SchemeModel->insert($data);
|
||||||
|
|
||||||
|
|
||||||
|
$this->index();
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Models/SchemeModel.php
Normal file
19
app/Models/SchemeModel.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class SchemeModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'schemes';
|
||||||
|
protected $primaryKey = 'scheme_id';
|
||||||
|
protected $allowedFields = ['scheme_id ','scheme_name','description','price','features','duration'];
|
||||||
|
|
||||||
|
public function insertScheme($data)
|
||||||
|
{
|
||||||
|
return $this->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
67
app/Views/scheme_form.php
Normal file
67
app/Views/scheme_form.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<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_scheme">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="sname" class="col-form-label">Scheme Name<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="sname" name="sname" placeholder=" Name" required />
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="sprice" class="col-form-label">Price<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="sprice" placeholder="" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="sduration" class="col-form-label">Duration<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" name="sduration" placeholder="" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="sdescription" class="col-form-label">Description<span class="text-danger">*</span></label>
|
||||||
|
<input type="number" class="form-control" name="sdescription" placeholder="" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<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>
|
||||||
53
app/Views/scheme_list.php
Normal file
53
app/Views/scheme_list.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="float-right">
|
||||||
|
<a href="new_scheme/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>Scheme Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>Duration</th>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<?php foreach ($scheme as $value):
|
||||||
|
// $edit_page_route = "new_bussiness/".$row['business_id'];
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<td><?= $value['scheme_name']; ?></td>
|
||||||
|
<td><?= $value['description']; ?></td>
|
||||||
|
<td><?= $value['price']; ?></td>
|
||||||
|
<td><?= $value['duration'] ; ?></td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end card body-->
|
||||||
|
</div> <!-- end card -->
|
||||||
|
</div><!-- end col-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- end row-->
|
||||||
@ -149,9 +149,9 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url()."subscription_list"; ?>">
|
<a href="<?= base_url()."scheme_list"; ?>">
|
||||||
<i class="ri-currency-line"></i>
|
<i class="ri-currency-line"></i>
|
||||||
<span> Subscription </span>
|
<span> Scheme </span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user