Raised Issues fixes : ps
This commit is contained in:
parent
735e3e01ad
commit
e7c091c157
8
.env
8
.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'
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -177,12 +177,14 @@ public function download_details()
|
||||
$pdf->Output($filename, 'D');
|
||||
$this->logger->info("Print Addresses (Scheme) : Downloaded = ".$filename);
|
||||
} else {
|
||||
echo "<script>alert('Customer Details Not Available.');</script>";
|
||||
$this->logger->info("Print Addresses (Scheme) : Details Not Available ");
|
||||
echo "<script>alert('Customer Details Not Available.');</script>";
|
||||
echo "<script>setTimeout(function(){ window.location.href = '" . base_url("subscribers_list") . "'; }, 250);</script>";
|
||||
}
|
||||
} else {
|
||||
echo "<script>alert('Schemes Not Choosen.');</script>";
|
||||
$this->logger->info("Print Addresses (Scheme) : Schemes Not Choosen ");
|
||||
echo "<script>alert('Schemes Not Choosen.');</script>";
|
||||
echo "<script>setTimeout(function(){ window.location.href = '" . base_url("subscribers_list") . "'; }, 250);</script>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
width: 249px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php $flag_name = $invoice_type === '1' ? " Books" : " Scheme"; ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
@ -85,7 +85,7 @@
|
||||
<?php if ($invoice_type === '2') : ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="fromsubcription">From Subcription<span class="text-danger"> *</span></label>
|
||||
<input type="date" class="form-control" id="fromsubcription" name="from_subscription" value="<?= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : '' ?>" required min="<?= date('Y-m-d'); ?>" onchange="updateToDateMinDate(this.value)">
|
||||
<input type="date" class="form-control" id="fromsubcription" name="from_subscription" value="<?= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : '' ?>" required onchange="updateToDateMinDate(this.value)">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="tosubcription">To Subcription<span class="text-danger"> *</span></label>
|
||||
@ -116,7 +116,7 @@
|
||||
foreach ($invoice_item_details as $inx => $ii_details) : ?>
|
||||
<tr>
|
||||
<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 <?= $flag_name; ?></option>
|
||||
<?php foreach ($books as $book) : ?>
|
||||
<?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"; ?> <?= $disabled; ?>>
|
||||
@ -154,7 +154,7 @@
|
||||
} else { ?>
|
||||
<tr>
|
||||
<td style="width:30% !important;"><select class="form-control book-select" id="book0" name="item_details[]" onchange="displayBookTag(this,0)" required data-toggle="select2" style="width: 249px !important;">
|
||||
<option value="">Select a book</option>
|
||||
<option value="">Select a <?= $flag_name ?></option>
|
||||
<?php
|
||||
foreach ($books as $book) :
|
||||
if ((int)$book->isactive === 1) : ?>
|
||||
@ -329,7 +329,7 @@
|
||||
var cell8 = newRow.insertCell(7);
|
||||
|
||||
cell1.innerHTML = `<select class="form-control book-select" id="book${counter}" name="item_details[]" onchange="displayBookTag(this, ${counter})" data-toggle="select2">
|
||||
<option value="">Select a book</option>
|
||||
<option value="">Select a <?php $flag_name ?></option>
|
||||
<?php foreach ($books as $book) : if ((int)$book->isactive === 1) : ?>
|
||||
<option value="<?= $book->book_id ?>"><?= $book->title ?></option>
|
||||
<?php endif; endforeach; ?>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sduration" class="col-form-label">Duration<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="sduration" value="<?= isset($scheme['duration']) ? $scheme['duration'] : '' ?>" placeholder="Duration In Months(ex 1)" required />
|
||||
<input type="number" class="form-control" name="sduration" value="<?= isset($scheme['duration']) ? $scheme['duration'] : '' ?>" placeholder="Duration In Months(ex 1)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
@ -34,20 +34,16 @@
|
||||
<label for="sdescription" class="col-form-label">Description<span class="text-danger"></span></label>
|
||||
<textarea readonly class="form-control" name="sdescription" placeholder="Description"><?= isset($scheme['description']) ? $scheme['description'] : '' ?></textarea>
|
||||
</div>
|
||||
<?php if (isset($scheme['img_name']) && !empty($scheme['img_name'])) : ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="img_name" class="col-form-label">Scheme Picture (Picture Name : <?= $scheme['img_name']; ?>)</label>
|
||||
<div class="media">
|
||||
<img src="<?= $scheme['wp_img_url'] == "" ? base_url('public/uploads/' . $scheme['img_name']) : $scheme['wp_img_url'] ; ?>" alt="Scheme Logo" width="250" height="200" class="preview-image d-flex align-self-start rounded mr-2">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="img_name" class="col-form-label">Scheme Picture</label>
|
||||
<input type="file" name="img_name" accept="image/*" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<?php if (isset($scheme) && !empty($scheme)) : ?>
|
||||
<img id="imagePreview" src="<?= base_url('public/uploads/' . $scheme['img_name']) ?>" alt="Image Preview" style="max-width: 200px; display: block" />
|
||||
<?php else : ?>
|
||||
<img id="imagePreview" src="" alt="Image Preview" style="max-width: 200px; display: none" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" id="book_id" name="book_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 ?>" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user