customer subscription tab
This commit is contained in:
parent
dc1aba9e3b
commit
eaf7692215
@ -38,6 +38,7 @@ class Customer extends BaseController
|
|||||||
{
|
{
|
||||||
helper('session');
|
helper('session');
|
||||||
$session_bid = get_business_id();
|
$session_bid = get_business_id();
|
||||||
|
|
||||||
if ($id === '0') {
|
if ($id === '0') {
|
||||||
// Add Customer
|
// Add Customer
|
||||||
$data['page_name'] = 'Add Customer';
|
$data['page_name'] = 'Add Customer';
|
||||||
@ -49,21 +50,26 @@ class Customer extends BaseController
|
|||||||
} else if ($id !== '0') {
|
} else if ($id !== '0') {
|
||||||
// Edit Customer
|
// Edit Customer
|
||||||
$data['page_name'] = 'Edit Customer';
|
$data['page_name'] = 'Edit Customer';
|
||||||
$subscriptionModel = new SubscriptionModel();
|
|
||||||
$subscriptionData = $subscriptionModel->getSubscriptionsByCustomerId($id);
|
// Load your Customer Model
|
||||||
$model = new CustomerModel();
|
$customerModel = new CustomerModel();
|
||||||
$model->setTable('customers');
|
|
||||||
$edit_user_details = $model->where(['customer_id' => $id])->first();
|
// Retrieve customer details by customer ID
|
||||||
|
$edit_user_details = $customerModel->where(['customer_id' => $id])->first();
|
||||||
$data['customer'] = $edit_user_details;
|
$data['customer'] = $edit_user_details;
|
||||||
$data['customer_billing'] = $this->get_customer_address($id, 1);
|
$data['customer_billing'] = $this->get_customer_address($id, 1);
|
||||||
$data['customer_shipping'] = $this->get_customer_address($id, 2);
|
$data['customer_shipping'] = $this->get_customer_address($id, 2);
|
||||||
$data['subscriptionData'] = $subscriptionData;
|
|
||||||
|
// Retrieve subscriber data based on the customer ID
|
||||||
|
$subscriberData = $customerModel->getSubscriberDataByCustomerId($id);
|
||||||
|
$data['subscriptionData'] = $subscriberData;
|
||||||
|
|
||||||
// Fetch invoice data for the customer
|
// Fetch invoice data for the customer
|
||||||
$CustomerModel = new CustomerModel();
|
$CustomerModel = new CustomerModel();
|
||||||
$invoices = $CustomerModel->getInvoicesByCustomerId($id);
|
$invoices = $CustomerModel->getInvoicesByCustomerId($id);
|
||||||
$data['invoices'] = $invoices;
|
$data['invoices'] = $invoices;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['session_bid'] = $session_bid;
|
$data['session_bid'] = $session_bid;
|
||||||
$this->render_page('customer_form', $data);
|
$this->render_page('customer_form', $data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,5 +98,22 @@ class CustomerModel extends Model
|
|||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
public function getSubscriberDataByCustomerId($customerId)
|
||||||
|
{
|
||||||
|
// Assuming 'subscription' is the table name where subscriber data is stored.
|
||||||
|
$builder = $this->db->table('subscription');
|
||||||
|
$builder->join('schemes', 'schemes.scheme_id = subscription.scheme_id');
|
||||||
|
|
||||||
|
|
||||||
|
// Define the columns you want to select from the subscription table.
|
||||||
|
$builder->select('sub_id, to_subscription, from_subscription,schemes.scheme_name');
|
||||||
|
|
||||||
|
// Add a where condition to filter results based on customer ID.
|
||||||
|
$builder->where('customer_id', $customerId);
|
||||||
|
|
||||||
|
// Execute the query and return the result as an array of objects.
|
||||||
|
return $builder->get()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -147,14 +147,7 @@ public function getAllCustomerDetailsBySchemeName($schemeName)
|
|||||||
|
|
||||||
return $customerDetails;
|
return $customerDetails;
|
||||||
}
|
}
|
||||||
public function getSubscriptionsByCustomerId($customerId)
|
|
||||||
{
|
|
||||||
$builder = $this->db->table('subscription');
|
|
||||||
$builder->select('schemes.scheme_name,from_subscription,to_subscription');
|
|
||||||
$builder->join('schemes', 'schemes.scheme_id = subscription.scheme_id');
|
|
||||||
// Query to retrieve subscription records for a specific customer
|
|
||||||
return $builder->get()->getResultArray();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -328,9 +328,9 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($subscriptionData as $subscription): ?>
|
<?php foreach ($subscriptionData as $subscription): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $subscription['scheme_name']; ?></td>
|
<td><?= $subscription->scheme_name ?></td>
|
||||||
<td><?= $subscription['from_subscription']; ?></td>
|
<td><?= $subscription->from_subscription ?></td>
|
||||||
<td><?= $subscription['to_subscription']; ?></td>
|
<td><?= $subscription->to_subscription ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -740,5 +740,22 @@ 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>
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
// Get the Due Date input element by its ID
|
||||||
|
const dueDateInput = document.getElementById("dueDate");
|
||||||
|
|
||||||
|
// Get the current date
|
||||||
|
const currentDate = new Date();
|
||||||
|
|
||||||
|
// Set the minimum date attribute to today's date (YYYY-MM-DD format)
|
||||||
|
const minDate = currentDate.toISOString().split("T")[0];
|
||||||
|
dueDateInput.setAttribute("min", minDate);
|
||||||
|
|
||||||
|
// Optional: Set the default value to today's date
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -272,7 +272,7 @@ if (count($invoiceDateParts) === 3) {
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="business-stamp">
|
<div class="business-stamp">
|
||||||
<img src="https://static.vecteezy.com/system/resources/thumbnails/004/853/320/small/book-read-library-study-line-icon-illustration-logo-template-suitable-for-many-purposes-free-vector.jpg" alt="Business Logo" class="business-logo">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="terms">
|
<div class="terms">
|
||||||
|
|||||||
@ -142,7 +142,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url()."book_list"; ?>">
|
<a href="<?= base_url()."book_list"; ?>">
|
||||||
<i class=" ri-book-open-line"></i>
|
<i class="ri-book-open-line"></i>
|
||||||
<span> Products </span>
|
<span> Products </span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user