disscussed issue in all module fixed

This commit is contained in:
heama 2024-03-14 07:20:49 +05:30
parent 8c5f9aea0c
commit 74711d22df
24 changed files with 772 additions and 194 deletions

View File

@ -83,6 +83,10 @@ $routes->get("delete_org/(:any)", "Business::delete_org/$1");
#Routes for Donor Routes
$routes->get("Donor_list/", "Customer::index");
$routes->get("new_Donor/(:any)", "Customer::new_Donor/$1");
$routes->get('Customer/getReceiptDetails/(:num)', 'Customer::getReceiptDetails/$1');
// In your routes file (e.g., app/Config/Routes.php)
$routes->post("insert_donor", "Customer::insert_donor");
$routes->get("delete_donor/(:any)", "Customer::delete_donor/$1");
@ -115,6 +119,10 @@ $routes->post("donor_cash_delete/", "Invoice::donor_cash_delete");
$routes->get("donations_accepted/", "Invoice::donations_accepted");
$routes->post("save_donations_accepted/", "Invoice::save_donations_accepted");
$routes->get("audit_history", "Invoice::audit_history");
$routes->get('generate-pdf/(:num)', 'Invoice::generatePdf/$1');
// app/config/Routes.php
$routes->get('Invoice/showInvoiceModal', 'Invoice::showInvoiceModal');
$routes->post("load_details1/", "Invoice::load_details1/");
$routes->post("load_details2/", "Invoice::load_details2/");

View File

@ -47,8 +47,8 @@ class Authentication extends BaseController
$pwd_verify = password_verify((string)$password, $user['password']);
if (!$pwd_verify) {
$this->logger->error('Invalid Password');
return redirect()->back()->withInput()->with('error', 'Invalid Password.');
$this->logger->error('Invalid Email or Password');
return redirect()->back()->withInput()->with('error', 'Invalid Email or Password.');
}
// You can implement your authentication logic here

View File

