changes made for combine scheme and books
This commit is contained in:
parent
eaf7692215
commit
cab7f5fb26
@ -119,6 +119,7 @@ class Books extends BaseController
|
|||||||
if (empty($book_id)) {
|
if (empty($book_id)) {
|
||||||
// It's an insert operation
|
// It's an insert operation
|
||||||
$data['isactive'] = 1;
|
$data['isactive'] = 1;
|
||||||
|
$data['category'] = 1;
|
||||||
$data['created_by'] = $session_uid;
|
$data['created_by'] = $session_uid;
|
||||||
$BooksModel->insert($data);
|
$BooksModel->insert($data);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -42,8 +42,8 @@ class Scheme extends BaseController
|
|||||||
} else if ($id !== '0') {
|
} else if ($id !== '0') {
|
||||||
$data['page_name'] = 'Edit Scheme';
|
$data['page_name'] = 'Edit Scheme';
|
||||||
$model = new SchemeModel();
|
$model = new SchemeModel();
|
||||||
$model->setTable('schemes');
|
$model->setTable('books');
|
||||||
$edit_user_details = $model->where(['scheme_id' => $id])->first();
|
$edit_user_details = $model->where(['book_id' => $id])->first();
|
||||||
|
|
||||||
$data['scheme'] = $edit_user_details;
|
$data['scheme'] = $edit_user_details;
|
||||||
}
|
}
|
||||||
@ -61,18 +61,19 @@ class Scheme extends BaseController
|
|||||||
|
|
||||||
$SchemeModel = new SchemeModel();
|
$SchemeModel = new SchemeModel();
|
||||||
$data = [
|
$data = [
|
||||||
'scheme_name' => $this->request->getPost('sname'),
|
'title' => $this->request->getPost('sname'),
|
||||||
'description' => $this->request->getPost('sdescription'),
|
'description' => $this->request->getPost('sdescription'),
|
||||||
'price' => $this->request->getPost('sprice'),
|
'price' => $this->request->getPost('sprice'),
|
||||||
'duration' => $this->request->getPost('sduration'),
|
'duration' => $this->request->getPost('sduration'),
|
||||||
'business_id' => $this->request->getPost('business_id')
|
'business_id' => $this->request->getPost('business_id')
|
||||||
|
|
||||||
];
|
];
|
||||||
$scheme_id = $this->request->getPost('scheme_id'); // Get the business ID for update
|
$scheme_id = $this->request->getPost('book_id'); // Get the business ID for update
|
||||||
|
|
||||||
if (empty($scheme_id)) {
|
if (empty($scheme_id)) {
|
||||||
// It's an insert operation
|
// It's an insert operation
|
||||||
$data['isactive'] = 1;
|
$data['isactive'] = 1;
|
||||||
|
$data['category'] = 2;
|
||||||
$data['created_by'] = $session_uid;
|
$data['created_by'] = $session_uid;
|
||||||
$SchemeModel->insert($data);
|
$SchemeModel->insert($data);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class BooksModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'books';
|
protected $table = 'books';
|
||||||
protected $primaryKey = 'book_id';
|
protected $primaryKey = 'book_id';
|
||||||
protected $allowedFields = ['book_id','title','cover_picture','publication_date','isbn_code','publisher','genre','language','description','page_count','tax','price','created_on','created_by','updated_on','updated_by','isactive','business_id'];
|
protected $allowedFields = ['book_id','title','cover_picture','publication_date','isbn_code','publisher','category','genre','language','description','page_count','tax','price','created_on','created_by','updated_on','updated_by','isactive','business_id'];
|
||||||
|
|
||||||
public function saveData($data, $id = null)
|
public function saveData($data, $id = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,9 +7,9 @@ use CodeIgniter\Model;
|
|||||||
|
|
||||||
class SchemeModel extends Model
|
class SchemeModel extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'schemes';
|
protected $table = 'books';
|
||||||
protected $primaryKey = 'scheme_id';
|
protected $primaryKey = 'book_id';
|
||||||
protected $allowedFields = ['scheme_id ','scheme_name','description','price','features','duration','business_id','updated_by','isactive'];
|
protected $allowedFields = ['book_id ','title','description','price','features','duration','business_id','updated_by','category','isactive'];
|
||||||
|
|
||||||
public function insertScheme($data)
|
public function insertScheme($data)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -96,6 +96,20 @@
|
|||||||
value="<?= isset($invoice_details['due_date']) ? $invoice_details['due_date'] : '' ?>">
|
value="<?= isset($invoice_details['due_date']) ? $invoice_details['due_date'] : '' ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="fromsubcription">From Subcription</label>
|
||||||
|
<input type="date" class="form-control" id="fromsubcription" name="from_subcription">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="tosubcription">To Subcription</label>
|
||||||
|
<input type="date" class="form-control" id="to_subcription" name="due_date"
|
||||||
|
value="<?= isset($invoice_details['due_date']) ? $invoice_details['due_date'] : '' ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<h4>Item Details</h4>
|
<h4>Item Details</h4>
|
||||||
@ -740,6 +754,7 @@ invoiceDateInput.setAttribute("min", minDate);
|
|||||||
// Optional: Set the default value to today's date
|
// Optional: Set the default value to today's date
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
// Get the Due Date input element by its ID
|
// Get the Due Date input element by its ID
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="sname" class="col-form-label">Scheme Name<span class="text-danger">*</span></label>
|
<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" value="<?= isset($scheme['scheme_name']) ? $scheme['scheme_name'] : '' ?>" placeholder=" Name" required />
|
<input type="text" class="form-control" id="sname" name="sname" value="<?= isset($scheme['title']) ? $scheme['title'] : '' ?>" placeholder=" Name" required />
|
||||||
<div class="invalid-feedback"> Please provide. </div>
|
<div class="invalid-feedback"> Please provide. </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
@ -29,11 +29,11 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="sdescription" class="col-form-label">Description<span class="text-danger"></span></label>
|
<label for="sdescription" class="col-form-label">Description<span class="text-danger"></span></label>
|
||||||
<textarea class="form-control" name="sdescription" placeholder="Description" ><?= isset($details['description']) ? $details['description'] : '' ?></textarea>
|
<textarea class="form-control" name="sdescription" placeholder="Description" ><?= isset($scheme['description']) ? $scheme['description'] : '' ?></textarea>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="scheme_id" name="scheme_id" placeholder="hidden for scheme id" value="<?= isset($scheme['scheme_id']) ? $scheme['scheme_id'] : '' ?>" />
|
<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="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
|
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
|
||||||
<?php if (!empty($scheme)) { ?>
|
<?php if (!empty($scheme)) { ?>
|
||||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||||
|
|||||||
@ -20,12 +20,12 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<?php foreach ($scheme as $value) :?>
|
<?php foreach ($scheme as $value) :?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $value['scheme_name']; ?></td>
|
<td><?= $value['title']; ?></td>
|
||||||
<td><?= $value['price']; ?></td>
|
<td><?= $value['price']; ?></td>
|
||||||
<td><?= $value['duration']; ?></td>
|
<td><?= $value['duration']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= "new_scheme/" . $value['scheme_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
<a href="<?= "new_scheme/" . $value['book_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||||
<a href="<?php echo "delete_scheme/" . $value['scheme_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
<a href="<?php echo "delete_scheme/" . $value['book_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user