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)) {
|
||||
// It's an insert operation
|
||||
$data['isactive'] = 1;
|
||||
$data['category'] = 1;
|
||||
$data['created_by'] = $session_uid;
|
||||
$BooksModel->insert($data);
|
||||
} else {
|
||||
|
||||
@ -42,8 +42,8 @@ class Scheme extends BaseController
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Scheme';
|
||||
$model = new SchemeModel();
|
||||
$model->setTable('schemes');
|
||||
$edit_user_details = $model->where(['scheme_id' => $id])->first();
|
||||
$model->setTable('books');
|
||||
$edit_user_details = $model->where(['book_id' => $id])->first();
|
||||
|
||||
$data['scheme'] = $edit_user_details;
|
||||
}
|
||||
@ -61,18 +61,19 @@ class Scheme extends BaseController
|
||||
|
||||
$SchemeModel = new SchemeModel();
|
||||
$data = [
|
||||
'scheme_name' => $this->request->getPost('sname'),
|
||||
'title' => $this->request->getPost('sname'),
|
||||
'description' => $this->request->getPost('sdescription'),
|
||||
'price' => $this->request->getPost('sprice'),
|
||||
'duration' => $this->request->getPost('sduration'),
|
||||
'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)) {
|
||||
// It's an insert operation
|
||||
$data['isactive'] = 1;
|
||||
$data['category'] = 2;
|
||||
$data['created_by'] = $session_uid;
|
||||
$SchemeModel->insert($data);
|
||||
} else {
|
||||
|
||||
@ -5,7 +5,7 @@ class BooksModel extends Model
|
||||
{
|
||||
protected $table = 'books';
|
||||
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)
|
||||
{
|
||||
|
||||
@ -7,9 +7,9 @@ use CodeIgniter\Model;
|
||||
|
||||
class SchemeModel extends Model
|
||||
{
|
||||
protected $table = 'schemes';
|
||||
protected $primaryKey = 'scheme_id';
|
||||
protected $allowedFields = ['scheme_id ','scheme_name','description','price','features','duration','business_id','updated_by','isactive'];
|
||||
protected $table = 'books';
|
||||
protected $primaryKey = 'book_id';
|
||||
protected $allowedFields = ['book_id ','title','description','price','features','duration','business_id','updated_by','category','isactive'];
|
||||
|
||||
public function insertScheme($data)
|
||||
{
|
||||
|
||||
@ -96,6 +96,20 @@
|
||||
value="<?= isset($invoice_details['due_date']) ? $invoice_details['due_date'] : '' ?>">
|
||||
</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-group col-md-12">
|
||||
<h4>Item Details</h4>
|
||||
@ -108,7 +122,7 @@
|
||||
<th>Rate</th>
|
||||
<th>Tax</th>
|
||||
<th>Amount </th>
|
||||
<th class="discount-header" colspan="2">Discount</th>
|
||||
<th class="discount-header" colspan="2">Discount</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -740,6 +754,7 @@ invoiceDateInput.setAttribute("min", minDate);
|
||||
// Optional: Set the default value to today's date
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// Get the Due Date input element by its ID
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
<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" 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>
|
||||
<div class="form-group col-md-6">
|
||||
@ -29,11 +29,11 @@
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<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>
|
||||
<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 ?>" />
|
||||
<?php if (!empty($scheme)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
|
||||
@ -20,12 +20,12 @@
|
||||
</thead>
|
||||
<?php foreach ($scheme as $value) :?>
|
||||
<tr>
|
||||
<td><?= $value['scheme_name']; ?></td>
|
||||
<td><?= $value['title']; ?></td>
|
||||
<td><?= $value['price']; ?></td>
|
||||
<td><?= $value['duration']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "new_scheme/" . $value['scheme_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="<?= "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; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user