@ -38,26 +38,34 @@ class Business extends BaseController
helper('session');
$session_role = get_user_role();
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
if ($id === '0') {
$data['page_name'] = 'Add Organization';
$data['loged_user'] = $session_role;
$data['businesses'] = [];
$data['branches'] = [];
$data['donation']=[];
// -----------
$data['details'] = [];
} else if ($id !== '0') {
$data['page_name'] = 'Edit Organization';
$data['loged_user'] = $session_role;
$model = new BusinessModel();
$model->setTable('business');
// Fetch business details
$edit_user_details = $model->where(['business_id ' => $id])->first();
$data['businesses'] = $edit_user_details;
if ($session_role !== 'sadmin') {
$donationaccepted=$model->getDonationBusinessData($id);
$data['donation']=$donationaccepted;
// dd($data['donation']);die;
}
// Fetch branch details
$branchData = $model->getBranchesByBusinessId($id);
$data['branches'] = $branchData;
// ============================
$smodel = new SettingsModel();
@ -76,7 +84,7 @@ class Business extends BaseController
}
$data['business_details']=$this->business_details();
$data['session_bid']=$session_bid;
$this->render_page('business_form', $data);
}
@ -107,8 +115,8 @@ class Business extends BaseController
$session_uid = get_logged_user_id();
$session_role = get_user_role();
$img = $this->request->getFile('bfile');
$filePath = 'public/uploads/' . $this->request->getPost('bfile');
$img = $this->request->getFile('slogo');
$filePath = 'public/uploads/' . $this->request->getPost('slogo');
$fileName = $img->getName();
if ($fileName !== "") {
@ -155,6 +163,7 @@ class Business extends BaseController
$data['isactive'] = 1;
$data['created_by'] = $session_uid;
$businessId = $BusinessModel->insert($data);
$BusinessModel->insertDonationBusiness($businessId);
// $this->insert_branch($businessId);
} else {
// It's an update operation
@ -165,8 +174,11 @@ class Business extends BaseController
$data['updated_by'] = $session_uid;
$BusinessModel->update($business_id, $data);
$businessId = $business_id;
$selectedDonations = $this->request->getPost('name');
$BusinessModel->updateDonationData($businessId, $selectedDonations);
}
// ... existing code ...
if (!empty($_POST['branchname'])) {
@ -208,14 +220,14 @@ $session_uid = get_logged_user_id();
$session_role = get_user_role();
$img = $this->request->getFile('slogo');
print_r($img);
// print_r($img);
$business_id = $this->request->getPost('business_id');
$app_setting_id = $this->request->getPost('app_setting_id');
$filePath = 'public/uploads/' . $this->request->getPost('slogo');
$fileName = $img->getName();
var_dump($fileName);
echo $fileName;
echo $fileName !== "" && $fileName !== null ? "Yes":"No";
// var_dump($fileName);
// echo $fileName;
// echo $fileName !== "" && $fileName !== null ? "Yes":"No";
// die();
if($fileName !== ""){
@ -302,11 +314,22 @@ if (empty($setting_id)) {
// ... existing code ...
// Redirect based on user role
if ($session_role === 'sadmin') {
// ... existing code ...
// Redirect based on user role
if ($session_role === 'sadmin') {
if (empty($business_id)) {
// Redirect to the organization list after inserting a new organization
return redirect()->route('org_list');
} else {
return redirect()->route('dashboard');
}
} else {
session()->setFlashdata('success', 'User has been updated successfully.');
// Assuming 'index' is the route name for your index page
return redirect()->to(base_url("new_org/{$business_id}"));
}
}
## For delete the business details (Which means inactive the details)
@ -329,4 +352,20 @@ if (empty($setting_id)) {
return redirect()->route('org_list');
}
public function insertDonationBusiness($businessId)
{
$donationData = $this->db->table('donation_accepted')
->get()
->getResultArray();
if (!empty($donationData)) {
// Add business_id to each donation record
foreach ($donationData as &$donation) {
$donation['business_id'] = $businessId;
}
// Insert data into donation_business table
$this->db->table('donation_business')->insertBatch($donationData);
}
}
}

View File

@ -24,7 +24,7 @@ class Customer extends BaseController
}
$CustomerModel = new CustomerModel();
$data['page_name'] = 'Donor Details';
$data['page_name'] = 'Contributor Details';
$data['customer'] = $CustomerModel->where($where)->orderBy('donor_id', 'DESC')->findAll();
// echo '<pre>';
@ -44,13 +44,13 @@ class Customer extends BaseController
if ($id === '0') {
// Add Donor
$data['page_name'] = 'Add Donor Details';
$data['page_name'] = 'Add Contributor Details';
$data['customer'] = [];
} else if ($id !== '0') {
// Edit Donor
$data['page_name'] = 'Edit Donor Details';
$data['page_name'] = 'Edit Contributor Details';
$customerModel = new CustomerModel();
// Retrieve customer details by customer ID
@ -129,7 +129,9 @@ class Customer extends BaseController
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
}
$data['updated_by'] = $session_uid;
$donor_id_for_addresses = $donor_id; // for Customer ADDRESS Table
$data['isactive'] = 1;
$donor_id_for_addresses = $donor_id;
// for Customer ADDRESS Table
if ($model->update($donor_id, $data)) {
session()->setFlashdata('success', 'Donor successfully updated');
$this->logger->info("Donor: has been updated successfully. Updated Donor ID = " . $donor_id_for_addresses);
@ -215,7 +217,7 @@ class Customer extends BaseController
public function donor_group(){
$session_bid = get_business_id();
$data['page_name'] = 'Donor Group Details';
$data['page_name'] = 'Contributor Group Details';
$model = new CustomerModel();
$data['donor_group'] = $model->getGroupDetails($session_bid);
$this->render_page('customer_group', $data);
@ -254,10 +256,10 @@ class Customer extends BaseController
if ($id === '0') {
// Add Customer
$data['page_name'] = 'Add Donor Group';
$data['page_name'] = 'Add Contributor Group';
} else if ($id !== '0') {
// Edit Customer
$data['page_name'] = 'Edit Donor Group';
$data['page_name'] = 'Edit Contributor Group';
// Load your Customer Model
$model = new CustomerModel();
@ -469,5 +471,16 @@ class Customer extends BaseController
}
return redirect()->route('donor_group');
}
// Example in your controller
public function getReceiptDetails($donorId)
{
$CustomerModel = new CustomerModel();
// Fetch receipt details from the model based on $donorId
$receiptDetails = $CustomerModel->getReceiptDetailsByDonorId($donorId);
// Return the details as JSON
return $this->response->setJSON($receiptDetails);
}
}

View File

@ -127,23 +127,24 @@ class Invoice extends BaseController
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1];
$rec_where = ['business_id' => (int)get_business_id(), 'YEAR(created_on)' => date('Y')];
$receipt = $model->getData('receipt', $rec_where);
// receipt number
$settingData = $setting_model->select('*')->where($where)->findAll();
$count_receipt_no = (count($receipt) > 0) ? count($receipt) + $settingData[0]['start_no'] + 1 : $settingData[0]['start_no'] + 1;
$pad = '';
for ($i=0; $i < $settingData[0]['left_pad']; $i++) {
$pad .= '0';
}
$data['count_receipt_no'] = $settingData[0]['prefix_format'].'/'.$pad.''.$count_receipt_no;
// Calculate padding based on the count of digits in count_receipt_no
$padding_count = max(0, $settingData[0]['left_pad'] - strlen($count_receipt_no));
$padding = str_repeat('0', $padding_count);
$data['count_receipt_no'] = $settingData[0]['prefix_format'] . $padding . $count_receipt_no;
// Get customer names for the dropdown, events details, and books details
$data['currency'] = $setting_model->select('currency')->where($where)->findAll();
$data['customers'] = $model->getData('donor', $cus_where);
// $data['causes'] = $model->getData('causes', $where);
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id() )->where('isactive',1)->get()->getResult();
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id())->where('isactive',1)->get()->getResult();
$data['campaign'] = $model->getData('campaign', $where);
$data['invoice_number_formatting'] = $model->getData('settings', $where);
if ($id === '0') {
$this->logger->info("Receipt: In Add Details");
$data['page_name'] = 'Add Receipt Details';
@ -160,12 +161,10 @@ class Invoice extends BaseController
$data['receipt_details'] = $model->where(['receipt_id' => $id, 'isactive' => 1])->first();
}
}
// echo '<pre>';
// print_r($data['receipt_details']);
$this->render_page('invoice_form', $data);
}
public function donor_cash_success()
{
helper('session');
@ -432,6 +431,17 @@ class Invoice extends BaseController
$this->logger->error("Receipt: Err Occur =" . $e->getMessage());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
}
$success = true;
// Your existing code...
$invoice_id = $receipt_id; // Replace with the actual invoice_id
// Pass the invoice_id and success variable to the view
return $this->response->setJSON(['success' => true, 'invoice_id' => $invoice_id]);
// Load the view with the success variable
// return view('invoice_modal', ['success' => $success]);
// $this->load->view('invoice_modal', array('success' => $success));
return redirect()->route('receipt_list');
}
@ -663,7 +673,8 @@ class Invoice extends BaseController
$options->set('isRemoteEnabled', true);
$options->set('font_subsetting', true);
$options->set('tempDir', sys_get_temp_dir());
$options->set('defaultFont', 'Arial');
$options->set('defaultFont', 'DejaVuSans');
$options->set('chroot', base_url()."public/uploads");
$dompdf = new Dompdf($options);
@ -708,7 +719,7 @@ class Invoice extends BaseController
// echo $downloadLink;die;
return $html;
}
$dompdf->stream('document.pdf', ['Attachment' => 1]);
$dompdf->stream('Receipt.pdf', ['Attachment' => 1]);
} catch (Exception $e) {
// Handle the exception
// For example, log the error, display a user-friendly message, or return an error response

View File

@ -121,8 +121,9 @@ class Users extends BaseController
}
$data['details'] = $edit_user_details;
}
$data['session_uid']=$session_uid;
$data['session_bid'] = $session_bid;
$this->render_page($render_page_name, $data);
}
@ -277,6 +278,7 @@ class Users extends BaseController
session()->setFlashdata('error', 'User could not be added. Please try again.');
$this->logger->error("Users: Err could not be added. Please try again.");
}
return redirect()->route('user_list');
} else {
@ -288,20 +290,20 @@ class Users extends BaseController
throw new \Exception("Cant able to Update Because logged-In persons can't remove. Please Contact your Admin!....");
}
if ($UsersModel->update($user_id, $data)) {
session()->setFlashdata('success', 'User has been updated successfully.');
$this->logger->info("Users: has been updated successfully. Updated ID = ".$user_id);
} else {
session()->setFlashdata('error', 'User update failed. Please try again.');
$this->logger->error("Users: Err Failed to update ID =".$user_id);
}
session()->setFlashdata('success', 'User has been updated successfully.');
}
}catch(\Exception $e) {
$this->logger->error("Users: Err Occur =".$e->getMessage());
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
}
return redirect()->route('user_list');
}
}catch (\Exception $e) {
$this->logger->error("Users: Err Occur =" . $e->getMessage());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
}
// Redirect back to the user_page function or any other appropriate page
return redirect()->to(base_url("user_page/{$user_id}"));
}
## For delete the user details (Which means inactive the details)
public function delete_user($id)
{

View File

@ -23,6 +23,57 @@ class BusinessModel extends Model
->getResultArray();
}
public function insertDonationBusiness($businessId)
{
$donationData = $this->db->table('donations_accepted')
->get()
->getResultArray();
if (!empty($donationData)) {
$insertData = [];
foreach ($donationData as $donation) {
$insertData[] = [
'bussiness_id' => $businessId,
'donation_id' => $donation['id'],
'name' => $donation['name'],
'is_active'=>1
// Add other columns as needed
];
}
// Insert data into donation_business table
$this->db->table('donation_business')->insertBatch($insertData);
}
}
public function getDonationBusinessData($businessId)
{
return $this->db->table('donation_business')
->where('bussiness_id', $businessId)
->get()
->getResultArray();
}
public function updateDonationData($businessId, $selectedDonations)
{
// Fetch all donation data for the given businessId
$donationData = $this->db->table('donation_business')
->where('bussiness_id', $businessId)
->get()
->getResultArray();
foreach ($donationData as $donation) {
$donationId = $donation['donation_id'];
$isActive = in_array($donationId, $selectedDonations) ? 1 : 0;
// Update donations_accepted table based on selected options
$donationUpdateData = ['is_active' => $isActive];
$donationWhere = ['id' => $donationId];
$this->db->table('donation_business')
->where($donationWhere)
->update($donationUpdateData);
}
}
}
?>

