Issues fixes : ps
This commit is contained in:
parent
82a0d46057
commit
591071ec5d
@ -22,7 +22,7 @@ class ApiIntegration extends ResourceController
|
|||||||
$this->global_variable_role = "Online";
|
$this->global_variable_role = "Online";
|
||||||
$api_model = new ApiIntegrationModel();
|
$api_model = new ApiIntegrationModel();
|
||||||
$table = 'users';
|
$table = 'users';
|
||||||
$where = ['role'=>$this->global_variable_role,'business_id'=>(int)$this->global_variable_business_id];
|
$where = ['LOWER(role)'=>strtolower($this->global_variable_role),'business_id'=>(int)$this->global_variable_business_id];
|
||||||
$existing_data = $api_model->getData($table, $where);
|
$existing_data = $api_model->getData($table, $where);
|
||||||
$this->global_variable_user_id = isset($existing_data[0]->user_id) ? (int)$existing_data[0]->user_id : NULL;
|
$this->global_variable_user_id = isset($existing_data[0]->user_id) ? (int)$existing_data[0]->user_id : NULL;
|
||||||
$this->global_variable_user_name = isset($existing_data[0]->user_id) ? $existing_data[0]->first_name." ".$existing_data[0]->last_name : NULL;
|
$this->global_variable_user_name = isset($existing_data[0]->user_id) ? $existing_data[0]->first_name." ".$existing_data[0]->last_name : NULL;
|
||||||
@ -385,7 +385,7 @@ class ApiIntegration extends ResourceController
|
|||||||
$this->logger->info("Api SaveBookDetails : total master categories count = ".count($master_categories));
|
$this->logger->info("Api SaveBookDetails : total master categories count = ".count($master_categories));
|
||||||
$where = ['book_id' => (int)$last_insert_book_id, 'isactive' => 1 ];
|
$where = ['book_id' => (int)$last_insert_book_id, 'isactive' => 1 ];
|
||||||
$existing_categories = $api_model->getData('book_categories', $where);
|
$existing_categories = $api_model->getData('book_categories', $where);
|
||||||
$this->logger->info("Api SaveBookDetails : existing categories count = ".count($existing_categories));
|
$this->logger->info("Api SaveBookDetails : existing book categories count = ".count($existing_categories)." Book_id = ".$last_insert_book_id);
|
||||||
$request_categories = (array)$categories;
|
$request_categories = (array)$categories;
|
||||||
$filtering_existing_categories_wpApiId = [];
|
$filtering_existing_categories_wpApiId = [];
|
||||||
$filtering_requested_categories_wpApiId = [];
|
$filtering_requested_categories_wpApiId = [];
|
||||||
|
|||||||
@ -14,14 +14,14 @@ class Business extends BaseController
|
|||||||
if (is_session_active()) {
|
if (is_session_active()) {
|
||||||
$session_role = get_user_role();
|
$session_role = get_user_role();
|
||||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||||
$this->logger->info("Buiness: Listing In admin role .");
|
$this->logger->info("Business: Listing In admin role .");
|
||||||
$where = ['business_id' => (int)get_business_id(), 'isactive' => 1];
|
$where = ['business_id' => (int)get_business_id(), 'isactive' => 1];
|
||||||
} else {
|
} else {
|
||||||
$this->logger->info("Buiness: Listing In Super-admin role .");
|
$this->logger->info("Business: Listing In Super-admin role .");
|
||||||
$where = ['isactive !=' => NULL];
|
$where = ['isactive !=' => NULL];
|
||||||
}
|
}
|
||||||
$BusinessModel = new BusinessModel();
|
$BusinessModel = new BusinessModel();
|
||||||
$data['page_name'] = 'Buiness Details';
|
$data['page_name'] = 'Business Details';
|
||||||
$data['businesses'] = $BusinessModel->where($where)->findAll();
|
$data['businesses'] = $BusinessModel->where($where)->findAll();
|
||||||
// $data['lastQuery'] = $BusinessModel->getLastQuery();
|
// $data['lastQuery'] = $BusinessModel->getLastQuery();
|
||||||
// print_r($data);die;
|
// print_r($data);die;
|
||||||
@ -56,42 +56,73 @@ class Business extends BaseController
|
|||||||
helper('session');
|
helper('session');
|
||||||
$session_uid = get_logged_user_id();
|
$session_uid = get_logged_user_id();
|
||||||
$session_role = get_user_role();
|
$session_role = get_user_role();
|
||||||
$validationRule = [
|
|
||||||
'user' => [
|
|
||||||
'label' => 'Image File',
|
|
||||||
'rules' => [
|
|
||||||
'uploaded[bfile]',
|
|
||||||
'is_image[bfile]',
|
|
||||||
'mime_in[bfile,image/jpg,image/jpeg,image/gif,image/png,image/webp]',
|
|
||||||
|
|
||||||
],
|
## CI validation rule for bfile
|
||||||
],
|
$validationRule = [
|
||||||
|
'bfile' => [
|
||||||
|
'label' => 'Image File',
|
||||||
|
'rules' => 'uploaded[bfile]|is_image[bfile]|mime_in[bfile,image/jpg,image/jpeg,image/gif,image/png,image/webp]'
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$this->validate($validationRule) && $this->request->getPost('bfile') === '') {
|
|
||||||
$data = ['errors' => $this->validator->getErrors()];
|
|
||||||
print_r($data);
|
|
||||||
return 'hello';
|
|
||||||
}
|
|
||||||
$img = $this->request->getFile('bfile');
|
$img = $this->request->getFile('bfile');
|
||||||
$business_id = $this->request->getPost('business_id');
|
$business_id = $this->request->getPost('business_id');
|
||||||
$filePath = 'public/uploads/' . $this->request->getPost('bfile');
|
|
||||||
|
$img_details = $this->request->getFile('bfile'); // Here I Have Image details ;
|
||||||
|
$final_img_name = NULL;//Just flag
|
||||||
|
$existing_img_name = $this->request->getPost('existing_business_logo_name'); // HiddenField for if have any pic name means;
|
||||||
|
$img_path = 'public/uploads/';
|
||||||
|
|
||||||
## File Already Existing or not
|
## File Already Existing or not
|
||||||
if ($img->isValid() && !$img->hasMoved()) {
|
##Step 1 : image details available
|
||||||
$fileName = $img->getName();
|
if($img_details){
|
||||||
$img->move('public/uploads/', $fileName);
|
$this->logger->info("Business: image details avaiable");
|
||||||
|
##Step 2 : i have image details .<br/>
|
||||||
|
if ($img_details->isValid()) {
|
||||||
// Delete the previous image file if it exists
|
##Step 3 : image Name.$new_img_name."<br/>";
|
||||||
if ($business_id) {
|
$new_img_name = $img_details->getName(); // before movement name
|
||||||
$previousFileName = $this->request->getPost('previous_bfile');
|
$this->logger->info("Business: Image Name B4 Upload".$new_img_name);
|
||||||
if ($previousFileName && is_file('public/uploads/' . $previousFileName)) {
|
##Step 4 : Validation Rule Apply here.if not throw the error"<br/>";
|
||||||
link('public/uploads/' . $previousFileName);
|
if (!$this->validate($validationRule)) {
|
||||||
|
if($new_img_name !== ''){
|
||||||
|
|
||||||
|
$error = $this->validator->getErrors();
|
||||||
|
// echo "Error : ".(string)$error."<br/>";
|
||||||
|
$this->logger->error("Business: Err on image upload".$error['bfile']);
|
||||||
|
throw new \Exception((string)$error['bfile']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
##Step 5 : Check Existing and New Image Name Same Or not same no use to move on target folder
|
||||||
|
if($new_img_name !== $existing_img_name){
|
||||||
|
$this->logger->info("Business: Image Name are Differ".$new_img_name." & ".$existing_img_name);
|
||||||
|
## Step 6 : Different Image Name means removed on target folder using Unlink;
|
||||||
|
if ($existing_img_name && is_file($img_path.$existing_img_name)) {
|
||||||
|
$this->logger->info("Business: already Image Available on target Folder Path : ".$img_path.$existing_img_name." So, Deleted.");
|
||||||
|
// echo "Deleted_file : ".(string)$img_path.$existing_img_name."<br/>";
|
||||||
|
unlink($img_path.$existing_img_name);
|
||||||
|
}
|
||||||
|
## Step 7 : Moved to target;
|
||||||
|
$img_details->move($img_path, $new_img_name);
|
||||||
|
$final_img_name = $img_details->getName(); // after movement name
|
||||||
|
$this->logger->info("Business: Image Name After Upload".$final_img_name);
|
||||||
|
}else{
|
||||||
|
$final_img_name = $existing_img_name;
|
||||||
|
$this->logger->info("Business: Image Name are same".$new_img_name." & ".$existing_img_name." Can't Upload");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
## Step 8 : Not a Vaild Image File so replace Existing file name;
|
||||||
|
$final_img_name = $existing_img_name;
|
||||||
|
$this->logger->info("Business: Not a Vaild Image File Nothing To Update/Upload");
|
||||||
|
// throw new \Exception("Not a Vaild Image File");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
$fileName = $this->request->getPost('previous_bfile', ''); // Use the previous filename if no new image is provided
|
else{
|
||||||
|
## Step 9 : Testing Purpose File Details Not Available. so i can't move it.;
|
||||||
|
$this->logger->info("Business: Testing Purpose Image Details Not Available. so i can't move it.");
|
||||||
|
$final_img_name = $existing_img_name;
|
||||||
|
//throw new \Exception("Testing Purpose File Details Not Available so i can't move it if you have existing filee means save it or your choice");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +136,7 @@ class Business extends BaseController
|
|||||||
'state' => $this->request->getPost('bstate'),
|
'state' => $this->request->getPost('bstate'),
|
||||||
'postal_code' => $this->request->getPost('bzip'),
|
'postal_code' => $this->request->getPost('bzip'),
|
||||||
'terms'=>$this->request->getPost('bterms'),
|
'terms'=>$this->request->getPost('bterms'),
|
||||||
'business_logo' => $fileName
|
'business_logo' => $final_img_name
|
||||||
];
|
];
|
||||||
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
|
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
|
||||||
|
|
||||||
|
|||||||
@ -222,7 +222,10 @@ class Notifications extends BaseController
|
|||||||
{
|
{
|
||||||
$model = new NotificationModel();
|
$model = new NotificationModel();
|
||||||
$model->setTable('templates');
|
$model->setTable('templates');
|
||||||
$details = $model->where(['isactive' => 1,'template_name not like "%EXPIRAY_NOTIFY_TEMPLATE%"'])->orderBy('template_id', 'ASC')->findAll();
|
$details = $model
|
||||||
|
->where(['templates.isactive' => 1])
|
||||||
|
->whereNotIn('templates.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
|
||||||
|
->orderBy('templates.template_id', 'ASC')->findAll();
|
||||||
return $details;
|
return $details;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,6 @@ class Users extends BaseController
|
|||||||
}
|
}
|
||||||
$data['details'] = $edit_user_details;
|
$data['details'] = $edit_user_details;
|
||||||
}
|
}
|
||||||
echo count($data['details']);die;
|
|
||||||
$data['business_details'] = $business_details;
|
$data['business_details'] = $business_details;
|
||||||
$data['session_bid'] = $session_bid;
|
$data['session_bid'] = $session_bid;
|
||||||
$data['session_role'] = $session_role;
|
$data['session_role'] = $session_role;
|
||||||
|
|||||||
@ -47,24 +47,17 @@ public function updateData($table, $data, $where)
|
|||||||
public function getSubscriptionInvoiceDetail($where)
|
public function getSubscriptionInvoiceDetail($where)
|
||||||
{
|
{
|
||||||
$result = $this->getJoinedData($where);
|
$result = $this->getJoinedData($where);
|
||||||
// print_r($result);die;
|
|
||||||
if(!empty($result)){
|
if(!empty($result)){
|
||||||
foreach ($result as $i => $item) {
|
foreach ($result as $i => $item) {
|
||||||
$invoiceId = $item['invoice_id'];
|
$invoiceId = $item['invoice_id'];
|
||||||
$scheme_name = [];
|
$scheme_name = [];
|
||||||
$from_subscription = [];
|
|
||||||
$to_subscription = [];
|
|
||||||
$invoiceItems = $this->getInvoiceItems($invoiceId,'');
|
$invoiceItems = $this->getInvoiceItems($invoiceId,'');
|
||||||
foreach ($invoiceItems as $j => $child) {
|
foreach ($invoiceItems as $j => $child) {
|
||||||
if ($child->category_name == 'Membership') {
|
if ($child->category_name == 'Membership') {
|
||||||
$scheme_name[] = $child->title;
|
$scheme_name[] = $child->title;
|
||||||
$from_subscription[] = ($j == 0 && !empty($child->from_subscription) && $child->from_subscription !== null) ? date('d/m/Y', strtotime($child->from_subscription)) : "";
|
|
||||||
$to_subscription[] = ($j == 0 && !empty($child->to_subscription) && $child->from_subscription !== null ) ? date('d/m/Y', strtotime($child->to_subscription)) : "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result[$i]['scheme_name'] = !empty($scheme_name) ? implode(", ", $scheme_name) : '';
|
$result[$i]['scheme_name'] = !empty($scheme_name) ? implode(", ", $scheme_name) : '';
|
||||||
$result[$i]['from_subscription'] = !empty($from_subscription) ? implode(" ", $from_subscription) : '';
|
|
||||||
$result[$i]['to_subscription'] = !empty($to_subscription) ? implode(" ", $to_subscription) : '';
|
|
||||||
$result[$i]['invoice_items_details'] = $invoiceItems;
|
$result[$i]['invoice_items_details'] = $invoiceItems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,15 +68,16 @@ public function updateData($table, $data, $where)
|
|||||||
{
|
{
|
||||||
|
|
||||||
return $this->db->table($this->table.' as I' )
|
return $this->db->table($this->table.' as I' )
|
||||||
|
|
||||||
->join('customers as C', 'C.customer_id = I.customer_id', 'left')
|
->join('customers as C', 'C.customer_id = I.customer_id', 'left')
|
||||||
|
->join('subscription as S', 'S.invoice_id = I.invoice_id', 'left')
|
||||||
->join('events as E', 'E.event_id = I.event_id', 'left')
|
->join('events as E', 'E.event_id = I.event_id', 'left')
|
||||||
->join('business as B', 'B.business_id = I.business_id', 'left')
|
->join('business as B', 'B.business_id = I.business_id', 'left')
|
||||||
->join('users as U1', 'U1.user_id = I.created_by', 'left')
|
->join('users as U1', 'U1.user_id = I.created_by', 'left')
|
||||||
->join('users as U2', 'U2.user_id = I.updated_by', 'left')
|
->join('users as U2', 'U2.user_id = I.updated_by', 'left')
|
||||||
->select('I.invoice_id, I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name, I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name, I.updated_on, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no')
|
->select('I.invoice_id, I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name, I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name, I.updated_on, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no,S.from_subscription,S.to_subscription')
|
||||||
->where($where)
|
->where($where)
|
||||||
->orderBy('invoice_id', 'DESC')
|
->orderBy('I.invoice_id', 'DESC')
|
||||||
|
->groupBy('I.invoice_id')
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
// print_r($this->db->getLastQuery());die;
|
// print_r($this->db->getLastQuery());die;
|
||||||
@ -229,7 +223,7 @@ public function get_general_invoice_data($f_date = null, $t_date = null)
|
|||||||
{
|
{
|
||||||
// Fetch invoice data
|
// Fetch invoice data
|
||||||
$query = $this->db->table('invoice')
|
$query = $this->db->table('invoice')
|
||||||
->select('invoice.*, customers.*, COUNT(invoiceitems.product) as item_count')
|
->select('invoice.*,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date, customers.*, COUNT(invoiceitems.product) as item_count')
|
||||||
->where('invoice.isactive', 1)
|
->where('invoice.isactive', 1)
|
||||||
->where('invoice.invoice_type', 1)
|
->where('invoice.invoice_type', 1)
|
||||||
->where('invoiceitems.isactive', 1);
|
->where('invoiceitems.isactive', 1);
|
||||||
@ -255,7 +249,8 @@ public function get_mem_invoice_data($f_date = null, $t_date = null)
|
|||||||
{
|
{
|
||||||
// Fetch invoice data
|
// Fetch invoice data
|
||||||
$query = $this->db->table('invoice')
|
$query = $this->db->table('invoice')
|
||||||
->select('invoice.*, customers.*, COUNT(invoiceitems.product) as item_count')
|
->select('invoice.*, customers.*, COUNT(invoiceitems.product) as item_count,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date,subscription.from_subscription,subscription.to_subscription,DATE_FORMAT(subscription.from_subscription, "%d/%m/%Y") AS formatted_from_date,DATE_FORMAT(subscription.to_subscription, "%d/%m/%Y") AS formatted_to_date')
|
||||||
|
->join('subscription', 'subscription.invoice_id = invoice.invoice_id', 'left')
|
||||||
->where('invoice.isactive', 1)
|
->where('invoice.isactive', 1)
|
||||||
->where('invoice.invoice_type', 2)
|
->where('invoice.invoice_type', 2)
|
||||||
->where('invoiceitems.isactive', 1);
|
->where('invoiceitems.isactive', 1);
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class NotificationModel extends Model
|
|||||||
->join('users as U1', 'U1.user_id = T.created_by', 'left')
|
->join('users as U1', 'U1.user_id = T.created_by', 'left')
|
||||||
->join('users as U2', 'U2.user_id = T.updated_by', 'left')
|
->join('users as U2', 'U2.user_id = T.updated_by', 'left')
|
||||||
->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive')
|
->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive')
|
||||||
|
->whereNotIn('T.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
|
||||||
->get()->getResultArray();
|
->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ public function getCampaignDetails(){
|
|||||||
->join('users as U2', 'U2.user_id = NC.updated_by', 'left')
|
->join('users as U2', 'U2.user_id = NC.updated_by', 'left')
|
||||||
->join('templates as T', 'T.template_id = NC.template_id', 'left')
|
->join('templates as T', 'T.template_id = NC.template_id', 'left')
|
||||||
->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,if(NC.scheduled_time IS NULL ,"",NC.scheduled_time) as scheduled_time')
|
->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,if(NC.scheduled_time IS NULL ,"",NC.scheduled_time) as scheduled_time')
|
||||||
|
->whereNotIn('T.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
|
||||||
->get()->getResultArray();
|
->get()->getResultArray();
|
||||||
|
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public function getAllSubscribersWithNames($where)
|
|||||||
{
|
{
|
||||||
|
|
||||||
$builder = $this->db->table('subscription');
|
$builder = $this->db->table('subscription');
|
||||||
$builder->select('subscription.*, books.title, CONCAT(customers.first_name, " ", customers.last_name) as customer_name');
|
$builder->select('subscription.*, books.title, books.isactive, CONCAT(customers.first_name, " ", customers.last_name) as customer_name');
|
||||||
$builder->join('books', 'books.book_id = subscription.scheme_id');
|
$builder->join('books', 'books.book_id = subscription.scheme_id');
|
||||||
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
|
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
|
||||||
$builder->where($where);
|
$builder->where($where);
|
||||||
|
|||||||
@ -42,14 +42,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="bmail" class="col-form-label">Email<span class="text-danger">*</span></label>
|
<label for="bmail" class="col-form-label">Email<span class="text-danger">*</span></label>
|
||||||
<input type="email" class="form-control" name="bmail" value="<?= isset($businesses['email']) ? $businesses['email'] : '' ?>" placeholder="Email" required />
|
<input type="email" class="form-control" name="bmail" value="<?= isset($businesses['email']) ? $businesses['email'] : '' ?>" placeholder="Email" required onchange="checkExistingEmail(this.value)"/>
|
||||||
<div class="invalid-feedback"> Please provide. </div>
|
<div class="invalid-feedback"> Please provide. </div>
|
||||||
|
<span id="emailValidationMessage"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="bmobile" class="col-form-label">Mobile Number<span class="text-danger">*</span></label>
|
<label for="bmobile" class="col-form-label">Mobile Number<span class="text-danger">*</span></label>
|
||||||
<input type="number" class="form-control" name="bmobile" value="<?= isset($businesses['mobile_no']) ? $businesses['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required data-parsley-type="number" />
|
<input type="text" class="form-control" id="bmobile" name="bmobile" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($businesses['mobile_no']) ? $businesses['mobile_no'] : '' ?>" required data-parsley-type="number">
|
||||||
<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">
|
||||||
@ -87,21 +88,22 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php if (!empty($businesses['business_logo'])) { ?>
|
<?php if (!empty($businesses['business_logo'])) { ?>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-4 mt-3">
|
||||||
<label for="bfile" class="col-form-label">Current Business Logo</label>
|
<div class="media">
|
||||||
<img src="<?= base_url('public/uploads/' . $businesses['business_logo']) ?>" alt="Business Logo" class="preview-image" />
|
<img src="<?= base_url('public/uploads/' . $businesses['business_logo']) ?>" alt="Business Logo" height="50" class="preview-image d-flex align-self-start rounded mr-2">
|
||||||
|
<div class="media-body">
|
||||||
|
<h5 class="mt-0">Existing Logo</h5>
|
||||||
|
<p class="mb-1"><?= $businesses['business_logo']; ?></p>
|
||||||
|
<input type="hidden" id="existing_business_logo_name" name="existing_business_logo_name" placeholder="hidden Field for business_logo name" readonly value="<?= $businesses['business_logo']; ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="bfile" class="col-form-label">Logo</label>
|
||||||
|
<input type="file" name="profile_picture" value="<?= isset($details['business_logo']) ? $details['business_logo'] : '' ?>" accept="image/*" onchange="validateFile(this)" />
|
||||||
|
<div id="error_message" style="color: red;"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="bfile" class="col-form-label">File</label>
|
|
||||||
<input type="file" class="form-control" style="border: 0px !important;" id="bfile" name="bfile" value="<?= isset($businesses['business_logo']) ? $businesses['business_logo'] : '' ?>" multiple />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= isset($businesses['business_id']) ? $businesses['business_id'] : '' ?>" />
|
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= isset($businesses['business_id']) ? $businesses['business_id'] : '' ?>" />
|
||||||
|
|
||||||
<?php if (!empty($businesses) && ($loggedin_person_role === 'sadmin')) { ?>
|
<?php if (!empty($businesses) && ($loggedin_person_role === 'sadmin')) { ?>
|
||||||
@ -140,4 +142,61 @@
|
|||||||
$('#submitBtn').prop('disabled', true);
|
$('#submitBtn').prop('disabled', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
function validateEmail(email) {
|
||||||
|
// Regular expression for a basic email validation
|
||||||
|
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
||||||
|
|
||||||
|
var emailInput = document.getElementById("email");
|
||||||
|
var validationMessage = document.getElementById("emailValidationMessage");
|
||||||
|
|
||||||
|
if (emailPattern.test(email)) {
|
||||||
|
validationMessage.textContent = "";
|
||||||
|
} else if (email == "") {
|
||||||
|
validationMessage.textContent = "";
|
||||||
|
} else {
|
||||||
|
validationMessage.textContent = "Invalid email address";
|
||||||
|
validationMessage.style.color = "red";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function checkExistingEmail(email){
|
||||||
|
var validationMessage = document.getElementById("emailValidationMessage");
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "<?= base_url() . 'check_existing' ?>",
|
||||||
|
data: {
|
||||||
|
value: email,
|
||||||
|
module: 'business',
|
||||||
|
field: 'email'
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
if (response['data']['status']) {
|
||||||
|
validationMessage.textContent = response['data']['message'];
|
||||||
|
validationMessage.style.color = "red";
|
||||||
|
document.getElementById('email').value = "";
|
||||||
|
} else {
|
||||||
|
validationMessage.textContent = "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert("Error occur.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function validateFile(input) {
|
||||||
|
const file = input.files[0];
|
||||||
|
const errorMessage = document.getElementById("error_message");
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
if (file.type.startsWith("image/")) {
|
||||||
|
// It's an image file, no error
|
||||||
|
errorMessage.textContent = "";
|
||||||
|
} else {
|
||||||
|
// Invalid file type
|
||||||
|
errorMessage.textContent = "Invalid file type. Please select an image.";
|
||||||
|
input.value = ""; // Clear the input field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -4,7 +4,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<?php if($loggedin_person_role === 'sadmin'): ?>
|
<?php if($loggedin_person_role === 'sadmin'): ?>
|
||||||
<a href="<?= base_url()."new_bussiness/0"; ?>" class="btn btn-primary"><i class="ri-briefcase-4-fill"></i> Add Bussiness </a>
|
<a href="<?= base_url()."new_bussiness/0"; ?>" class="btn btn-primary"><i class="ri-briefcase-4-fill"></i> Add Business </a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
<br>
|
<br>
|
||||||
@ -22,13 +22,22 @@
|
|||||||
<th>State</th>
|
<th>State</th>
|
||||||
<th>Zip</th>
|
<th>Zip</th>
|
||||||
<th>File</th>
|
<th>File</th>
|
||||||
|
<th>Status</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($businesses as $business) : ?>
|
<?php foreach ($businesses as $business) :
|
||||||
|
if ($business['isactive']) {
|
||||||
|
$class = 'badge badge-soft-success';
|
||||||
|
$message = 'Active';
|
||||||
|
} else {
|
||||||
|
$class = 'badge badge-soft-danger';
|
||||||
|
$message = 'In-Active';
|
||||||
|
}
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $business['title']; ?></td>
|
<td><?= $business['title']; ?></td>
|
||||||
<td><?= $business['email']; ?></td>
|
<td><?= $business['email']; ?></td>
|
||||||
@ -38,9 +47,12 @@
|
|||||||
<td><?= $business['state']; ?></td>
|
<td><?= $business['state']; ?></td>
|
||||||
<td><?= $business['postal_code']; ?></td>
|
<td><?= $business['postal_code']; ?></td>
|
||||||
<td><?= $business['business_logo']; ?></td>
|
<td><?= $business['business_logo']; ?></td>
|
||||||
|
<td>
|
||||||
|
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= base_url() . "new_bussiness/" . $business['business_id']; ?>" class="edit-button" title="Click to Edit Business"><i class="ri-pencil-line"></i></a>
|
<a href="<?= base_url() . "new_bussiness/" . $business['business_id']; ?>" class="edit-button" title="Click to Edit Business"><i class="ri-pencil-line"></i></a>
|
||||||
<?php if($loggedin_person_role === 'sadmin'): ?>
|
<?php if($loggedin_person_role === 'sadmin' && (int)$business['isactive'] === 1): ?>
|
||||||
<a href="<?= base_url() . "delete_business/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
|
<a href="<?= base_url() . "delete_business/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -518,7 +518,6 @@
|
|||||||
event.preventDefault(); // Prevent form submission if it's not valid
|
event.preventDefault(); // Prevent form submission if it's not valid
|
||||||
$('#submitBtn').prop('disabled', false);
|
$('#submitBtn').prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
alert("i am true");
|
|
||||||
$('#submitBtn').prop('disabled', true);
|
$('#submitBtn').prop('disabled', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -118,9 +118,9 @@
|
|||||||
<td><select class="form-control book-select" id="<?= "book" . $inx; ?>" name="item_details[]" onchange="displayBookTag(this,<?= $inx; ?>)" required data-toggle="select2" style="width: 249px !important;">
|
<td><select class="form-control book-select" id="<?= "book" . $inx; ?>" name="item_details[]" onchange="displayBookTag(this,<?= $inx; ?>)" required data-toggle="select2" style="width: 249px !important;">
|
||||||
<option value="">Select a book</option>
|
<option value="">Select a book</option>
|
||||||
<?php foreach ($books as $book) : ?>
|
<?php foreach ($books as $book) : ?>
|
||||||
<?php echo $book->book_id; ?>
|
<?php $disabled = ((int)$book->isactive == 0) ? 'disabled' : ''; ?>
|
||||||
<option value="<?= $book->book_id ?>" <?php if (isset($ii_details['product']) && ($ii_details['product'] === $book->book_id)) echo "selected"; ?>>
|
<option value="<?= $book->book_id ?>" <?php if (isset($ii_details['product']) && ($ii_details['product'] === $book->book_id)) echo "selected"; ?> <?= $disabled; ?>>
|
||||||
<?= $book->title ?></option>
|
<?php if((int)$book->isactive == 0){ echo $book->title." (Disabled) ";}else{ echo $book->title; } ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select></td>
|
</select></td>
|
||||||
<td style="width:10%;"><input type="number" class="form-control item-quantity" id="<?= "quantity" . $inx; ?>" name="quantity[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['quantity']) ? $ii_details['quantity'] : '' ?>" min="1" />
|
<td style="width:10%;"><input type="number" class="form-control item-quantity" id="<?= "quantity" . $inx; ?>" name="quantity[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['quantity']) ? $ii_details['quantity'] : '' ?>" min="1" />
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td hidden><?php echo $row->invoice_id;?></td>
|
<td hidden><?php echo $row->invoice_id;?></td>
|
||||||
<td><?php echo $row->invoice_number;?></td>
|
<td><?php echo $row->invoice_number;?></td>
|
||||||
<td><?php echo $row->invoice_date;?></td>
|
<td><?php echo $row->formatted_invoice_date;?></td>
|
||||||
<td><?php echo $row->first_name." ".$row->last_name;?></td>
|
<td><?php echo $row->first_name." ".$row->last_name;?></td>
|
||||||
<td><?php echo $row->tax . '%'; ?></td>
|
<td><?php echo $row->tax . '%'; ?></td>
|
||||||
<td><?php echo '₹' . number_format($row->discount, 2, '.', ','); ?></td>
|
<td><?php echo '₹' . number_format($row->discount, 2, '.', ','); ?></td>
|
||||||
@ -68,7 +68,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div> <!-- end card body-->
|
</div> <!-- end card body-->
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
@ -158,6 +158,7 @@ $(document).ready(function() {
|
|||||||
.daterangepicker({
|
.daterangepicker({
|
||||||
autoUpdateInput: false,
|
autoUpdateInput: false,
|
||||||
locale: {
|
locale: {
|
||||||
|
format: 'DD/MM/YYYY',
|
||||||
cancelLabel: 'Clear'
|
cancelLabel: 'Clear'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||||
<thead class="custom-thead">
|
<thead class="custom-thead">
|
||||||
<tr>
|
<tr>
|
||||||
@ -53,6 +54,7 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div> <!-- end card body-->
|
</div> <!-- end card body-->
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td hidden><?php echo $row->invoice_id;?></td>
|
<td hidden><?php echo $row->invoice_id;?></td>
|
||||||
<td><?php echo $row->invoice_number;?></td>
|
<td><?php echo $row->invoice_number;?></td>
|
||||||
<td><?php echo $row->invoice_date;?></td>
|
<td><?php echo $row->formatted_invoice_date;?></td>
|
||||||
<!-- <td>scheme name</td> -->
|
<!-- <td>scheme name</td> -->
|
||||||
<td><?php echo $row->first_name." ".$row->last_name;?></td>
|
<td><?php echo $row->first_name." ".$row->last_name;?></td>
|
||||||
<td><?php echo $row->tax . '%'; ?></td>
|
<td><?php echo $row->tax . '%'; ?></td>
|
||||||
@ -65,7 +65,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div> <!-- end card body-->
|
</div> <!-- end card body-->
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
|
|||||||
@ -212,10 +212,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="postal_code" class="col-form-label">Buiness<span
|
<label for="postal_code" class="col-form-label">Business<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<select id="business_id" name="business_id" class="form-control">
|
<select id="business_id" name="business_id" class="form-control">
|
||||||
<option value=null>Choose your Buiness</option>
|
<option value=null>Choose your Business</option>
|
||||||
<?php foreach ($business_details as $value) { ?>
|
<?php foreach ($business_details as $value) { ?>
|
||||||
<option value="<?php echo $value['business_id']; ?>"
|
<option value="<?php echo $value['business_id']; ?>"
|
||||||
<?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
<?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
||||||
|
|||||||
@ -30,13 +30,15 @@
|
|||||||
foreach ($invoice as $row) :
|
foreach ($invoice as $row) :
|
||||||
if ($row['invoice_type'] == 2) :
|
if ($row['invoice_type'] == 2) :
|
||||||
$invoice_date = date('d/m/Y', strtotime($row['invoice_date']));
|
$invoice_date = date('d/m/Y', strtotime($row['invoice_date']));
|
||||||
|
$from_date = date('d/m/Y', strtotime($row['from_subscription']));
|
||||||
|
$to_date = date('d/m/Y', strtotime($row['to_subscription']));
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td hidden><?= $row['invoice_id'] ?></td>
|
<td hidden><?= $row['invoice_id'] ?></td>
|
||||||
<td><?= $row['invoice_number']; ?></td>
|
<td><?= $row['invoice_number']; ?></td>
|
||||||
<td><?= $invoice_date; ?></td>
|
<td><?= $invoice_date; ?></td>
|
||||||
<td><?= $row['from_subscription']; ?></td>
|
<td><?= $from_date; ?></td>
|
||||||
<td><?= $row['to_subscription']; ?></td>
|
<td><?= $to_date; ?></td>
|
||||||
<td><?= $row['customer_name']; ?></td>
|
<td><?= $row['customer_name']; ?></td>
|
||||||
<td><?= $row['scheme_name']; ?></td>
|
<td><?= $row['scheme_name']; ?></td>
|
||||||
<td><?= $row['status']; ?></td>
|
<td><?= $row['status']; ?></td>
|
||||||
|
|||||||
@ -101,9 +101,9 @@
|
|||||||
|
|
||||||
<?php if ($loggedin_person_role === 'sadmin') { ?>
|
<?php if ($loggedin_person_role === 'sadmin') { ?>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="business_id" class="col-form-label">Buiness<span class="text-danger"></span></label>
|
<label for="business_id" class="col-form-label">Business<span class="text-danger"></span></label>
|
||||||
<select id="business_id" name="business_id" class="form-control" required>
|
<select id="business_id" name="business_id" class="form-control" required>
|
||||||
<option value="">Choose your Buiness</option>
|
<option value="">Choose your Business</option>
|
||||||
<?php foreach ($business_details as $value) { ?>
|
<?php foreach ($business_details as $value) { ?>
|
||||||
<option value="<?php echo $value['business_id']; ?>" <?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
<option value="<?php echo $value['business_id']; ?>" <?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
||||||
<?php echo $value['title']; ?></option>
|
<?php echo $value['title']; ?></option>
|
||||||
|
|||||||
@ -73,7 +73,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= $edit_page_route; ?>" class="edit-button" title="Click to Edit User" ><i class="ri-pencil-line"></i></a>
|
<a href="<?= $edit_page_route; ?>" class="edit-button" title="Click to Edit User" ><i class="ri-pencil-line"></i></a>
|
||||||
<a href="<?php echo "delete_user/".$row['user_id']; ?>" class="delete-button" title="Click to Delete User" ><i class="ri-delete-bin-line"></i></a>
|
<?php if((int)$row['isactive'] === 1){ ?>
|
||||||
|
<a href="<?php echo "delete_user/".$row['user_id']; ?>" class="delete-button" title="Click to Delete User" ><i class="ri-delete-bin-line"></i></a>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user