diff --git a/.env b/.env index 9da15671..323b5f43 100644 --- a/.env +++ b/.env @@ -147,12 +147,12 @@ APP_TIMEZONE = 'Asia/Kolkata' # Whatsapp Access Token And Instance ID #-------------------------------------------------------------------- # for Live Don't delete it -# WAAI_TOKEN = '6568739969f28' -# WAAI_INSTANCE = '656876690A9FD' +WAAI_TOKEN = '6568739969f28' +WAAI_INSTANCE = '656876690A9FD' # Dummy Account by sanjeev created on 14th dec Testing purpose office mail ID (user name - Venba V1 - Krish12345) -WAAI_TOKEN = '657af9bf8cad1' -WAAI_INSTANCE = '657AFA5A01B21' +# WAAI_TOKEN = '657af9bf8cad1' +# WAAI_INSTANCE = '657AFA5A01B21' # for Test by sanjeev already created # WAAI_TOKEN = '65685e954bcf6' diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 9d3722bf..1f27cc92 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -136,8 +136,6 @@ $routes->get("getExpCustomerDetail/(:num)",'Notifications::getExpCustomerDetail/ $routes->get('send_whatsapp_message/', 'Notifications::send_whatsapp_message'); $routes->post('whatsapp_custom_notifications/', 'Notifications::whatsapp_custom_notifications'); $routes->match(['post', 'get'], 'mail_custom_notifications', 'Notifications::mail_custom_notifications'); -// $routes->match(['post', 'get'], 'due_date_notifications', 'Notifications::due_date_notifications'); -// $routes->get('due_date_notifications/(:any)', 'Notifications::due_date_notifications/$1'); $routes->get('due_date_notifications', 'Notifications::due_date_notifications'); $routes->get('template_creation/', 'Notifications::template_creation'); $routes->get('template_creation_form/(:any)', 'Notifications::template_creation_form/$1'); diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index ea39efd6..41704c7b 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -165,6 +165,7 @@ class Invoice extends BaseController $invoice_id = (!empty($this->request->getPost('invoice_id'))) ? $this->request->getPost('invoice_id') : ""; $customer_id = (int)$this->request->getPost('customer_name'); $invoiceType = $this->request->getPost('invoice_type'); + $msg_flag_name = ((int)$invoiceType === 1) ? "Invoice " : "Subscription "; ## Array Formation For Invoice Details.. $data = [ @@ -198,24 +199,23 @@ class Invoice extends BaseController $data['created_by'] = (int)get_logged_user_id(); if ($model->insert($data, 'invoices')) { $invoice_id = $model->insertID(); - session()->setFlashdata('success', 'Invoice has been added successfully.'); - $this->logger->info("Invoice: has been added successfully. Inserted ID = " . $invoice_id); - + session()->setFlashdata('success', $msg_flag_name.'has been added successfully.'); + $this->logger->info($msg_flag_name.": has been added successfully. Inserted ID = " . $invoice_id); // If it's a subscription invoice, also store data in the 'subscription' table } else { - session()->setFlashdata('error', 'Invoice could not be added. Please try again.'); - $this->logger->error("Invoice: Err Occur could not be added. Please try again."); + session()->setFlashdata('error', $msg_flag_name.'could not be added. Please try again.'); + $this->logger->error($msg_flag_name.": Err Occur could not be added. Please try again."); } } else { $data['updated_by'] = (int)get_logged_user_id(); if ($model->update($invoice_id, $data)) { - session()->setFlashdata('success', 'Invoice has been updated successfully.'); - $this->logger->info("Invoice: has been updated successfully. Updated ID = " . $invoice_id); + session()->setFlashdata('success', $msg_flag_name.'has been updated successfully.'); + $this->logger->info($msg_flag_name.": has been updated successfully. Updated ID = " . $invoice_id); } else { - session()->setFlashdata('error', 'Invoice update failed. Please try again.'); - $this->logger->error("Invoice: Err Failed to update ID =" . $invoice_id); + session()->setFlashdata('error', $msg_flag_name.'update failed. Please try again.'); + $this->logger->error($msg_flag_name.": Err Failed to update ID =" . $invoice_id); } } @@ -276,12 +276,11 @@ class Invoice extends BaseController $this->approve_notifications((int)$invoice_id); } } catch (\Exception $e) { - $this->logger->error("Invoice: Err Occur =" . $e->getMessage()); + $this->logger->error($msg_flag_name.": Err Occur =" . $e->getMessage()); session()->setFlashdata('error', 'Message: ' . $e->getMessage()); } - if ($invoiceType === '2') { // If the invoice_type is 2 (subscription invoice), redirect to the subscription list. return redirect()->route('subscribers_list'); // Adjust the route name as needed. diff --git a/app/Controllers/Scheme.php b/app/Controllers/Scheme.php index 3909c39a..5ce095e5 100644 --- a/app/Controllers/Scheme.php +++ b/app/Controllers/Scheme.php @@ -44,12 +44,8 @@ class Scheme extends BaseController } else if ($id !== '0') { $data['page_name'] = 'Edit Scheme'; $model = new SchemeModel(); - - $imageData = $model->getBooksAndImagesByBookId($id); - $data['scheme'] = $imageData[0]; - // print_r($data);die(); } @@ -107,49 +103,48 @@ class Scheme extends BaseController session()->setFlashdata('error', 'Scheme could not be added. Please try again..'); $this->logger->error("Scheme: Err could not be added. Please try again."); } - if (!empty($_FILES['img_name']['name'])) { - // A new image has been uploaded + // if (!empty($_FILES['img_name']['name'])) { + // A new image has been uploaded - // First, delete the previous image file if it exists - if (!empty($imageData) && file_exists(WRITEPATH . 'public/uploads/' . $imageData[0]->img_name)) { - unlink(WRITEPATH . 'public/uploads/' . $imageData[0]->img_name); - } + // First, delete the previous image file if it exists + // if (!empty($imageData) && file_exists(WRITEPATH . 'public/uploads/' . $imageData[0]->img_name)) { + // unlink(WRITEPATH . 'public/uploads/' . $imageData[0]->img_name); + // } - $imageData = [ - 'book_id' => $last_inserted_id, // Assuming $last_inserted_id contains the ID of the inserted scheme - 'img_name' => $_FILES['img_name']['name'], - 'is_cover' => 1, // Set this based on your requirements - 'type' => $_FILES['img_name']['type'] - ]; + // $imageData = [ + // 'book_id' => $last_inserted_id, // Assuming $last_inserted_id contains the ID of the inserted scheme + // 'img_name' => $_FILES['img_name']['name'], + // 'is_cover' => 1, // Set this based on your requirements + // 'type' => $_FILES['img_name']['type'] + // ]; - // Move the uploaded image to a desired location - $imagePath = 'public/uploads/' . $_FILES['img_name']['name']; - move_uploaded_file($_FILES['img_name']['tmp_name'], $imagePath); + // Move the uploaded image to a desired location + // $imagePath = 'public/uploads/' . $_FILES['img_name']['name']; + // move_uploaded_file($_FILES['img_name']['tmp_name'], $imagePath); - // Update image data in the 'book_images' table - $SchemeModel->insertImage($imageData); - } -} - else { - // It's an update operation - $isactive = $this->request->getPost('isactive'); - $data['isactive'] = ($isactive) ? 1 : 0; - $data['updated_by'] = $session_uid; + // Update image data in the 'book_images' table + // $SchemeModel->insertImage($imageData); + // } + } else { + // It's an update operation + $isactive = $this->request->getPost('isactive'); + $data['isactive'] = ($isactive) ? 1 : 0; + $data['updated_by'] = $session_uid; - $SchemeModel->update($scheme_id, $data); - if ($SchemeModel->update($scheme_id, $data)) { - session()->setFlashdata('success', 'Scheme has been updated successfully.'); - $this->logger->info("Scheme: has been updated successfully. Updated Scheme ID = " . $scheme_id); - } else { - session()->setFlashdata('error', 'Scheme update failed. Please try again.'); - $this->logger->error("Scheme: Err Failed to update ID =" . $scheme_id); - } + $SchemeModel->update($scheme_id, $data); + if ($SchemeModel->update($scheme_id, $data)) { + session()->setFlashdata('success', 'Scheme has been updated successfully.'); + $this->logger->info("Scheme: has been updated successfully. Updated Scheme ID = " . $scheme_id); + } else { + session()->setFlashdata('error', 'Scheme update failed. Please try again.'); + $this->logger->error("Scheme: Err Failed to update ID =" . $scheme_id); + } } } catch (\Exception $e) { $this->logger->error("Scheme: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine()); session()->setFlashdata('error', 'Message: ' . $e->getMessage()); } - return redirect()->route('scheme_list'); + return redirect()->route('scheme_list'); } ## For delete the Scheme details (Which means inactive the details) diff --git a/app/Controllers/Subscription.php b/app/Controllers/Subscription.php index 8955b78b..8419a5f5 100644 --- a/app/Controllers/Subscription.php +++ b/app/Controllers/Subscription.php @@ -177,12 +177,14 @@ public function download_details() $pdf->Output($filename, 'D'); $this->logger->info("Print Addresses (Scheme) : Downloaded = ".$filename); } else { - echo ""; $this->logger->info("Print Addresses (Scheme) : Details Not Available "); + echo ""; + echo ""; } } else { - echo ""; $this->logger->info("Print Addresses (Scheme) : Schemes Not Choosen "); + echo ""; + echo ""; } } diff --git a/app/Models/SchemeModel.php b/app/Models/SchemeModel.php index 91742a35..64788edd 100644 --- a/app/Models/SchemeModel.php +++ b/app/Models/SchemeModel.php @@ -46,12 +46,10 @@ class SchemeModel extends Model public function getBooksAndImagesByBookId($id) { $builder = $this->db->table('books'); - $builder->select('books.*, book_images.img_name, book_images.is_cover, book_images.type'); + $builder->select('books.*, book_images.img_name, book_images.is_cover, book_images.type,book_images.wp_img_url'); $builder->join('book_images', 'book_images.book_id = books.book_id', 'left'); $builder->where('books.book_id', $id); - $query = $builder->get(); - return $query->getResultArray(); } diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index 9bc37fa0..8cb3ec1b 100644 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -3,7 +3,7 @@ width: 249px !important; } - +
@@ -85,7 +85,7 @@
- +
@@ -116,7 +116,7 @@ foreach ($invoice_item_details as $inx => $ii_details) : ?> - + isactive === 1) : ?> @@ -329,7 +329,7 @@ var cell8 = newRow.insertCell(7); cell1.innerHTML = ` +
Please provide.
@@ -34,20 +34,16 @@
+ +
+ +
+ " alt="Scheme Logo" width="250" height="200" class="preview-image d-flex align-self-start rounded mr-2"> +
+
+
-
-
- - -
-
- - Image Preview - - - -
-
+