View File

@ -158,6 +158,16 @@ return $this->db->table('donor_groups as CG' )
->get()
->getResultArray();
}
public function getReceiptDetailsByDonorId($donorId)
{
return $this->db->table('receipt')
->select('receipt.receipt_number, receipt.donor_id, receipt.amount, receipt.currency,receipt.receipt_date, d.first_name')
->join('donor as d', 'd.donor_id = receipt.donor_id', 'left') // Adjust columns accordingly
->where('receipt.donor_id', $donorId) // Specify the table alias for the column in the where clause
->get()
->getResult();
}
}

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<title>BigBamboo Donation</title>
<title>BigBamboo Contribution</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
<meta content="Coderthemes" name="author" />
@ -46,18 +46,18 @@
</span>
</a>
</div>
<p class="text-muted mb-4 mt-3">Enter your email address and password.</p>
<p class="text-muted mb-4 mt-3"></p>
</div>
<!-- <form action=""> -->
<form action="<?= base_url() . "authenticate" ?>" method="post">
<div class="form-group mb-3">
<label for="emailaddress">Email address</label>
<input class="form-control" type="email" name="username" id="emailaddress" required placeholder="Enter your email" autocomplete="off">
<input class="form-control" type="email" name="username" id="emailaddress" placeholder="Enter your email" autocomplete="off" required>
<div class="invalid-feedback"> Please enter the email id</div>
</div>
<div class="form-group mb-3">
<!-- <a href="auth-recoverpw-2.html" class="text-muted float-right"><small>Forgot your password?</small></a> -->
<!-- <a href="<?= base_url()."auth_confirm_mail"; ?>" class="text-muted float-right"><small>Forgot your password?</small></a> -->
<a href="#" id="resetLink" class="text-muted float-right"><small>Forgot your password?</small></a>
<label for="password">Password</label>
<div class="input-group input-group-merge">
@ -69,25 +69,17 @@
</div>
</div>
</div>
<!-- <div class="form-group mb-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="checkbox-signin" checked>
<label class="custom-control-label" for="checkbox-signin">Remember me</label>
</div>
</div> -->
<div class="invalid-feedbacks"> </div>
<?php if (isset($validationErrors)) : ?>
<span class="widget-simple text-center">
<div class="media-body align-self-center font-24 avatar-title">
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
<small class="mt-3" style="color: black; font-size:18px;"><?= $validationErrors; ?></small>
</div>
</span>
<?php endif; ?>
<div class="form-group mb-0 text-center">
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
</div>
</form>
</div> <!-- end card-body -->
</div>
@ -110,7 +102,7 @@
<!-- end page -->
<footer class="footer footer-alt">
<p> <?= date('Y') ?> &copy; <?= "bigbamboodonation"; ?>.</p>
<p> <?= date('Y') ?> &copy; <?= "BigBamboo Contribution"; ?>.</p>
</footer>
<!-- Vendor js -->
@ -120,15 +112,23 @@
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>"></script>
<script>
$(document).ready(function() {
// Fetch email value and set it as href for the reset link
$('#emailaddress').on('input', function() {
var emailValue = $(this).val();
$('#resetLink').attr('href', 'auth_confirm_mail?email='+emailValue);
});
$(document).ready(function() {
// Check if email and password fields are empty before showing the reset link
$('#resetLink').on('click', function(event) {
event.preventDefault();
var emailValue = $('#emailaddress').val();
var passwordValue = $('#password').val();
if (emailValue === '' || passwordValue === '') {
$('.invalid-feedbacks').text('Please enter your email.');
} else {
// If both fields are filled, proceed with the reset link action
window.location.href = 'auth_confirm_mail?email=' + emailValue;
}
});
</script>
});
</script>
</body>
</html>
</html>

View File

@ -77,16 +77,14 @@
<?php if (!empty($details)) { ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
<input type="checkbox" id="isactive" name="isactive" class="form-control"
<?= isset($details) && $details[0]['isactive'] == 1 ? 'checked' : '' ?>>
<label for="isactive"> Is Active</label>
</div>
<br>
<?php } ?>
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" onclick="disableButton()" type="submit">Submit</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" onclick="disableButton()" type="submit">Save</button>
<a onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</a>
</div>
</div>

View File

@ -10,7 +10,7 @@
/* Ensure the image is displayed as a block element */
width: 120px;
/* Set the desired width for passport size */
height: 160px;
height: auto;
/* Set the desired height for passport size */
object-fit: cover;
/* Maintain the aspect ratio and fill the container */
@ -21,6 +21,10 @@
cursor: pointer;
margin-left: 5px;
}
#error-message{
color:red;
}
</style>
@ -30,7 +34,14 @@
<div class="card-body">
<h4 class="header-title"><?= $page_name; ?></h4>
<p class="sub-header"> </p>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_org"; ?>" id="myForm">
<hr />
<h4 class="header-title" id="org-settings-title">
@ -38,6 +49,7 @@
<span class="toggle-icon" onclick="toggleSettings('org-settings')"></span>
</h4>
<br>
<div>
<div class="form-group" id="org-settings">
<div class="form-row">
@ -96,7 +108,7 @@
</div>
<div class="form-group col-md-4">
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="bzip" value="<?= isset($businesses['postal_code']) ? $businesses['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" oninput="this.value = this.value.replace(/[^0-9]/g, '')" required />
<input type="text" class="form-control" name="bzip" value="<?= isset($businesses['postal_code']) ? $businesses['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" pattern="[0-9]{6}" maxlength="6" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
@ -159,21 +171,16 @@
placeholder="Copy Right"
value="<?= isset($details['copyright']) ? $details['copyright'] : '' ?>" />
</div>
<div class="form-group col-md-6">
<label for="pagination_limit" class="col-form-label">Pagination Limit</label>
<input type="text" class="form-control" id="pagination_limit" name="pagination_limit"
placeholder="Pagination Limit"
value="<?= isset($details['pagination_limit']) ? $details['pagination_limit'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="currency" class="col-form-label">Currency</label>
<input type="text" class="form-control" id="currency" name="currency"
placeholder="currency (eg : Rupees,Dollar,Euro)"
value="<?= isset($details['currency']) ? $details['currency'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="country" class="col-form-label">Country</label>
<input type="text" class="form-control" id="country" name="country"
@ -184,6 +191,36 @@
</div>
<!-- ################################################################################################# -->
<?php if ($loged_user !== 'sadmin') : ?>
<hr />
<!-- -->
<h4 class="header-title" id="donaton-accepted-title">
Accepted Contribution
<span class="toggle-icon" onclick="toggleSettings('donaton-accepted')"></span>
</h4>
<br>
<div class="form-group" id="donaton-accepted" style="display: none;">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
<select class="form-control" placeholder="PAN Number" id="name" name="name[]" required data-toggle="select2" multiple >
<option value="0" disabled>--Select--</option>
<?php foreach ($donation as $val) : ?>
<option value="<?= $val["id"] ?>" <?php if ($val["is_active"] == 1) echo "selected"; ?> > <?= $val["name"] ?> </option>
<?php endforeach; ?>
</select>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6"></div>
</div>
</div>
</div>
<?php endif; ?>
<!--#################################################################### -->
<hr />
<h4 class="header-title" id="branch-settings-title">
Branch Settings
@ -285,10 +322,12 @@
<div class="form-group" id="logo-settings" style="display: none;">
<div class="form-row">
<div class="form-group col-md-6">
<label for="logo" class="col-form-label">Maximise Logo</label>
<label for="logo" class="col-form-label">Logo</label>
<input type="file" class="form-control" style="border: 0px !important; " id="logo"
name="slogo" placeholder="Logo Name" accept=".png, .jpg, .jpeg"
value="<?= isset($details['logo']) ? $details['logo'] : '' ?>" />
<p id="logo-error-message" style="color: red;"></p>
</div>
<?php if (!empty($details['logo'])) { ?>
<div class="form-group col-md-6">
@ -302,28 +341,20 @@
<input type="file" class="form-control" style="border: 0px !important; " id="favic"
name="favicon" placeholder="Fav-icon Name" accept=".png, .jpg, .jpeg"
value="<?= isset($details['favicon']) ? $details['favicon'] : '' ?>" />
<p id="favic-error-message" style="color: red;"></p>
</div>
<?php if (!empty($details['favicon'])) { ?>
<div class="form-group col-md-6">
<label for="favicon" class="col-form-label">Icon</label>
<label for="favicon" class="col-form-label">Favicon</label>
<img src="<?= base_url('public/uploads/'. $details['favicon']) ?>" alt="Icon"
class="preview-image" />
</div>
<?php } ?>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="bfile" class="col-form-label">Minimise Logo</label>
<input type="file" class="form-control" style="border: 0px !important;" id="bfile" name="bfile" value="<?= isset($businesses['business_logo']) ? $businesses['business_logo'] : null ?>" accept=".jpg, .png, .gif" multiple />
</div>
<?php if (!empty($businesses['business_logo'])) { ?>
<div class="form-group col-md-6">
<label for="bfile" class="col-form-label">Current Organization Logo</label>
<img src="<?= base_url('public/uploads/' . $businesses['business_logo']) ?>" alt="Organization Logo" class="preview-image" />
</div>
<?php } ?>
<div class="form-group col-md-6">
<label for="bfile" class="col-form-label">Signature</label>
@ -381,9 +412,7 @@ Receipt Settings
</div>
<?php if(!empty($details)){ ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
<input type="checkbox" id="isactive" name="isactive" class="form-control"
<?= isset($details) && $details['isactive'] == 1 ? 'checked' : '' ?>>
<label for="isactive"> Is Active</label>
</div>
<br>
<?php } ?>
@ -391,10 +420,24 @@ Receipt Settings
<input type="hidden" id="setting_id" name="setting_id" placeholder="hidden for setting id" value="<?= isset($details['setting_id']) ? $details['setting_id'] : '' ?>" />
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Submit</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button><a href="<?= base_url() . "org_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Save</button>
<?php
$business_id=$businesses['business_id'];
// Check if the logged-in user's ID matches the user's ID
if ($session_bid == $business_id) {
// Redirect to the dashboard with logged_user_id parameter
$redirect_url = base_url() . "dashboard";
} else {
// Redirect to the user list
$redirect_url = base_url() . "org_list";
}
?>
<!-- -->
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
</div>
</div>
</form>
@ -489,6 +532,66 @@ function toggleSettings(id) {
</script>
<script>
document.getElementById('logo').addEventListener('change', function() {
var input = this;
var img = new Image();
var errorMessageElement = document.getElementById('logo-error-message');
img.onload = function() {
if (
img.width >= 140 && img.width <= 150 &&
img.height >= 45 && img.height <= 50
) {
// Valid size, clear error message
errorMessageElement.textContent = '';
} else {
// Invalid size, reset the input and display an error message
input.value = '';
errorMessageElement.textContent = 'Image dimensions should not exceed 150x50';
}
};
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
img.src = e.target.result;
};
reader.readAsDataURL(input.files[0]);
}
});
</script>
<script>
document.getElementById('favic').addEventListener('change', function() {
var input = this;
var img = new Image();
var errorMessageElement = document.getElementById('favic-error-message');
img.onload = function() {
if (
img.width === 216 && img.height === 216
) {
// Valid size, clear error message
errorMessageElement.textContent = '';
} else {
// Invalid size, reset the input and display an error message
input.value = '';
errorMessageElement.textContent = 'Image dimensions should not exceed 216x216.';
}
};
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
img.src = e.target.result;
};
reader.readAsDataURL(input.files[0]);
}
});
</script>

View File

@ -81,9 +81,7 @@
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">
Submit
</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">
Reset
</button>
<a href="<?= base_url() . "campaign_creation"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
</div>
</div>

View File

@ -16,7 +16,12 @@
<a class="nav-link" id="invoiceDetails-tab" data-toggle="tab" href="#invoiceDetails" role="tab" aria-controls="invoiceDetails" aria-selected="false">Invoice Details</a>
</li>
</ul>
<?php endif; ?>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary"style="margin-top:-60px;" id="editButton">Edit</button>
</div>
<div class="tab-content">
<!-- Customer Details Tab -->
@ -27,9 +32,9 @@
<div class="form-row">
<div class="form-group col-md-4">
<label for="DonorType" class="col-form-label">Donor Type<span class="text-danger"> *</span></label>
<select class="form-control" id="DonorType" name="DonorType" required>
<option value="" disabled>Select Donor Type</option>
<label for="DonorType" class="col-form-label">Contributor Type<span class="text-danger"> *</span></label>
<select class="form-control" id="DonorType" name="DonorType" required disabled>
<option value="" disabled>Select Contributor Type</option>
<option value="option1" <?= isset($customer['donor_type']) && $customer['donor_type'] === 'option1' ? 'selected' : '' ?>>Individual</option>
<option value="option2" <?= isset($customer['donor_type']) && $customer['donor_type'] === 'option2' ? 'selected' : '' ?>>Organization</option>
@ -39,13 +44,13 @@
<div class="form-group col-md-4" id="org_reg">
<label for="csname" class="col-form-label">Organization Name<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="org_name_field" name="org_name" value="<?= isset($customer['org_name']) ? $customer['org_name'] : '' ?>" placeholder="Organization Name"/>
<input type="text" class="form-control" id="org_name_field" name="org_name" value="<?= isset($customer['org_name']) ? $customer['org_name'] : '' ?>" placeholder="Organization Name" disabled/>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4" id="org_name">
<label for="csname" class="col-form-label">Organization Reg Details<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_details']) ? $customer['org_reg_details'] : '' ?>" placeholder="Organization Reg details"/>
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_details']) ? $customer['org_reg_details'] : '' ?>" placeholder="Organization Reg details"disabled/>
<div class="invalid-feedback"> Please provide. </div>
</div>
@ -54,12 +59,12 @@
<div class="form-row">
<div class="form-group col-md-4">
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>First Name<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($customer['first_name']) ? $customer['first_name'] : '' ?>" placeholder="First Name" required />
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($customer['first_name']) ? $customer['first_name'] : '' ?>" placeholder="First Name" required disabled/>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<label for="csname" class="col-form-label"><span class="contactPerson">Contact Person </span>Last Name<span class="text-danger"> *</span></label>
<input type="text" class="form-control" name="csname" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" required />
<input type="text" class="form-control" name="csname" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" required disabled />
<div class="invalid-feedback"> Please provide. </div>
</div>
@ -69,7 +74,7 @@
<!-- <div class="input-group-prepend"> -->
<div class="input-group-text">+91</div>
<!-- </div> -->
<input name="mobile"class="form-control" pattern="[0-9]{10}" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" maxlength="10" onkeypress = "return onlyNumbers(event)" style="width: 80% !important;" required>
<input name="mobile"class="form-control" pattern="[0-9]{10}" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" maxlength="10" onkeypress = "return onlyNumbers(event)" style="width: 80% !important;" required >
<div class="invalid-feedback"> Please provide. </div>
@ -95,8 +100,8 @@
<input type="text" class="form-control" id="pan_no"name="pan_no" required value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" />
</div>
<div class="form-group col-md-4" id="adhar_no_individual">
<label for="csname" class="col-form-label"><span class="contactPerson"> </span>Adhar Number</label>
<input type="text" class="form-control" id="adhar_no" name="adhar_no" value="<?= isset($customer['adhar_no']) ? $customer['adhar_no'] : '' ?>" placeholder="Adhar Number" />
<label for="csname" class="col-form-label"><span class="contactPerson"> </span>Aadhaar Number</label>
<input type="text" class="form-control" id="adhar_no" name="adhar_no" value="<?= isset($customer['adhar_no']) ? $customer['adhar_no'] : '' ?>" placeholder="Aadhaar Number" />
</div>
</div>
@ -151,18 +156,15 @@
<br />
<?php if (!empty($customer)) { ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($customer) && $customer['isactive'] == 1 ? 'checked' : '' ?>>
<label for="isactive"> Is Active</label>
</div>
<br>
<?php } ?>
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit"><?= isset($customer['donor_id']) ? 'Update' : 'Submit' ?></button>
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit"><?= isset($customer['donor_id']) ? 'Update' : 'Save' ?></button>
<a href="<?= base_url() . "Donor_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
</div>
</form>
@ -199,7 +201,7 @@
}
function validateEmail(email) {
// Regular expression for a Gmail, Yahoo, or Hotmail email address validation
var emailPattern = /^[a-zA-Z0-9._%+-]+@(gmail\.com|yahoo\.com|hotmail\.com|email\.com)$/;
var emailPattern = /^(.+)@(gmail\.com|yahoo\.com|hotmail\.com|[^@]+\.com)$/i;
var emailInput = document.getElementById("cmail");
var validationMessage = document.getElementById("emailValidationMessage");
@ -288,3 +290,37 @@
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var editButton = document.getElementById('editButton');
var formElements = document.getElementById('myForm').elements;
var donorId = <?= isset($customer['donor_id']) ? $customer['donor_id'] : 0 ?>;
var isEditable = donorId === 0; // Set initial edit mode based on donor ID
// Hide the edit button if donor ID is 0
if (donorId === 0) {
editButton.style.display = 'none';
}
// Add event listener to the button
editButton.addEventListener('click', function() {
isEditable = true; // Enable edit mode when button is clicked
toggleFormElements();
});
// Enable or disable form elements based on edit mode
function toggleFormElements() {
for (var i = 0; i < formElements.length; i++) {
// Enable or disable form elements based on edit mode
formElements[i].disabled = !isEditable;
}
// Enable or disable the submit button based on the edit mode
document.getElementById('submitBtn').disabled = !isEditable;
}
// Initialize form elements state
toggleFormElements();
});
</script>

View File

@ -126,7 +126,7 @@
</div>
<div class="form-group text-right m-b-0">
<button type="button" class="btn btn-purple waves-effect mr-1" data-toggle="modal" data-target="#scrollable-modal">Save</button>
<button type="button" class="btn btn-primary waves-effect mr-1" onclick="refreshPage()">Reset</button>
<a href="<?= base_url() . "donor_group"; ?>" class="btn btn-secondary waves-effect mr-3">Cancel</a>
</div>
<div class="modal" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true" data-backdrop="static">
@ -155,8 +155,8 @@
</div>
<div class="modal-footer">
<button id="original_save" type="submit" id="submitBtn" hidden> Submit </button>
<button id="save" class="btn btn-success waves-effect waves-light mr-1" > Submit </button>
<button id="original_save" type="submit" id="submitBtn" hidden> Save </button>
<button id="save" class="btn btn-success waves-effect waves-light mr-1" > Save </button>
<button type="button" class="btn btn-secondary model-close-btn" data-dismiss="modal">Close</button>
<!-- <button type="button" class="btn btn-primary">Save changes</button> -->
</div>

View File

@ -3,7 +3,7 @@
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url() . "new_Donor/0"; ?>" class="btn btn-primary"><i class="ri-map-pin-user-fill"></i> Add Donor </a>
<a href="<?= base_url() . "new_Donor/0"; ?>" class="btn btn-primary"><i class="ri-map-pin-user-fill"></i> Add Contributor </a>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
@ -32,7 +32,7 @@
<th hidden></th>
<th>Name</th>
<th>Mobile Number</th>
<th>Email</th>
<th>Contributor Type</th>
<th>Action</th>
</tr>
</thead>
@ -45,9 +45,17 @@
<td><?= $value['first_name'].' '.$value['last_name'] ; ?></td>
<?php } ?>
<td><?= $value['mobile_no']; ?></td>
<td><?= $value['email']; ?></td>
<td>
<?php if ($value['donor_type'] == 'option1'): ?>
<?= 'Individual'; ?>
<?php elseif ($value['donor_type'] == 'option2'): ?>
<?= 'Organization'; ?>
<?php endif; ?>
</td>
<td>
<a href="<?= "new_Donor/" . $value['donor_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
<a href="#" class="view-receipts" data-donor-id="<?= $value['donor_id']; ?>"><i class="ri-eye-fill"></i></a>
<?php if(get_user_role() != 'auditor') { ?>
<a href="<?= "delete_donor/" . $value['donor_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
<?php } ?>
@ -61,6 +69,55 @@
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- Add a modal for receipt details -->
<div class="modal fade" id="receiptModal" tabindex="-1" role="dialog" aria-labelledby="receiptModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="receiptModalLabel">Receipt Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table id="scroll-horizontal-datatable_customer" class="table w-100 nowrap">
<thead>
<tr>
<th>Receipt Number</th>
<th>Donor Name</th>
<th>Amount</th>
<th>Date</th>
</tr>
</thead>
<tbody id="receiptDetailsBody">
<!-- Receipt details will be dynamically added here -->
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- <div class="modal fade" id="receiptModal" tabindex="-1" role="dialog" aria-labelledby="receiptModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="receiptModalLabel">Receipt Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div> -->
<!-- end row-->
<script>
@ -70,4 +127,84 @@ $(document).ready(function() {
// Other DataTables configuration options
});
});
</script>
<script>
$(document).ready(function() {
// Handle click on eye icon
// Use event delegation for handling click on "View Receipts"
$(document).on('click', '.view-receipts', function(e) {
e.preventDefault();
// Get donor ID from data attribute
var donorId = $(this).data('donor-id');
console.log("Donor ID:", donorId);
// AJAX request to fetch receipt details
$.ajax({
url: '<?= base_url('Customer/getReceiptDetails/') ?>' + donorId,
type: 'GET',
success: function(response) {
console.log("AJAX Success. Response:", response);
// Populate modal content with receipt details
populateReceiptDetails(response);
// Show the modal
$('#receiptModal').modal('show');
},
error: function(error) {
console.error('Error fetching receipt details:', error);
}
});
});
// Function to populate receipt details in the modal
function populateReceiptDetails(details) {
var detailsBody = $('#receiptDetailsBody');
// Clear existing content
detailsBody.empty();
// Populate details
details.forEach(function(detail) {
var currencySymbol = '';
// Determine currency symbol and name based on the currency code
switch (detail.currency) {
case 'INR':
currencySymbol = '₹';
break;
case 'USD':
currencySymbol = '$';
break;
case 'EUR':
currencySymbol = '€';
break;
case 'INR':
currencySymbol = '₹';
break;
// Add cases for other currencies as needed
default:
currencySymbol = '';
currencyName = '';
break;
}
var receiptDate = new Date(detail.receipt_date);
var formattedDate = ('0' + receiptDate.getDate()).slice(-2) + '-' + ('0' + (receiptDate.getMonth() + 1)).slice(-2) + '-' + receiptDate.getFullYear();
var row = '<tr>' +
'<td>' + detail.receipt_number + '</td>' +
'<td>' + detail.first_name + '</td>' +
'<td>' + currencySymbol + ' ' + detail.amount + '</td>'+
'<td>' + formattedDate + '</td>' +
'</tr>';
detailsBody.append(row);
});
}
});
</script>

View File

@ -42,8 +42,8 @@
<br>
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Submit</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Save</button>
<a onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</a>
</div>
</div>

View File

@ -57,7 +57,7 @@
</div>
<div class="form-group col-md-6">
<label for="event" class="col-form-label">Source Of Receipt</label>
<label for="event" class="col-form-label">Campaign</label>
<select class="form-control" id="campaign" name="campaign_id" data-toggle="select2" >
<option value="">Select the Campaign</option>
<?php foreach ($campaign as $cam) : if(date("Y-m-d") >= $cam->start_date && date("Y-m-d") <= $cam->end_date || $cam->start_date == '' && $cam->end_date == ''){?>
@ -79,20 +79,23 @@
<input type="date" class="form-control" id="invoiceDate" name="receipt_date" value="<?= isset($receipt_details['receipt_date']) ? $receipt_details['receipt_date'] : '' ?>" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-1">
<label for="csname" class="col-form-label">Currency<span class="text-danger"> *</span></label>
<select class="form-control" id="currency" name="currency" data-toggle="select2" required>
<option value="">Select</option>
<?php
$currencies = explode(",", $currency[0]['currency']);
foreach ($currencies as $currency) { ?>
<option value="<?= $currency ?>" <?php if (isset($receipt_details['currency']) && ($receipt_details['currency'] === $currency)) echo "selected"; ?>><?= $currency ?></option>
<?php } ?>
</select>
<!-- <input type="text" class="form-control" id="org_name_field" name="amount" value="<?= isset($receipt_details['amount']) ? $receipt_details['amount'] : '' ?>" placeholder="Amount"/ required> -->
</div>
<div class="form-group col-md-1">
<label for="csname" class="col-form-label">Currency<span class="text-danger"> *</span></label>
<select class="form-control" id="currency" name="currency" data-toggle="select2" required>
<?php
$currencies = explode(",", $currency[0]['currency']);
$selectedCurrency = isset($receipt_details['currency']) ? $receipt_details['currency'] : '';
?>
<?php foreach ($currencies as $index => $currencyOption) : ?>
<option value="<?= $currencyOption ?>" <?= ($index === 0 || $selectedCurrency === $currencyOption) ? 'selected' : '' ?>>
<?= $currencyOption ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-5">
<label for="csname" class="col-form-label">Amount<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="org_name_field" name="amount" value="<?= isset($receipt_details['amount']) ? $receipt_details['amount'] : '' ?>" placeholder="Amount" oninput="this.value = this.value.replace(/[^0-9]/g, '')" required />
@ -132,6 +135,55 @@
</div>
</div>
</div>
<!-- Your Minton theme modal HTML structure -->
<div class="modal fade" id="successModal" tabindex="-1" role="dialog" aria-labelledby="successModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="successModalLabel">Success</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Your Receipt has been submitted successfully!</p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" id="downloadButton">Download</a>
<a href="<?= base_url() . "receipt_list"; ?>" class="btn btn-secondary" data-dismiss="modal">Close</a>
</div>
</div>
</div>
</div>
<!-- Your existing JavaScript code -->
<script>
$(document).ready(function () {
$('#myForm').submit(function (e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: '<?= base_url("save_invoice"); ?>',
data: $(this).serialize(),
success: function (response) {
if (response.success) {
$('#successModal').modal('show');
$('#downloadButton').attr('href', "<?= base_url('generate_invoice_pdf/'); ?>" + response.invoice_id);
} else {
// Handle errors or display a different modal for failure
console.log(response.message);
}
},
error: function (error) {
console.log('AJAX Error:', error);
}
});
});
});
</script>
<script>
var data = <?php echo json_encode($customers); ?>;
@ -188,6 +240,23 @@ $(function() {
}
});
});
$(function() {
$('#donor_mobile').on('change', function(){
var selectedMobile = $(this).val();
// Find the donor with the selected mobile number
var matchingDonor = data.find(donor => donor.mobile_no == selectedMobile);
// Set the donor name directly if there's a matching donor
if (matchingDonor) {
$('#customerName').val(matchingDonor.donor_id).trigger('change');
} else {
// If there's no matching donor or multiple donors, reset the donor name input
$('#customerName').val('').trigger('change');
}
});
});
$(function() {
$('#form-submit').on('click', function(){
@ -329,7 +398,8 @@ $(document).ready(function(){
<div class="form-row">
<div class="form-group col-md-12">
<label for="csname" class="col-form-label"><span class="contactPerson">Organization PAN Number<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="pan_no_org" name="o_pan_no" value="" placeholder="PAN Number" />
<input type="text" class="form-control" id="pan_no_org" name="o_pan_no" value="" placeholder="PAN Number" oninput="validatePANFormatOrg(this)" />
<div id="panNoErrors" style="display: none; color: red;">Invalid PAN format</div>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
@ -355,7 +425,7 @@ $(document).ready(function(){
<div class="form-row">
<div class="form-group col-md-12">
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>Email<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" onblur="validateEmailFormat(this.value)" />
<input type="email" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" required />
<div class="invalid-feedback"> Please provide a valid email address. </div>
</div>
</div>
@ -363,7 +433,9 @@ $(document).ready(function(){
<div class="form-row" id="ind_pan">
<div class="form-group col-md-12">
<label for="csname" class="col-form-label">PAN Number<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="pan_no"name="pan_no" value="<?= isset($receipt_details['pan_no']) ? $receipt_details['pan_no'] : '' ?>" placeholder="PAN Number"/>
<input type="text" class="form-control" id="pan_no" name="pan_no" value="<?= isset($receipt_details['pan_no']) ? $receipt_details['pan_no'] : '' ?>" placeholder="PAN Number" oninput="validatePANFormat(this)" required />
<div id="panNoError" style="display: none; color: red;">Invalid PAN format</div>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
@ -392,7 +464,7 @@ $(document).ready(function(){
<script>
function validateEmailFormat(email) {
var emailPattern = /^(.+)@(gmail\.com|yahoo\.com|hotmail\.com|[^@]+\.com)$/i;
var emailPattern = /^(.+)@(gmail\.com|yahoo\.com|hotmail\.com|[^@]+\.com\.org)$/i;
if (!emailPattern.test(email)) {
alert("Please provide a valid email addres");
@ -401,6 +473,35 @@ if (!emailPattern.test(email)) {
}
}
</script>
<script>
function validatePANFormat(input) {
var isValidPAN = /[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(input.value.toUpperCase());
document.getElementById('panNoError').style.display = isValidPAN ? 'none' : 'block';
input.setCustomValidity(isValidPAN ? '' : 'Invalid PAN format');
}
</script>
<script>
function validatePANFormatOrg(input) {
var isValidPAN = /[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(input.value.toUpperCase());
document.getElementById('panNoErrors').style.display = isValidPAN ? 'none' : 'block';
input.setCustomValidity(isValidPAN ? '' : 'Invalid PAN format');
}
</script>
<script>
$(document).ready(function () {
$('#invoiceDate').on('change', function () {
var selectedDate = new Date($(this).val());
var currentDate = new Date();
// Compare the selected date with the current date
if (selectedDate > currentDate) {
$(this).val(''); // Clear the selected date
}
});
});
</script>

View File

@ -73,8 +73,48 @@
<?= $row['donor_id'] === $DonorData->donor_id ? $DonorData->first_name . $DonorData->last_name : ''; ?>
<?php endforeach; ?>
</td>
<td id="<?= $row['receipt_id'] ?>"><?= $row['amount']; ?></td>
<td><?= $row['payment_mode']; ?></td>
<td id="<?= $row['receipt_id'] ?>">
<?php
$currencySymbol = '';
switch ($row['currency']) {
case 'Rs':
$currencySymbol = '₹'; // Rupees symbol
break;
case 'USD':
$currencySymbol = '$'; // Dollar symbol
break;
case 'EUR':
$currencySymbol = '€'; // Euro symbol
break;
case 'INR':
$currencySymbol = '₹';
break;
default:
$currencySymbol = ''; // Default to empty string if no match
break;
}
echo $currencySymbol . ' ' . $row['amount'];
?>
</td>
<!-- Assuming this is the cell where you want to display payment_mode -->
<td>
<?php if ($row['payment_mode'] == 'debit'): ?>
<?= 'Debit Card'; ?>
<?php elseif ($row['payment_mode'] == 'credit'): ?>
<?= 'Credit Card'; ?>
<?php elseif ($row['payment_mode'] == 'cash'): ?>
<?= 'Cash'; ?>
<?php elseif ($row['payment_mode'] == 'upi'): ?>
<?= 'UPI'; ?>
<?php else: ?>
<?= $row['payment_mode']; ?>
<?php endif; ?>
</td>
<td><?= $row['receipt_header']; ?></td>
<td><?php echo ($row['reason'] == null) ? '-' : $row['reason']; ?></td>
<td>

View File

@ -97,7 +97,7 @@
<td style="width: 69.4882%; height: 18px; text-align: right;border: none;"><strong>Date:</strong>&nbsp; <?=date("d-m-Y", strtotime($data->receipt_date));?></td>
</tr>
<tr style="height: 18px;">
<td style="width: 100%; height: 18px; text-align: justify;border: none;padding:30px;" colspan="2"><p>Received with thanks from <b><?= $data->customer_name ?></b> <?php if($data->cust_pan_no) { echo ', PAN <b>'.$data->cust_pan_no.'</b>'; } ?>, a sum of <b><?= $currency ?> <?= $currency_in_words ?></b> (<?= $currency ?>.<?= $data->amount ?>), towards <b><?= $data->cause_name ?></b>.</td>
<td style="width: 100%; height: 18px; text-align: justify;border: none;padding:30px;" colspan="2"><p>Received with thanks from <b><?= $data->customer_name ?></b> <?php if($data->cust_pan_no) { echo ', PAN <b>'.$data->cust_pan_no.'</b>'; } ?>, a sum of (<?= $currency ?>.<?= $data->amount ?>) <b><?= $currency ?> <?= $currency_in_words ?></b> , towards <b><?= $data->cause_name ?></b>.</td>
</tr>
<tr style="height: 18px;">
<td style="width: 30.5118%; height: 18px;border: none;"><strong>Collected by:</strong>&nbsp; <?= $staff_name ?></td>

View File

@ -216,8 +216,8 @@
<br>
<?php } ?>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-success waves-effect waves-light mr-1" id="submitBtn">Submit</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
<button type="submit" class="btn btn-success waves-effect waves-light mr-1" id="submitBtn">Save</button>
<!-- <button type="button" class="btn btn-secondary waves-effect">Cancel</button> -->
<button type="button" class="btn btn-secondary waves-effect" onclick="history.back()">Cancel</button>
</div>

View File

@ -53,7 +53,7 @@
<div class="logo-box">
<a href="dashboard" class="logo logo-dark text-center">
<span class="logo-sm">
<img src="<?= $company_logo_small; ?>" alt="<?= $company_short_name; ?>" height="24">
<img src="<?= $favicon;; ?>" alt="<?= $company_short_name; ?>" height="24">
<!-- <span class="logo-lg-text-light">Minton</span> -->
</span>
<span class="logo-lg">
@ -65,7 +65,7 @@
<a href="dashboard" class="logo logo-light text-center">
<span class="logo-sm">
<img src="<?= $company_logo_small; ?>" alt="<?= $company_short_name; ?>" height="24">
<img src="<?= $favicon;; ?>" alt="<?= $company_short_name; ?>" height="24">
</span>
<span class="logo-lg">
<!-- <img src="<?= base_url()."public/uploads/default.png" ?>" alt="<?= $company_name; ?>" height="24"> -->
@ -78,7 +78,7 @@
<!-- User box -->
<div class="user-box text-center">
<img src="<?= $profile_picture ?>" alt="user-img" title="Mat Helme" class="rounded-circle avatar-md">
<div class="dropdown">
<a href="javascript: void(0);" class="text-reset dropdown-toggle h5 mt-2 mb-1 d-block"
data-toggle="dropdown"><?= $loggedin_person; ?></a>
@ -133,7 +133,7 @@
<li>
<a href="<?= base_url()."Donor_list"; ?>">
<i class="ri-map-pin-user-fill"></i>
<span> Donors </span>
<span> Contributor </span>
</a>
</li>
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
@ -146,14 +146,7 @@
<?php endif; ?>
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
<li>
<a href="<?= base_url()."donations_accepted"; ?>">
<i class="ri-book-open-line"></i>
<span> Donations Accepted </span>
</a>
</li>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
<li>
<a href="<?= base_url()."causes_list"; ?>">
@ -248,7 +241,7 @@
<li>
<a href="<?= base_url()."donor_group"; ?>">
<i class="ri-team-line"></i>
<span> Donor Groups </span>
<span> Contributor Groups </span>
</a>
</li>
<?php endif; ?>

View File

@ -58,7 +58,7 @@
<li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<img src="<?= $profile_picture; ?>" alt="user-image" class="rounded-circle">
<span class="pro-user-name ml-1"><?= $loggedin_person; ?><i class="mdi mdi-chevron-down"></i>
</span>
</a>

View File

@ -73,7 +73,7 @@
<?php } ?>
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">
Submit
Save
</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">
Reset

View File

@ -3,19 +3,24 @@
<div class="card">
<div class="card-body">
<h4 class="header-title"><?= $page_name; ?></h4>
<!-- <?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
<?php endif; ?> -->
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<form class="parsley-examples" action="<?= base_url() . "insert_users"; ?>" method="post" enctype="multipart/form-data" id="myForm">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label for="first_name" class="col-form-label">Name<span class="text-danger">*</span></label>
<input data-parsley-type="alphanum" type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="<?= isset($details['first_name']) ? $details['first_name'] : '' ?>" required />
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="<?= isset($details['first_name']) ? $details['first_name'] : '' ?>" required />
</div>
<div class="form-group col-md-4">
<label for="mobile_no" class="col-form-label">Mobile Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
<label for="mobile_no" class="col-form-label">Phone Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Phone Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
</div>
<div class="form-group col-md-4">
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
@ -55,12 +60,12 @@
</select>
</div>
<?php } ?>
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
<input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?= isset($details['email']) ? $details['email'] : '' ?>" required />
</div>
<?php if (empty($details)) { ?>
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label for="password" class="col-form-label">Password<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="password" name="password" placeholder="Password" value="<?= isset($details['password']) ? $details['password'] : '' ?>" required />
</div>
@ -85,11 +90,11 @@
<label for="postal_code" class="col-form-label">Postal Code<span class="text-danger"></span></label>
<input data-parsley-type="number" type="text" class="form-control" id="postal_code" name="postal_code" placeholder="Postal Code (PIN)" value="<?= isset($details['postal_code']) ? $details['postal_code'] : '' ?>" pattern="[0-9]{6}" maxlength="6" />
</div>
<div class="form-group col-md-4">
<!-- <div class="form-group col-md-4">
<label for="profile_picture" class="col-form-label">Profile Picture</label>
<input type="file" name="profile_picture" value="<?= isset($details['profile_picture']) ? $details['profile_picture'] : '' ?>" accept="image/*" onchange="validateFile(this)" />
<input type="file" name="profile_picture" value="" accept="image/*" onchange="validateFile(this)" />
<div id="error_message" style="color: red;"></div>
</div>
</div> -->
<?php if ($loggedin_person_role !== 'sadmin') : ?>
<div class="form-group col-md-4">
<label for="branch" class="col-form-label">Branch<span class="text-danger"></span></label>
@ -113,7 +118,7 @@
<?php if (!empty($details['profile_picture'])) { ?>
<div class="form-group col-md-4 mt-3">
<div class="media">
<img src="<?= base_url('public/uploads/' . $details['profile_picture']) ?>" alt="Business Logo" height="100" class="preview-image d-flex align-self-start rounded mr-2" style="position: relative; left: 40%;">
<div class="media-body">
<!-- <h5 class="mt-0">Existing Profile Picture</h5> -->
<!-- <p class="mb-1"><?= $details['profile_picture']; ?></p> -->
@ -131,15 +136,35 @@
</div>
<br>
<?php } ?>
<!-- ... (existing code) -->
<div class="form-group text-right m-b-0">
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">
Submit
</button>
<button type="reset" class="btn btn-primary waves-effect mr-1">
Reset
Save
</button>
<?php if (isset($success_message)) : ?>
<div class="alert alert-success"><?= esc($success_message) ?></div>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'volunteer') : ?>
<a href="<?= base_url() . "user_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
<?php
// Assuming $logged_in_user_id holds the ID of the logged-in user
// Assuming $user_id holds the ID of the user being edited
$user_id=$details['user_id'];
// Check if the logged-in user's ID matches the user's ID
if ($session_uid == $user_id) {
// Redirect to the dashboard with logged_user_id parameter
$redirect_url = base_url() . "dashboard";
} else {
// Redirect to the user list
$redirect_url = base_url() . "user_list";
}
?>
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
<?php endif; ?>
</div>
</div>
@ -286,6 +311,19 @@
}
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
// Get the form group element
var formGroup = document.querySelector('.form-group.text-right.checkbox.checkbox-purple');
// Check if the form group exists and the logged-in person role is not 'volunteer'
if (formGroup && <?= $loggedin_person_role !== 'volunteer' ?>) {
// Hide the form group
formGroup.style.display = 'none';
}
});
</script>
<!-- <script>
// JavaScript to show/hide branches based on selected business
$(document).ready(function () {