This commit is contained in:
bitbucket 2024-02-17 10:32:29 +05:30
parent e1cc9870dd
commit 1b89482e5b
20 changed files with 1676 additions and 1154 deletions

View File

@ -72,6 +72,7 @@ class Books extends BaseController
$data = [
'name' => $this->request->getPost('name'),
'type' => $this->request->getPost('type'),
'description' => $this->request->getPost('description'),
'from_date' => ($this->request->getPost('from_date') != '') ? $this->request->getPost('from_date') : null,
'to_date' => ($this->request->getPost('to_date') != '') ? $this->request->getPost('to_date') : null,

View File

@ -3,6 +3,7 @@
namespace App\Controllers;
use App\Models\BusinessModel;
use App\Models\SettingsModel;
class Business extends BaseController
{
@ -36,12 +37,15 @@ class Business extends BaseController
{
helper('session');
$session_role = get_user_role();
$session_bid = get_business_id();
if ($id === '0') {
$data['page_name'] = 'Add Organization';
$data['loged_user'] = $session_role;
$data['businesses'] = [];
$data['branches'] = [];
// -----------
$data['details'] = [];
} else if ($id !== '0') {
$data['page_name'] = 'Edit Organization';
@ -55,10 +59,45 @@ class Business extends BaseController
// Fetch branch details
$branchData = $model->getBranchesByBusinessId($id);
$data['branches'] = $branchData;
}
// ============================
$smodel = new SettingsModel();
$smodel->setTable('settings');
if($session_role === 'sadmin'){
$details = $smodel->where(['setting_id' => $id, 'isactive' => 1])->first();
}
else{
$details = $smodel->where(['business_id' => $session_bid, 'isactive' => 1])->first();
}
// echo json_decode($details);die;
$data['details'] = $details;
// echo json_encode($data);die;
}
$data['business_details']=$this->business_details();
$this->render_page('business_form', $data);
}
public function business_details()
{
helper('session');
$session_role = get_user_role();
$session_bid = get_business_id();
$model = new BusinessModel();
$model->setTable('business');
if($session_role === 'sadmin'){
$business_details = $model->where('business_id !=', 0)->orderBy('business_id', 'DESC')->findAll();
}
else{
$business_details = $model->where('business_id', $session_bid)->findAll();
}
return $business_details;
}
## For inserting/updating details of business
@ -162,6 +201,102 @@ class Business extends BaseController
}
}
//SITE SETTINGS
helper('session');
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
$session_role = get_user_role();
$img = $this->request->getFile('slogo');
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";
// die();
if($fileName !== ""){
if ($img->isValid() && !$img->hasMoved()) {
$img->move(ROOTPATH . 'public/uploads', $fileName);
}
}
$favicon = $this->request->getFile('favicon');
$faviconName = $favicon->getName();
if($faviconName !== ""){
if ($favicon->isValid() && !$favicon->hasMoved()) {
$favicon->move(ROOTPATH . 'public/uploads', $faviconName);
}
}
$SettingsModel = new SettingsModel();
$data = [
'site_name' => $this->request->getPost('site_name'),
'site_title' => $this->request->getPost('site_title'),
'terms_service' => $this->request->getPost('terms_service'),
'footer_about' => $this->request->getPost('footer_about'),
'admin_email' => $this->request->getPost('admin_email'),
'mobile'=> $this->request->getPost('mobile'),
'copyright'=> $this->request->getPost('copyright'),
'pagination_limit'=> $this->request->getPost('pagination_limit'),
'site_info'=> $this->request->getPost('site_info'),
'about_info'=> $this->request->getPost('about_info'),
'mail_protocol'=> $this->request->getPost('mail_protocol'),
'mail_title'=> $this->request->getPost('mail_title'),
'mail_host'=> $this->request->getPost('mail_host'),
'mail_port'=> $this->request->getPost('mail_port'),
'mail_encryption'=> $this->request->getPost('mail_encryption'),
'mail_username'=> $this->request->getPost('mail_username'),
'mail_password'=> $this->request->getPost('mail_password'),
'currency'=> $this->request->getPost('currency'),
'country'=> $this->request->getPost('country'),
'business_id'=> $this->request->getPost('business_id'),
'start_no'=> $this->request->getPost('start_no'),
'left_pad'=> $this->request->getPost('left_pad'),
'prefix_format'=> $this->request->getPost('prefix_format'),
];
if($fileName !== "" && $fileName !== null)
{
$data['logo'] = $fileName;
}
if($faviconName !== "" && $faviconName !== null)
{
$data['favicon'] = $faviconName;
}
// echo '<pre>';
// print_r($data); die;
$setting_id = $this->request->getPost('setting_id'); // Get the business ID for update
if (empty($setting_id)) {
// It's an insert operation
$data['isactive'] = 1;
$data['created_by'] = $session_uid;
$SettingsModel->insert($data);
// print_r($data);die;
} else {
// It's an update operation
$isactive = $this->request->getPost('isactive');
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
$data['updated_by'] = $session_uid;
$SettingsModel->update($setting_id, $data);
}
// ... exis
// ... existing code ...

View File

@ -9,8 +9,9 @@ use App\Models\InvoiceModel;
use App\Models\BooksModel;
use App\Models\AuditHistoryModel;
use App\Models\UsersModel;
use App\Models\NotificationModel;
use App\Models\BusinessModel;
use App\Helpers\NotificationHelper;
use Mpdf\Mpdf;
use Dompdf\Dompdf;
use Dompdf\Options;
@ -23,6 +24,8 @@ class Invoice extends BaseController
{
$this->AuditHistoryModel = new AuditHistoryModel();
$this->UserModel = new UsersModel();
$this->Business_Model = new BusinessModel();
}
@ -39,6 +42,13 @@ class Invoice extends BaseController
$data['Donors'] = $model->getData('donor', $where);
$data['page_name'] = 'Receipt Details';
$data['receipt'] = $model->where(["business_id"=>$session_bid])->findAll();
$data['temp_receipt_count'] = $model->where(["business_id"=>$session_bid, 'receipt_header' => 'Temporary Receipt'])->countAllResults();
foreach ($data['receipt'] as $key => $value) {
$data['receipt'][$key]['created_name'] = $this->UserModel->where('user_id', $value['created_by'])->get()->getRow()->first_name;
}
// echo json_encode($data['receipt']);die;
// echo '<pre>';
// print_r($data); die;
@ -120,10 +130,7 @@ class Invoice extends BaseController
$data['currency'] = $setting_model->select('currency')->where($where)->findAll();
$data['customers'] = $model->getData('donor', $where);
// $data['causes'] = $model->getData('causes', $where);
$data['causes'] = $bmodel->select('causes.* , donations_accepted.id as donations_accepted_id , donations_accepted.name as donations_accepted_name')
->join('donations_accepted', 'causes.name = donations_accepted.id', 'left')
->where('causes.business_id', (int)get_business_id() )
->get()->getResult();
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id() )->get()->getResult();
$data['count_receipt_no'] = $count_receipt_no;
$data['campaign'] = $model->getData('campaign', $where);
$data['invoice_number_formatting'] = $model->getData('settings', $where);
@ -192,7 +199,7 @@ class Invoice extends BaseController
$model = new InvoiceModel();
$where = ['business_id' => (int)get_business_id(),'receipt_id' => $this->request->getPost('id') ];
$data['isactive'] = 0;
$data['receipt_header'] = 'Receipt Deleted';
$data['receipt_header'] = 'Rejected';
$data['reason'] = $this->request->getPost('reason');
$updata = $model->getData('receipt', $where);
$upt_data = $model->updateData('receipt', $data, $where);
@ -374,18 +381,42 @@ class Invoice extends BaseController
$records['description'] = $html;
$notification->sendEmail($records);
}
// $template = "Dear " . '$recipient_name' . ",\r\r\n\nYour Invoice has been approved.\n\nDetails:\r\n- Approval Date: " . '$approval_date' . "\r\n- Approved By: " . '$approved_by' . "\r\n- Reference ID: " . '$reference_number' . "\r\n\nBest regards,\n".'$business_name'.",\n".'$business_address'." ".'$business_city'." ".'$business_state'." - ".'$business_postal_code'.".\nCall Us: +91 ".'$business_mobile_no'."\nEmail Us:".'$business_email';
$notificationModel = new NotificationModel();
$bmodel = new BooksModel();
$donormodel = new CustomerModel();
$template_data = $notificationModel->select('*')->where('template_id',7)->findAll();
$cause = $bmodel->select('name')->where('causes_id',(int)$this->request->getPost('causes_id'))->findAll();
$d_name = $donormodel->select('first_name')->where('donor_id',$customer_id)->findAll();
$business = $this->Business_Model->select('*')->where('business_id',(int)get_business_id())->findAll();
$donor_name = $d_name[0]['first_name'];
$currency_amount = $this->request->getPost('amount');
$cause_name = $cause[0]['name'];
$receipt_number = $this->request->getPost('receipt_number');
$r_date = (!empty($receipt_date)) ? date("d-m-Y", strtotime($receipt_date)) : NULL;
$business_name = $business[0]['title'];
// Your original message
$message = $template_data[0]['message'];
// Replace placeholders with actual values
$message = str_replace(
array('{donor_name}', '{currency_amount}', '{cause_name}', '{receipt_name}', '{receipt_date}', '{bisuness_name}'),
array($donor_name, $currency_amount, $cause_name, $receipt_number, $receipt_date, $business_name),
$message
);
// Output the modified message
// echo $message;die;
// // WHATSAPP
// $params = (object) Null;
// // $params->number = (int)'91' . $donordata[0]->mobile_no;
// $params->number = (int)'919677462018';
// $params->type = "text";
// $params->message = $template;
// $params->instance_id = '65C9B978325A2';
// $params->access_token = '65c715e797d16';
// $whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
$params = (object) Null;
// $params->number = (int)'91' . $donordata[0]->mobile_no;
$params->number = (int)'919677462018';
$params->type = "text";
$params->message = $message;
$params->instance_id = '65C9B978325A2';
$params->access_token = '65c715e797d16';
$whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
} catch (\Exception $e) {
$this->logger->error("Receipt: Err Occur =" . $e->getMessage());
@ -418,6 +449,7 @@ class Invoice extends BaseController
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
if($con){
$temp_diff[] = (object) [
'id' => $audit_data->id,
'key' => $key,
'old_value' => $value,
'new_value' => $arr2[0][$key],
@ -432,6 +464,7 @@ class Invoice extends BaseController
// echo $key;die;
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->created_by)->findAll();
$temp_diff[] = (object) [
'id' => $audit_data->id,
'key' => '-',
'old_value' => '-',
'new_value' => 'New Receipt No "'.$arr1[0]['receipt_number'].'" Created',
@ -446,6 +479,7 @@ class Invoice extends BaseController
// echo $key;die;
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
$temp_diff[] = (object) [
'id' => $audit_data->id,
'key' => '-',
'old_value' => '-',
'new_value' => 'Receipt No "'.$arr1[0]['receipt_number'].'" Deleted',
@ -601,6 +635,7 @@ class Invoice extends BaseController
try {
// Fetch the receipt data based on $receipt_id
$model = new InvoiceModel();
$usermodel = new UsersModel();
$setting_model = new SettingsModel();
$where = ['business_id' => (int)get_business_id()];
$currency_data = $setting_model->select('currency')->where($where)->findAll();
@ -619,9 +654,9 @@ class Invoice extends BaseController
$dompdf = new Dompdf($options);
define("DOMPDF_UNICODE_ENABLED", true);
$user = $usermodel->select('first_name')->where('user_id',$data[0]->created_by)->findAll();
$baseurl = base_url()."public/uploads/".$data[0]->business_logo;
$html = view('invoice_pdf_template', ['data' => $data[0],'currency' => $currency_data[0]['currency'] ,'baseurl' => $baseurl]);
$html = view('invoice_pdf_template', ['data' => $data[0],'currency' => $currency_data[0]['currency'], 'currency_in_words' => $this->convertNumberToWords($data[0]->amount) ,'baseurl' => $baseurl, 'staff_name' => $user[0]['first_name'] ]);
// echo $html;die;
$dompdf->loadHtml($html);
@ -650,6 +685,75 @@ class Invoice extends BaseController
}
}
public function convertNumberToWords($number) {
$words = array(
0 => 'Zero',
1 => 'One',
2 => 'Two',
3 => 'Three',
4 => 'Four',
5 => 'Five',
6 => 'Six',
7 => 'Seven',
8 => 'Eight',
9 => 'Nine',
10 => 'Ten',
11 => 'Eleven',
12 => 'Twelve',
13 => 'Thirteen',
14 => 'Fourteen',
15 => 'Fifteen',
16 => 'Sixteen',
17 => 'Seventeen',
18 => 'Eighteen',
19 => 'Nineteen',
20 => 'Twenty',
30 => 'Thirty',
40 => 'Forty',
50 => 'Fifty',
60 => 'Sixty',
70 => 'Seventy',
80 => 'Eighty',
90 => 'Ninety'
);
// Special case for zero
if ($number == 0) {
return $words[0];
}
$num = (int)$number;
$result = '';
// Handle numbers greater than 1000
if ($num >= 1000) {
$thousands = floor($num / 1000);
$result .= $words[$thousands] . ' Thousand ';
$num %= 1000;
}
// Handle numbers between 100 and 999
if ($num >= 100) {
$hundreds = floor($num / 100);
$result .= $words[$hundreds] . ' Hundred ';
$num %= 100;
}
// Handle numbers between 20 and 99
if ($num >= 20) {
$tens = floor($num / 10) * 10;
$result .= $words[$tens] . ' ';
$num %= 10;
}
// Handle numbers between 1 and 19
if ($num > 0) {
$result .= $words[$num];
}
return $result;
}

View File

@ -5,7 +5,7 @@ class BooksModel extends Model
{
protected $table = 'causes';
protected $primaryKey = 'causes_id';
protected $allowedFields = ['causes_id','name','description','from_date', 'to_date', 'business_id', 'created_on','created_by','updated_on','updated_by','isactive'];
protected $allowedFields = ['causes_id','name','type','description','from_date', 'to_date', 'business_id', 'created_on','created_by','updated_on','updated_by','isactive'];
// protected $allowedFields = ['causes_id','title','cover_picture','publication_date','isbn_code','publisher','category','genre','language','description','page_count','tax','price','created_on','created_by','updated_on','updated_by','isactive','business_id'];
public function saveData($data, $id = null)

View File

@ -3,7 +3,11 @@ namespace App\Models;
use CodeIgniter\Model;
class NotificationModel extends Model
{
protected $table;
// protected $table;
protected $table = 'templates';
protected $primaryKey = 'template_id';
// protected $allowedFields = ['invoice_id','invoice_number','donor_id','invoice_date','event_id','business_id','created_on','business_id'];
protected $allowedFields = ['template_name', 'subject', 'message','mode','crteated_on', 'created_by', 'updated_on', 'updated_by', 'isactive'];
public function setCustomTable($tableName)
{

View File

@ -8,9 +8,10 @@
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<div class="table-responsive">
<table id="scroll-horizontal-datatable_customer" class="table w-100 nowrap">
<table id="datatable-buttons" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Action</th>
<th>Module</th>
<th>Key</th>
@ -24,13 +25,14 @@
<?php foreach ($data as $audit_data): ?>
<?php foreach ($audit_data as $value): ?>
<tr>
<td hidden><?= $value->id ?></td>
<td><?= $value->mode ?></td>
<td><?= $value->module ?></td>
<td><?= $value->key ?></td>
<td><?= $value->old_value ?></td>
<td><?= $value->new_value ?></td>
<td><?= $value->updated_by ?></td>
<td><?= $value->updated_on ?></td>
<td><?= date('d-m-Y H:m:s', strtotime($value->updated_on)) ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
@ -46,8 +48,8 @@
<!-- end row-->
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_customer').DataTable({
"order": [[6, "desc"]] // 4 is the column index of "created_on" in your table
$('#datatable-buttons').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});

View File

@ -33,21 +33,24 @@
action="<?= base_url() . "insert_books"; ?>">
<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>
<!-- <input type="text" class="form-control" id="title" name="name" value="<?= isset($details[0]['name']) ? $details[0]['name'] : '' ?>" placeholder="Name of the Causes" required /> -->
<select class="form-control" id="name" name="name" required data-toggle="select2">
<div class="form-group col-md-4">
<label for="publisher" class="col-form-label">Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" name="name" placeholder="Name" value="<?= isset($details[0]['name']) ? $details[0]['name'] : '' ?>" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<label for="title" class="col-form-label">Type<span class="text-danger">*</span></label>
<select class="form-control" id="type" name="type" required data-toggle="select2">
<?php foreach ($cause_list as $val) : ?>
<option value="<?= $val->id ?>" <?php if (isset($details[0]['name']) && $details[0]['name'] == $val->id) echo "selected"; ?> > <?= $val->name ?> </option>
<option value="<?= $val->id ?>" <?php if (isset($details[0]['type']) && $details[0]['type'] == $val->id) echo "selected"; ?> > <?= $val->name ?> </option>
<?php endforeach; ?>
</select>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="publisher" class="col-form-label">Description<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="publisher" name="description" placeholder="Description" value="<?= isset($details[0]['description']) ? $details[0]['description'] : '' ?>" required />
<div class="invalid-feedback"> Please provide. </div>

View File

@ -1,3 +1,8 @@
<style>
.maxWidth {
max-width: 50px;
}
</style>
<div class="row">
<div class="col-12">
<div class="card">
@ -27,11 +32,12 @@
<?php endif; ?>
<div class="table-responsive">
<!-- <table id="basic-datatable" class="table dt-responsive w-100"> -->
<table id="scroll-horizontal-datatable_new" class="table w-100 nowrap">
<table id="scroll-horizontal-datatable_new" class="table w-100">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Action</th>
</tr>
@ -49,10 +55,11 @@
?>
<tr>
<td hidden><?php echo $row['causes_id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td>
<?php
foreach ($cause_list as $key => $value) {
if($row['name'] == $value->id)
if($row['type'] == $value->id)
echo $value->name;
}
?>

View File

@ -98,7 +98,132 @@
</div>
<!-- Existing form fields above this section -->
<!-- ################################################################################################# -->
<hr />
<h4 class="header-title">Site Settings</h4>
<br>
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-12">
<label for="postal_code" class="col-form-label">Organization</label>
<select id="business_id" name="business_id" class="form-control">
<option value="null"><?php if(!isset($details['business_id'])){ echo 'Choose Organization'; } ?></option>
<?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"; ?>>
<?php echo $value['title']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="site_name" class="col-form-label">Site Name</label>
<input type="text" class="form-control" id="site_name" name="site_name"
value="<?= isset($details['site_name']) ? $details['site_name'] : '' ?>"
placeholder="Site Name" />
</div>
<div class="form-group col-md-6">
<label for="site_title" class="col-form-label">Site Title</label>
<input type="text" class="form-control" id="site_title" name="site_title"
placeholder="Site Title"
value="<?= isset($details['site_title']) ? $details['site_title'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="admin_email" class="col-form-label">Admin Email</label>
<input type="email" class="form-control" id="admin_email" name="admin_email"
placeholder="Admin Email"
value="<?= isset($details['admin_email']) ? $details['admin_email'] : '' ?>" />
</div>
<div class="form-group col-md-6">
<label for="mobile" class="col-form-label">Mobile Number</label>
<input type="text" class="form-control" id="mobile" name="mobile"
placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number"
value="<?= isset($details['mobile']) ? $details['mobile'] : '' ?>" maxlength="10" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="copyright" class="col-form-label">Copyright</label>
<input type="text" class="form-control" id="copyright" name="copyright"
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 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"
placeholder="Country"
value="<?= isset($details['country']) ? $details['country'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="mail_protocol" class="col-form-label">Mail Protocol</label>
<input type="text" class="form-control" id="mail_protocol" name="mail_protocol"
placeholder="Mail Protocol (eg : zoho,gmail)"
value="<?= isset($details['mail_protocol']) ? $details['mail_protocol'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="mail_title" class="col-form-label">Mail Title</label>
<input type="text" class="form-control" id="mail_title" name="mail_title"
placeholder="Mail Title"
value="<?= isset($details['mail_title']) ? $details['mail_title'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="mail_host" class="col-form-label">Mail Host</label>
<input type="text" class="form-control" id="mail_host" name="mail_host"
placeholder="Mail Host"
value="<?= isset($details['mail_host']) ? $details['mail_host'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="mail_port" class="col-form-label">Mail Port</label>
<input type="text" class="form-control" id="mail_port" name="mail_port"
placeholder="Mail Port"
value="<?= isset($details['mail_port']) ? $details['mail_port'] : '' ?>" />
</div>
<!-- <div class="form-group col-md-3">
<label for="mail_encryption" class="col-form-label">Mail Encryption</label>
<input type="text" class="form-control" id="mail_encryption" name="mail_encryption"
placeholder="Mail Encryption"
value="<?= isset($details['mail_encryption']) ? $details['mail_encryption'] : '' ?>" />
</div> -->
<div class="form-group col-md-4">
<label for="mail_username" class="col-form-label">Mail Username</label>
<input type="text" class="form-control" id="mail_username" name="mail_username"
placeholder="Mail Username"
value="<?= isset($details['mail_username']) ? $details['mail_username'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="mail_password" class="col-form-label">Mail Password</label>
<input type="text" class="form-control" id="mail_password" name="mail_password"
placeholder="Mail Password"
value="<?= isset($details['mail_password']) ? $details['mail_password'] : '' ?>" />
</div>
</div>
<br />
<!-- ################################################################################################# -->
<div class="after-shipping-addr-add-more">
<hr />
<?php if (empty($branches)) : ?>
@ -152,7 +277,7 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="mobile_no" class="col-form-label">Contact Person<span class="text-danger"> </span></label>
<input type="text" class="form-control" id="mobile_no" name="mobile_no[]" value="<?= isset($branch['mobile_no']) ? $branch['mobile_no'] : '' ?>" placeholder="Contact Person" required data-parsley-type="number" maxlength="10" />/>
<input type="text" class="form-control" id="mobile_no" name="mobile_no[]" value="<?= isset($branch['mobile_no']) ? $branch['mobile_no'] : '' ?>" placeholder="Contact Person" required data-parsley-type="number" maxlength="10" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
@ -183,10 +308,37 @@
</div> -->
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="logo" class="col-form-label">Maximise 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'] : '' ?>" />
</div>
<?php if (!empty($details['logo'])) { ?>
<div class="form-group col-md-6">
<label for="slogo" class="col-form-label"> Logo</label>
<img src="<?= base_url('public/uploads/'. $details['logo']) ?>" alt="Logo"
class="preview-image" />
</div>
<?php } ?>
<div class="form-group col-md-6">
<label for="favicon" class="col-form-label">Favicon</label>
<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'] : '' ?>" />
</div>
<?php if (!empty($details['favicon'])) { ?>
<div class="form-group col-md-6">
<label for="favicon" class="col-form-label">Icon</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">Organization Logo</label>
<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>
@ -221,6 +373,41 @@
</div>
<br>
<?php } ?>
<div class="after-add-more">
<hr />
<h4 class="header-title">Receipt Format</h4>
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<div>
<label for="bistate" class="col-form-label">Prefix</label>
<input type="text" class="form-control" id="bistate" name="prefix_format" placeholder="Receipt Number Format" value="<?= isset($details['prefix_format']) ? $details['prefix_format'] : ''?>"/>
</div>
</div>
<div class="form-group col-md-4">
<label for="baddress1" class="col-form-label">Left Padding</label>
<input type="text" class="form-control" id="baddress1" name="left_pad" placeholder="Left Padding Number" value="<?= isset($details['left_pad']) ? $details['left_pad'] : '' ?>"/>
</div>
<div class="form-group col-md-4">
<label for="bcity" class="col-form-label">Start Number</label>
<input type="text" class="form-control" id="bcity" name="start_no" value="<?= isset($details['start_no']) ? $details['start_no'] : '1' ?>" placeholder="Start Number" />
</div>
</div>
</div>
</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 } ?>
<br />
<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>

View File

@ -26,22 +26,31 @@
<!-- <img src="<?= base_url() . "public/assets/images/plugins/loading.gif" ?>" alt="loader1" style="display:none; height:30px; width:auto;" id="loaderImg"> -->
<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="" <?php if(!isset($customer['donor_type'])) { echo 'selected';} ?>>Select Donor Type</option>
<option value="option1" <?php if(isset($customer['donor_type']) && $customer['donor_type'] == 'option1') { echo 'selected';} ?> >Individual</option>
<option value="option2" <?php if(isset($customer['donor_type']) && $customer['donor_type'] == 'option2') { echo 'selected'; } ?> >Organization</option>
</select>
</select>
<div class="invalid-feedback">Please provide.</div>
<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="" <?php if(!isset($customer['donor_type'])) { echo 'selected';} ?>>Select Donor Type</option>
<option value="option1" <?php if(isset($customer['donor_type']) && $customer['donor_type'] == 'option1') { echo 'selected';} ?> >Individual</option>
<option value="option2" <?php if(isset($customer['donor_type']) && $customer['donor_type'] == 'option2') { echo 'selected'; } ?> >Organization</option>
</select>
</select>
<div class="invalid-feedback">Please provide.</div>
</div>
</div>
<div class="form-row">
<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"/>
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4" id="org_pan_no">
<label for="csname" class="col-form-label"><span class="contactPerson">Organization PAN Number</label>
<input type="text" class="form-control" id="pan_no_org"name="pan_no" value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" />
<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"/>
@ -52,15 +61,10 @@
<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>
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>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 />
<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 />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<label for="cmobile" class="col-form-label"><span class="contactPerson">Contact Person </span>Mobile<span class="text-danger"> *</span></label>
@ -72,26 +76,29 @@
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<div class="form-group col-md-4">
<label for="cmail" class="col-form-label"><span class="contactPerson">Contact Person </span>Email</label>
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" />
<span id="emailValidationMessage"></span>
</div>
</div>
<div class="form-row">
<!-- <div class="form-group col-md-4">
<label for="dob" class="col-form-label">Date Of Birth</label>
<input type="date" class="form-control" name="dob" value="" placeholder="Date Of Birth" />
</div> -->
<div class="form-group col-md-4">
<div class="form-group col-md-4" id="non_org_pan_no">
<label for="csname" class="col-form-label"><span class="contactPerson">Organization </span>PAN Number</label>
<input type="text" class="form-control" id="pan_no"name="pan_no" 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>
<label for="csname" class="col-form-label"><span class="contactPerson"> </span>Aadhar 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" />
</div>
@ -248,12 +255,16 @@ $(function() {
$('.contactPerson').show();
$('#org_reg_details').prop('required', true)
$('#org_name_field').prop('required', true);
$('#org_pan_no').show();
$('#non_org_pan_no').hide();
}
else{
$('#org_name').hide();
$('.contactPerson').hide();
$('#org_reg_details').prop('required', false)
$('#org_name_field').prop('required', false);
$('#org_pan_no').hide();
$('#non_org_pan_no').show()
}
@ -268,7 +279,9 @@ $(function() {
$('#adhar_no_individual').hide();
$('#org_name_field').prop('required', true);
$('#org_reg_details').prop('required',true);
$('#pan_no').prop('required', true); // Add this line to make PAN field required
$('#org_pan_no').show();
$('#pan_no_org').prop('required', true); // Add this line to make PAN field required
$('#non_org_pan_no').hide();
}
else{
$('#adhar_no_individual').show();
@ -277,7 +290,9 @@ $(function() {
$('.contactPerson').hide();
$('#org_name_field').prop('required', false);
$('#org_reg_details').prop('required',false);
$('#pan_no').prop('required', false); // Add this line to make PAN field required
$('#pan_no_org').prop('required', false); // Add this line to make PAN field required
$('#org_pan_no').hide();
$('#non_org_pan_no').show();
}
})

View File

@ -2,6 +2,9 @@
td .select2-container{
width: 249px !important;
}
.fe-plus-circle:hover {
color: #ff0000; /* Change to the desired hover color */
}
</style>
<div class="row">
<div class="col-lg-12">
@ -9,20 +12,7 @@
<div class="card-body">
<div class="row">
<div class="col-lg-6"><h4 class="header-title"><?= $page_name; ?></h4></div>
<div class="col-lg-6 text-right">
<?php if(get_user_role() == 'accounts') { ?>
<input type="hidden" id="donor_id" value="<?= isset($receipt_details['donor_id']) ? $receipt_details['donor_id'] : '' ?>">
<?php if(isset($receipt_details['receipt_header']) && $receipt_details['receipt_header'] != 'Receipt') { ?>
<button type="button" class="btn btn-secondary" id="donor_cash_success">Accept</button>
<?php } if(isset($receipt_details['receipt_header']) && $receipt_details['receipt_header'] != 'Receipt Deleted') { ?>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#info-alert-modal">Delete</button>
<?php } ?>
<?php } ?>
<?php if(get_user_role() != 'accounts') { ?>
<button type="button" class="btn btn-primary" id="add-quk-donar" data-toggle="modal" data-target="#standard-modal">Add Donar</button>
<?php } ?>
</div>
</div>
<br>
<form method="POST" enctype="multipart/form-data" action="<?= base_url() . "save_invoice"; ?>" id="myForm">
@ -30,7 +20,10 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="customerMobile" class="col-form-label">Donor Mobile Name<span class="text-danger"> *</span></label>
<label for="customerMobile" class="col-form-label">Donor Mobile<span class="text-danger"> *</span></label>
<?php if(get_user_role() != 'accounts') { ?>
<i type="button" class="fe-plus-circle" id="add-quk-donar" style="font-size: 24px;" data-toggle="modal" data-target="#standard-modal" title="Add Donor"></i>
<?php } ?>
<select class="form-control" id="donor_mobile" name="donor_mobile" required data-toggle="select2">
<option value="">--Select--</option>
<?php foreach ($customers as $customer) : ?>
@ -42,7 +35,10 @@
<div class="form-group col-md-6">
<label for="customerName" class="col-form-label">Donor Name<span class="text-danger"> *</span></label>
<select class="form-control" id="customerName" name="donor_id" required data-toggle="select2">
<!-- data append from jquery below -->
<option value="">--Select--</option>
<?php foreach ($customers as $customer) : ?>
<option value="<?= $customer->donor_id ?>" <?php if (isset($receipt_details['donor_id']) && ($receipt_details['donor_id'] == $customer->donor_id)) echo "selected"; ?> > <?= $customer->first_name ?> </option>
<?php endforeach; ?>
</select>
</div>
@ -51,8 +47,12 @@
<select class="form-control" id="event" name="causes_id" data-toggle="select2">
<option value="">Select the Causes</option>
<?php foreach ($causes as $causesData) : if(date("Y-m-d") >= $causesData->from_date && date("Y-m-d") <= $causesData->to_date || $causesData->from_date == '' && $causesData->to_date == ''){?>
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected"; ?>><?= $causesData->donations_accepted_name ?> ( <?= $causesData->from_date ?> - <?= $causesData->to_date ?> )</option>
<?php } endforeach; ?>
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected"; ?>><?= $causesData->name ?> ( <?= date("d-m-Y", strtotime($causesData->from_date)) ?> - <?= date("d-m-Y", strtotime($causesData->to_date)) ?> )</option>
<?php } else {
if(isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) { ?>
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected disabled"; ?>><?= $causesData->name ?> ( <?= date("d-m-Y", strtotime($causesData->from_date)) ?> - <?= date("d-m-Y", strtotime($causesData->to_date)) ?> )</option>
<?php }
} endforeach; ?>
</select>
</div>
@ -61,7 +61,7 @@
<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 == ''){?>
<option value="<?= $cam->campaign_id ?>" <?php if (isset($receipt_details['campaign_id']) && ($receipt_details['campaign_id'] === $cam->campaign_id)) echo "selected"; ?>><?= $cam->name ?> ( <?= $cam->start_date ?> - <?= $cam->end_date ?> )</option>
<option value="<?= $cam->campaign_id ?>" <?php if (isset($receipt_details['campaign_id']) && ($receipt_details['campaign_id'] === $cam->campaign_id)) echo "selected"; ?>><?= $cam->name ?> ( <?= date("d-m-Y", strtotime($cam->start_date)) ?> - <?= date("d-m-Y", strtotime($cam->end_date)) ?> )</option>
<?php } endforeach; ?>
</select>
</div>
@ -128,64 +128,55 @@ console.log(editdata,'data');
$(function() {
// onload function
if(editdata) {
var selectedMobile = $('#donor_mobile').val();
console.log(selectedMobile,'selectedMobiledsf');
var options = '<option value="">Select a Donor</option>';
// if(editdata) {
// var selectedMobile = $('#donor_mobile').val();
// console.log(selectedMobile,'selectedMobiledsf');
// var options = '<option value="">Select a Donor</option>';
// Assuming `data` is an array of objects containing donor information
for (const donor of data) {
if(selectedMobile == donor.mobile_no) {
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name} ${donor.last_name}</option>`;
}
}
// // Assuming `data` is an array of objects containing donor information
// for (const donor of data) {
// if(selectedMobile == donor.mobile_no) {
// options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name} ${donor.last_name}</option>`;
// }
// }
// Assuming you have a select element with the id `#donor_select`
$('#customerName').html(options);
}
// // Assuming you have a select element with the id `#donor_select`
// $('#customerName').html(options);
// }
$('#donor_mobile').on('change', function(){
console.log($(this).val());
var selectedMobile = $(this).val();
var options = '<option value="">Select a Donor</option>';
// Assuming `data` is an array of objects containing donor information
for (const donor of data) {
if(selectedMobile == donor.mobile_no) {
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name} ${donor.last_name}</option>`;
if($(this).val())
{
var selectedMobile = $(this).val();
var options = '<option value="">Select a Donor</option>';
// Assuming `data` is an array of objects containing donor information
for (const donor of data) {
if(selectedMobile == donor.mobile_no) {
options += `<option value="${donor.donor_id}" ${editdata && editdata.donor_id == donor.donor_id ? 'selected' : ''}>${donor.first_name}</option>`;
}
}
// Assuming you have a select element with the id `#donor_select`
$('#customerName').html(options);
}
// Assuming you have a select element with the id `#donor_select`
$('#customerName').html(options);
});
});
$(function() {
$('#form-submit').on('click', function(){
console.log('edakfibsefui');
$('#submitBtn').click();
});
});
// accept donor
$(function() {
$('#donor_cash_success').on('click', function(){
$.ajax({
type:"post",
url: "<?php echo base_url(); ?>/donor_cash_success",
data:{ 'id': $('#hiddenInvoiceId').val() },
success:function(response)
{
console.log(response);
if(response) window.location.href = "<?php echo base_url(); ?>/receipt_list";
else console.log('update failed');
else
{
var selectedMobile = $(this).val();
var options = '<option value="">Select a Donor</option>';
// Assuming `data` is an array of objects containing donor information
for (const donor of data) {
options += `<option value="${donor.donor_id}">${donor.first_name}</option>`;
}
});
// Assuming you have a select element with the id `#donor_select`
$('#customerName').html(options);
}
});
});
//delete donor
$(function() {
$('#form-submit').on('click', function(){
console.log('edakfibsefui');
@ -193,6 +184,8 @@ $(function() {
});
});
// hide all fields for account login
$(function() {
role = "<?php echo get_user_role() ?>";
@ -253,6 +246,35 @@ function restriction(event) {
}
}
$(document).ready(function(){
$('#org_details_form').hide();
$('#DonorType').on('change', function(){
let DonorType = $(this).val();
if(DonorType === 'option2'){
$('#org_details_form').show();
$('#org_name_field').prop('required', true);
$('#pan_no_org').prop('required', true);
$('#org_reg_details').prop('required', true);
$('#pan_no').prop('required', false);
$('#ind_pan').hide();
}
else{
$('#org_details_form').hide();
$('#org_name_field').prop('required', false);
$('#pan_no_org').prop('required', false);
$('#org_reg_details').prop('required', false);
$('#pan_no').prop('required', true);
$('#ind_pan').show();
}
})
});
</script>
<!-- Standard modal content -->
@ -260,7 +282,7 @@ function restriction(event) {
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="standard-modalLabel">Add Donar</h4>
<h4 class="modal-title" id="standard-modalLabel">Add Donor</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
@ -281,18 +303,37 @@ function restriction(event) {
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<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($receipt_details['first_name']) ? $receipt_details['first_name'] : '' ?>" placeholder="First Name" required />
<div class="invalid-feedback"> Please provide. </div>
<div id="org_details_form">
<div class="form-row">
<div class="form-group col-md-12">
<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="" placeholder="Organization Name"/>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="csname" class="col-form-label"><span class="contactPerson">Organization PAN Number</label>
<input type="text" class="form-control" id="pan_no_org" name="pan_no" value="" placeholder="PAN Number" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<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="" placeholder="Organization Reg details"/>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<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($receipt_details['last_name']) ? $receipt_details['last_name'] : '' ?>" placeholder="Last Name" required />
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>Name<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($receipt_details['first_name']) ? $receipt_details['first_name'] : '' ?>" placeholder="First Name" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
@ -305,10 +346,10 @@ function restriction(event) {
</div>
</div>
<div class="form-row">
<div class="form-row" id="ind_pan">
<div class="form-group col-md-12">
<label for="csname" class="col-form-label"><span class="contactPerson">Organization </span>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" required/>
<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"/>
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
@ -334,30 +375,6 @@ function restriction(event) {
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Info Alert Modal -->
<div id="info-alert-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body p-4">
<div class="text-center">
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "donor_cash_delete"; ?>" id="myForm1" name="myForm">
<input type="hidden" id="id" name="id" value="<?= isset($receipt_details['receipt_id']) ? $receipt_details['receipt_id'] : '' ?>">
<h4 class="mt-2">DELETE!</h4>
<p class="mt-3">Are you sure you want to delete please continue with reason</p>
<div class="form-group">
<input class="form-control" type="text" id="reason" name="reason" required="" placeholder="Reason">
</div>
<button type="submit" class="btn btn-danger my-2" >Continue</button>
</form>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View File

@ -1,12 +1,25 @@
<style>
th,td {
text-align: center;
}
</style>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url() . "new_receipt/0"; ?>" class="btn btn-primary"><i class="ri-currency-line"></i> Add Receipt </a>
<div id="checkAll" style="display:none;">
<button type="button" class="btn btn-secondary" id="multi_success">Save All</button>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delete-all-modal">Delete All</button>
</div>
<div id="addDonorBtn">
<?php if(get_user_role() != 'accounts') { ?>
<a href="<?= base_url() . "new_receipt/0"; ?>" class="btn btn-primary"><i class="ri-currency-line"></i> Add Receipt </a>
<?php } ?>
</div>
</div>
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<h4 class="header-title mb-3"><?= $page_name; ?> (Temporary Receipt: <?= $temp_receipt_count ?>)</h4>
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
@ -26,86 +39,281 @@
<?php endif; ?>
<?php endif; ?>
<div class="table-responsive">
<table id="scroll-horizontal-datatable_wrapper" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th align="center" >Receipt Number</th>
<th align="center" >Receipt Date</th>
<th align="center" >Donor Name</th>
<th align="center" >Amount</th>
<th align="center" >Status/Reason</th>
<th align="center">Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($receipt as $row) :
?>
<tr>
<td hidden><?= $row['receipt_id']; ?></td>
<td><?= $row['receipt_number']; ?></td>
<td><?= date("d-m-Y", strtotime($row['receipt_date'])); ?> </td>
<td >
<?php foreach ($Donors as $DonorData) : ?>
<?= $row['donor_id'] === $DonorData->donor_id ? $DonorData->first_name . $DonorData->last_name : ''; ?>
<?php endforeach; ?>
</td>
<td><?= $row['amount']; ?></td>
<td><?= $row['receipt_header']; ?> / <?php echo ($row['reason'] == null) ? '-' : $row['reason']; ?></td>
<td>
<a href="<?= base_url() . "new_receipt/" . $row['receipt_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>&nbsp;
<?php if(get_user_role() != 'auditor') { ?>
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>&nbsp;
<?php } ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<table id="datatable-buttons" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th align="center" <?php if (get_user_role() != 'accounts') { echo 'hidden'; } ?>>Select</th>
<th align="center">Receipt Number</th>
<th align="center">Receipt Date</th>
<th align="center">Created By</th>
<th align="center">Donor Name</th>
<th align="center">Amount</th>
<th align="center">Payment Mode</th>
<th align="center">Status</th>
<th align="center">Reason</th>
<th align="center">Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($receipt as $row) : ?>
<tr>
<td hidden><?= $row['receipt_id']; ?></td>
<td <?php if (get_user_role() != 'accounts') { echo 'hidden'; } ?>><input type="checkbox" class="select-checkbox" value="<?= $row['receipt_id'] ?>"></td>
<td><?= $row['receipt_number']; ?></td>
<td><?= date("d-m-Y", strtotime($row['receipt_date'])); ?> </td>
<td><?= $row['created_name']; ?></td>
<td>
<?php foreach ($Donors as $DonorData) : ?>
<?= $row['donor_id'] === $DonorData->donor_id ? $DonorData->first_name . $DonorData->last_name : ''; ?>
<?php endforeach; ?>
</td>
<td><?= $row['amount']; ?></td>
<td><?= $row['payment_mode']; ?></td>
<td><?= $row['receipt_header']; ?></td>
<td><?php echo ($row['reason'] == null) ? '-' : $row['reason']; ?></td>
<td>
<a href="<?= base_url() . "new_receipt/" . $row['receipt_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>&nbsp;
<a href="<?= base_url("generate_invoice_pdf/{$row['receipt_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>&nbsp;
<?php if (get_user_role() == 'accounts') { ?>
<input type="hidden" id="donor_id" value="<?= isset($row['donor_id']) ? $row['donor_id'] : '' ?>">
<?php if (isset($row['receipt_header']) && $row['receipt_header'] != 'Receipt') { ?>
<i type="button" class="bx bx-check-circle donor_cash_success" id="<?= $row['receipt_id'] ?>" title="Accept"></i>
<?php } ?>
<?php if (isset($row['receipt_header']) && $row['receipt_header'] != 'Rejected') { ?>
<i type="button" class="fe-x-circle append_id" id="<?= $row['receipt_id'] ?>" data-toggle="modal" data-target="#info-alert-modal" title="Reject"></i>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div><!-- end row-->
<!-- <script>
function openPdfInNewTab(pdfUrl) {
window.open(pdfUrl, '_blank');
<script>
// accept donor
$(function() {
$('.donor_cash_success').on('click', function(){
id = $(this).attr('id');
$.ajax({
type:"post",
url: "<?php echo base_url(); ?>/donor_cash_success",
data:{ 'id': id },
success:function(response)
{
console.log(response);
if(response) window.location.href = "<?php echo base_url(); ?>/receipt_list";
else console.log('update failed');
}
});
});
});
// multiple accept donation
$(function() {
$('#multi_success').on('click', function(){
for (const checkbox of $('.select-checkbox:checked')) {
const id = $(checkbox).val();
$.ajax({
type:"post",
url: "<?php echo base_url(); ?>/donor_cash_success",
data:{ 'id': id },
success:function(response)
{
console.log(response);
if(response) console.log('success');
else console.log('update failed');
}
});
}
</script> -->
<!-- <script>
$(document).ready(function() {
$("#addNewButton").click(function() {
// Show the pop-up modal
$("#invoiceTypeModal").modal("show");
});
window.location.href = "<?php echo base_url(); ?>/receipt_list";
});
});
$("#confirmInvoiceType").click(function() {
// Get the selected invoice type
var selectedType = $("input[name='invoiceType']:checked").val();
// multiple delete/reject donation
$(function() {
$('#delete-all-submit').on('click', function(){
reason = $('#deleteallreason').val()
for (const checkbox of $('.select-checkbox:checked')) {
const id = $(checkbox).val();
$.ajax({
type:"post",
url: "<?php echo base_url(); ?>/donor_cash_delete",
data:{ 'id': id, 'reason': reason },
success:function(response)
{
console.log(response);
if(response) console.log('success');
else console.log('update failed');
}
});
}
window.location.href = "<?php echo base_url(); ?>/receipt_list";
});
});
// Redirect the user to the appropriate form based on the selected type
if (selectedType === "subscription") {
// Redirect to the subscription invoice form
window.location.href = "<?= base_url('new_subscription_invoice/0'); ?>"; // Update the URL as needed
} else if (selectedType === "book") {
// Redirect to the book invoice form
window.location.href = "<?= base_url('new_receipt/0'); ?>"; // Update the URL as needed
// add id delete form
$(function() {
$('.append_id').on('click', function(){
id = $(this).attr('id');
$('#append_id').val(id)
});
});
// show save,delete --ALL button based on checkbox selected length
$(function() {
$('.select-checkbox').on('change', function() {
var checkedLength = $('.select-checkbox:checked').length;
if(checkedLength) {
$('#addDonorBtn').hide();
$('#checkAll').show();
}
else {
$('#addDonorBtn').show();
$('#checkAll').hide();
}
});
});
$(document).ready(function() {
var table = $('#datatable-buttons').DataTable({
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [{
extend: 'print',
text: 'Print',
title: 'General Invoice Report',
customize: function(win) {
// Exclude the first and last columns
$(win.document.body).find('table').find('th:first-child, td:first-child').remove();
}
},
{
extend: 'csv',
text: 'CSV',
title: 'General Invoice Report',
exportOptions: {
columns: ':not(:first-child)'
}
}
],
"searching": true,
columnDefs: [{
type: 'date',
targets: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
orderable: false
}] // Specify the column index for date sorting and disable sorting
});
// Add date range filter and dropdowns
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function(i) {
var title = $(this).text();
if (i < $('#datatable-buttons thead tr:eq(1) th').length - 1) { // Check if it's not the last column
var uniqueValues = table.column(i).data().unique().sort();
var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>')
.appendTo($(this).empty())
.on('change', function() {
var val = $.fn.dataTable.util.escapeRegex($(this).val());
table.column(i)
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
if (i == 1) {
$(this).html('<input type="checkbox" id="select-all-checkbox"> All');
} else {
uniqueValues.each(function(d, j) {
select.append('<option value="' + d + '">' + d + '</option>');
});
}
$('input', this).on('keyup change', function() {
if (table.column(i).search() !== this.value && $(this).attr('id') != "select-all-checkbox") {
table
.column(i)
.search(this.value)
.draw();
}
});
}
});
// Close the modal when the close button is clicked
$("#invoiceTypeModal .close").click(function() {
$("#invoiceTypeModal").modal("hide");
});
});
</script> -->
<script>
$(document).ready(function() {
$('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [
[0, "desc"]
] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>
// Handle "Select All" checkbox functionality
$('#select-all-checkbox').on('change', function() {
$('.select-checkbox').prop('checked', this.checked);
if(this.checked) {
$('#addDonorBtn').hide();
$('#checkAll').show();
}
else {
$('#addDonorBtn').show();
$('#checkAll').hide();
}
});
});
</script>
<!-- Info Alert Modal -->
<div id="info-alert-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body p-4">
<div class="text-center">
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "donor_cash_delete"; ?>" id="myForm1" name="myForm">
<input type="hidden" id="append_id" name="id" value="">
<h4 class="mt-2">REJECT!</h4>
<p class="mt-3">Are you sure you want to reject please continue with reason</p>
<div class="form-group">
<input class="form-control" type="text" id="reason" name="reason" required="" placeholder="Reason">
</div>
<button type="submit" class="btn btn-danger my-2" >Continue</button>
</form>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Delete All Modal -->
<div id="delete-all-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body p-4">
<div class="text-center">
<form class="needs-validation" novalidate enctype="multipart/form-data" id="myForm2" name="myForm">
<h4 class="mt-2">REJECT ALL!</h4>
<p class="mt-3">Are you sure you want to reject please continue with reason</p>
<div class="form-group">
<input class="form-control" type="text" id="deleteallreason" name="reason" required="" placeholder="Reason">
</div>
<button type="submit" class="btn btn-danger my-2" id="delete-all-submit" >Continue</button>
</form>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View File

@ -2,303 +2,161 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Donation Receipt</title>
<style>
:root {
--primary: #0000ff;
--secondary: #3d3d3d;
--white: #fff;
}
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Lato', sans-serif;
}
body{
background: var(--secondary);
padding: 50px;
color: var(--secondary);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
}
.bold{
font-weight: 900;
}
.light{
font-weight: 100;
}
.wrapper{
background: var(--white);
padding: 30px;
}
.invoice_wrapper{
/* border: 3px solid var(--primary);*/
border: 3px solid #000000;
width: 900px;
max-width: 100%;
}
.invoice_wrapper .header .logo_invoice_wrap,
.invoice_wrapper .header .bill_total_wrap{
display: flex;
justify-content: space-between;
padding: 13px;
}
.invoice_wrapper .header .logo_sec{
display: flex;
align-items: center;
}
.invoice_wrapper .header .logo_sec .title_wrap{
/* margin-left: 5px; */
text-align: center;
position: relative;
bottom: 20px;
}
.invoice_wrapper .header .logo_sec .title_wrap .title{
text-transform: uppercase;
font-size: 18px;
/* color: var(--primary);*/
color: #000000;
}
.invoice_wrapper .header .logo_sec .title_wrap .sub_title{
font-size: 12px;
}
.invoice_wrapper .header .invoice_sec,
.invoice_wrapper .header .bill_total_wrap .total_wrap{
text-align: right;
position: relative;
bottom: 90px;
}
.invoice_wrapper .header .invoice_sec .invoice{
font-size: 28px;
/* color: var(--primary);*/
color: #000000;
}
.invoice_wrapper .header .invoice_sec .invoice_no,
.invoice_wrapper .header .invoice_sec .date{
display: flex;
width: 100%;
}
.invoice_wrapper .header .invoice_sec .invoice_no span:first-child,
.invoice_wrapper .header .invoice_sec .date span:first-child{
width: 70px;
text-align: left;
}
.invoice_wrapper .header .invoice_sec .invoice_no span:last-child,
.invoice_wrapper .header .invoice_sec .date span:last-child{
width: calc(100% - 70px);
}
.invoice_wrapper .header .bill_total_wrap .total_wrap .price,
.invoice_wrapper .header .bill_total_wrap .bill_sec .name{
/* color: var(--primary);*/
color: #000000;
font-size: 20px;
}
.invoice_wrapper .body .main_table .table_header{
background: var(--primary);
}
.invoice_wrapper .body .main_table .table_header .row{
color: var(--white);
font-size: 18px;
border-bottom: 0px;
}
.invoice_wrapper .body .main_table .row{
display: flex;
border-bottom: 1px solid var(--secondary);
}
.invoice_wrapper .body .main_table .row .col{
padding: 10px;
}
.invoice_wrapper .body .main_table .row .col_no{width: 5%;}
.invoice_wrapper .body .main_table .row .col_des{width: 45%;}
.invoice_wrapper .body .main_table .row .col_price{width: 20%; text-align: center;}
.invoice_wrapper .body .main_table .row .col_qty{width: 10%; text-align: center;}
.invoice_wrapper .body .main_table .row .col_total{width: 20%; text-align: right;}
.invoice_wrapper .body .paymethod_grandtotal_wrap{
display: flex;
justify-content: space-between;
padding: 5px 0px 15px;
align-items: flex-end;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .paymethod_sec{
padding-left: 20px;
position: relative;
bottom: 50px;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec{
width: 30%;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p{
display: flex;
width: 100%;
padding-bottom: 5px;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p span{
padding: 0 10px;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p span:first-child{
width: 60%;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p span:last-child{
width: 40%;
text-align: right;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p:last-child span{
background: var(--primary);
padding: 10px;
color: #fff;
}
.invoice_wrapper .footer{
padding: 10px;
}
.invoice_wrapper .footer > p{
/* color: var(--primary);*/
color: #000000;
text-decoration: underline;
font-size: 18px;
padding-bottom: 5px;
}
.invoice_wrapper .footer .terms .tc{
font-size: 16px;
}
.total_wrap{
text-align: right;
position: relative;
bottom: 90px;
right: 20px
}
.images{
position: relative;
top: 20px;
left: 20px
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
border: 3px solid #ccc;
border-radius: 5px;
}
.header {
font-size: x-large;
}
.logo {
max-width: 70px;
}
.company-details {
margin-bottom: 20px;
max-width: 150px;
}
.heading {
text-align: center;
margin-top: -32px;
}
/* .text, .heading {
margin-bottom: 30px;
} */
/* .heading p {
font-size: 20px;
} */
.body {
text-align: center;
margin-bottom: 20px;
}
.same-line {
display: flex;
justify-content: space-between;
align-items: left;
text-align:left;
}
.same-line2 {
display: flex;
justify-content: space-between;
align-items: left;
text-align:right;
}
.signature {
width: 150px;
}
.img{
width: 70px;
height: 70px;
margin-bottom: 25px;
}
.sub-add {
font-size: 9px;
text-align: right;
}
.underline {
text-decoration-line: underline;
text-decoration-style: solid;
}
/* .text {
padding: 20px;
} */
</style>
</head>
<body>
<div class="wrapper">
<div class="invoice_wrapper">
<div class="container">
<table style=" width: 100%; height: 115px;border: none;">
<tbody>
<tr style="height: 25px;">
<td style="width: 20%; height: 25px; text-align: center;border: none;"> <img src="<?= $baseurl ?>" alt="Your Organization Logo" style="width: 50%;"></td>
<td style="width: 80%; height: 20px;border: none;">
<h3 style="text-align: right;text-decoration: underline"><strong><?= $data->title ?></strong></h3>
<p class="sub-add" style="padding-left: 80px; text-align: right;"><?= $data->org_address ?>, <?= $data->org_city ?>,<?= $data->org_state ?> ,<?= $data->org_zip ?>.<br>
MobileNo: <?= $data->org_mobile ?>, Email: <?= $data->org_email ?>,<br>
PAN No: <?= $data->org_pan ?>, Register No:<?= $data->org_reg_no ?></p>
</td>
</tr>
<tr style="height: 18px;">
<td style="width: 100%; height: 18px;border: none;" colspan="2">
<h4 style="text-align: center;"><strong><?=$data->receipt_header?></strong></h4>
</td>
</tr>
<tr style="height: 18px;">
<td style="width: 30.5118%; height: 18px; text-align: left;border: none;"><strong>Receipt:</strong>&nbsp;<?=$data->receipt_number?></td>
<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: center;border: none;" 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>
</tr>
<tr style="height: 18px;">
<td style="width: 30.5118%; height: 18px;border: none;"><strong>Collected by:</strong>&nbsp; <?= $staff_name ?></td>
<td style="width: 69.4882%; height: 18px;text-align: right;border: none;"><img src="<?= base_url()."public/uploads/signature.png" ?>" width="100px" alt="Signature"></td>
</tr>
<tr style="height: 18px;">
<td style="width: 100%; height: 18px; text-align: center;border: none;" colspan="2"><strong>Note:</strong>&nbsp;<?= $data->notes ?></td>
</tr>
</tbody>
</table>
</div>
<!-- <div class="container">
<div class="row same-line">
<div class="logo">
<img class="img" src="<?= $baseurl ?>" alt="Your Organization Logo">
</div>
<div class="header">
<div class="logo_invoice_wrap">
<div class="logo_sec">
<img class="images" src="<?= $baseurl ?>" height="50" width="50" >
<div class="title_wrap">
<p class="title bold"><?= $data->title ?></p>
<p class="sub_title">Email : <?= $data->org_email ?></p>
<p class="sub_title">PAN No : <?= $data->org_pan ?></p>
<p class="sub_title">Register N0 :<?= $data->org_reg_no ?></p>
<p class="sub_title"><?= $data->org_address ?>, <?= $data->org_city ?>,</p>
<p class="sub_title"><?= $data->org_state ?> ,<?= $data->org_zip ?>. MobileNo : <?= $data->org_mobile ?></p>
</div>
</div>
</div>
<div class="bill_total_wrap" style="position: relative;top: -32px;">
<div class="bill_sec">
<p class="bold name"><?=$data->customer_name?></p>
<span>
Mobile No : <?=$data->customer_mobile?><br>
PAN No : <?=$data->cust_pan_no?><br>
Address :<?=$data->address?><br>
</span>
</div>
<div class="invoice_sec">
<!-- <p class="invoice bold">RECEIPT</p> -->
<p class="invoice_no">
<span class="bold">Receipt :</span>
<span>#<?=$data->receipt_number?></span>
</p>
<p class="date">
<span class="bold">Date :</span>
<span><?=date("d-m-Y", strtotime($data->receipt_date));?></span>
</p>
<p class="date">
<span class="bold">Recipt Type :</span>
<span><?=$data->receipt_header?></span>
</p>
</div>
</div>
<div class="underline"><?= $data->title ?></div>
<p class="sub-add"><?= $data->org_address ?>, <?= $data->org_city ?>,<?= $data->org_state ?> ,<?= $data->org_zip ?>.<br>
MobileNo: <?= $data->org_mobile ?>, Email: <?= $data->org_email ?>,<br>
PAN No: <?= $data->org_pan ?>, Register No:<?= $data->org_reg_no ?></p>
</div>
<div class="body">
</div>
<div class="paymethod_grandtotal_wrap">
<div class="paymethod_sec">
<p class="bold">Payment Method</p>
<p> <?=$data->payment_mode?></p>
</div>
<div class="total_wrap">
<p>Donated Amount</p>
<p class="bold price"><?= $currency ?>. <?=$data->amount?> /-</p>
</div>
</div>
<div class="paymethod_grandtotal_wrap" style="position: relative;top: 20px;">
<div class="total_wrap">
<div class="logo_invoice_wrap">
<div class="logo_sec">
<img class="images" src="<?= base_url()."public/uploads/".$data->signature ?>" height="50" width="50" style="position: relative; left: -13px;top: 4px;" >
</div>
</div>
<p class="bold">signature</p>
</div>
</div>
<div class="row same-line">
<div class="text">
<p><b>Receipt:</b> <?=$data->receipt_number?></p>
</div>
<div class="footer" style="position: relative;bottom: 60px;">
<p>Received with thanks from <?= $data->customer_name ?> , PAN <?= $data->cust_pan_no ?>, a sum of <?= $data->amount ?> , towards <?= $data->cause_name ?>.</p>
<p class="bold">Receipt Note:</p>
<div class="terms">
<p><?= $data->notes ?></p>
</div>
<div class="heading same-line2">
<p><b><?=$data->receipt_header?></b></p>
</div>
<div class="same-line2">
<p><b>Date:</b> <?=date("d-m-Y", strtotime($data->receipt_date));?></p>
</div>
</div>
</div>
<div class="row">
<div class="body">
<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><?= $data->amount ?></b>, towards <b><?= $data->cause_name ?></b>.</p>
</div>
</div>
<div class="row">
<div class="same-line">
<div class="collected-by text">
<p><b>Collected by:</b> <?= $staff_name ?></p>
</div>
<div class="signature text">
<img src="<?= base_url()."public/uploads/signature.png" ?>" width="100px" alt="Signature">
</div>
</div>
</div>
<div class="row">
<div class="notes">
<p><b>Note:</b> This template includes placeholders for various pieces of information related to the donation receipt, such as receipt number, receipt date, donor information, donation details, and a thank you message.</p>
</div>
</div>
</div> -->
</body>
</html>

View File

@ -0,0 +1,304 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Donation Receipt</title>
<style>
:root {
--primary: #0000ff;
--secondary: #3d3d3d;
--white: #fff;
}
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Lato', sans-serif;
}
body{
background: var(--secondary);
padding: 50px;
color: var(--secondary);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
}
.bold{
font-weight: 900;
}
.light{
font-weight: 100;
}
.wrapper{
background: var(--white);
padding: 30px;
}
.invoice_wrapper{
/* border: 3px solid var(--primary);*/
border: 3px solid #000000;
width: 900px;
max-width: 100%;
}
.invoice_wrapper .header .logo_invoice_wrap,
.invoice_wrapper .header .bill_total_wrap{
display: flex;
justify-content: space-between;
padding: 13px;
}
.invoice_wrapper .header .logo_sec{
display: flex;
align-items: center;
}
.invoice_wrapper .header .logo_sec .title_wrap{
/* margin-left: 5px; */
text-align: center;
position: relative;
bottom: 20px;
}
.invoice_wrapper .header .logo_sec .title_wrap .title{
text-transform: uppercase;
font-size: 18px;
/* color: var(--primary);*/
color: #000000;
}
.invoice_wrapper .header .logo_sec .title_wrap .sub_title{
font-size: 12px;
}
.invoice_wrapper .header .invoice_sec,
.invoice_wrapper .header .bill_total_wrap .total_wrap{
text-align: right;
position: relative;
bottom: 90px;
}
.invoice_wrapper .header .invoice_sec .invoice{
font-size: 28px;
/* color: var(--primary);*/
color: #000000;
}
.invoice_wrapper .header .invoice_sec .invoice_no,
.invoice_wrapper .header .invoice_sec .date{
display: flex;
width: 100%;
}
.invoice_wrapper .header .invoice_sec .invoice_no span:first-child,
.invoice_wrapper .header .invoice_sec .date span:first-child{
width: 70px;
text-align: left;
}
.invoice_wrapper .header .invoice_sec .invoice_no span:last-child,
.invoice_wrapper .header .invoice_sec .date span:last-child{
width: calc(100% - 70px);
}
.invoice_wrapper .header .bill_total_wrap .total_wrap .price,
.invoice_wrapper .header .bill_total_wrap .bill_sec .name{
/* color: var(--primary);*/
color: #000000;
font-size: 20px;
}
.invoice_wrapper .body .main_table .table_header{
background: var(--primary);
}
.invoice_wrapper .body .main_table .table_header .row{
color: var(--white);
font-size: 18px;
border-bottom: 0px;
}
.invoice_wrapper .body .main_table .row{
display: flex;
border-bottom: 1px solid var(--secondary);
}
.invoice_wrapper .body .main_table .row .col{
padding: 10px;
}
.invoice_wrapper .body .main_table .row .col_no{width: 5%;}
.invoice_wrapper .body .main_table .row .col_des{width: 45%;}
.invoice_wrapper .body .main_table .row .col_price{width: 20%; text-align: center;}
.invoice_wrapper .body .main_table .row .col_qty{width: 10%; text-align: center;}
.invoice_wrapper .body .main_table .row .col_total{width: 20%; text-align: right;}
.invoice_wrapper .body .paymethod_grandtotal_wrap{
display: flex;
justify-content: space-between;
padding: 5px 0px 15px;
align-items: flex-end;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .paymethod_sec{
padding-left: 20px;
position: relative;
bottom: 50px;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec{
width: 30%;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p{
display: flex;
width: 100%;
padding-bottom: 5px;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p span{
padding: 0 10px;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p span:first-child{
width: 60%;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p span:last-child{
width: 40%;
text-align: right;
}
.invoice_wrapper .body .paymethod_grandtotal_wrap .grandtotal_sec p:last-child span{
background: var(--primary);
padding: 10px;
color: #fff;
}
.invoice_wrapper .footer{
padding: 10px;
}
.invoice_wrapper .footer > p{
/* color: var(--primary);*/
color: #000000;
text-decoration: underline;
font-size: 18px;
padding-bottom: 5px;
}
.invoice_wrapper .footer .terms .tc{
font-size: 16px;
}
.total_wrap{
text-align: right;
position: relative;
bottom: 90px;
right: 20px
}
.images{
position: relative;
top: 20px;
left: 20px
}
</style>
</head>
<body>
<div class="wrapper">
<div class="invoice_wrapper">
<div class="header">
<div class="logo_invoice_wrap">
<div class="logo_sec">
<img class="images" src="<?= $baseurl ?>" height="50" width="50" >
<div class="title_wrap">
<p class="title bold"><?= $data->title ?></p>
<p class="sub_title">Email : <?= $data->org_email ?></p>
<p class="sub_title">PAN No : <?= $data->org_pan ?></p>
<p class="sub_title">Register N0 :<?= $data->org_reg_no ?></p>
<p class="sub_title"><?= $data->org_address ?>, <?= $data->org_city ?>,</p>
<p class="sub_title"><?= $data->org_state ?> ,<?= $data->org_zip ?>. MobileNo : <?= $data->org_mobile ?></p>
</div>
</div>
</div>
<div class="bill_total_wrap" style="position: relative;top: -32px;">
<div class="bill_sec">
<p class="bold name"><?=$data->customer_name?></p>
<span>
Mobile No : <?=$data->customer_mobile?><br>
PAN No : <?=$data->cust_pan_no?><br>
Address :<?=$data->address?><br>
</span>
</div>
<div class="invoice_sec">
<!-- <p class="invoice bold">RECEIPT</p> -->
<p class="invoice_no">
<span class="bold">Receipt :</span>
<span>#<?=$data->receipt_number?></span>
</p>
<p class="date">
<span class="bold">Date :</span>
<span><?=date("d-m-Y", strtotime($data->receipt_date));?></span>
</p>
<p class="date">
<span class="bold">Recipt Type :</span>
<span><?=$data->receipt_header?></span>
</p>
</div>
</div>
</div>
<div class="body">
<div class="paymethod_grandtotal_wrap">
<div class="paymethod_sec">
<p class="bold">Payment Method</p>
<p> <?=$data->payment_mode?></p>
</div>
<div class="total_wrap">
<p>Donated Amount</p>
<p class="bold price"><?= $currency ?>. <?=$data->amount?> /-</p>
</div>
</div>
<div class="paymethod_grandtotal_wrap" style="position: relative;top: 20px;">
<div class="total_wrap">
<div class="logo_invoice_wrap">
<div class="logo_sec">
<img class="images" src="<?= base_url()."public/uploads/".$data->signature ?>" height="50" width="50" style="position: relative; left: -13px;top: 4px;" >
</div>
</div>
<p class="bold">signature</p>
</div>
</div>
</div>
<div class="footer" style="position: relative;bottom: 60px;">
<p>Received with thanks from <?= $data->customer_name ?> , PAN <?= $data->cust_pan_no ?>, a sum of <?= $data->amount ?> , towards <?= $data->cause_name ?>.</p>
<p class="bold">Receipt Note:</p>
<div class="terms">
<p><?= $data->notes ?></p>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,92 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Report PDF</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
.page {
max-width: 800px;
margin: 0 auto;
background-color: #fff;
border: 2px solid #000;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
display: flex;
align-items: flex-start; /* Align items to the start of the flex container */
}
.logo {
margin-right: 20px; /* Add some space between the logo and details */
}
.company-details {
text-align: center;
flex: 1; /* Allow the details to expand and take available space */
}
img.logo-img {
max-width: 200px;
height: auto;
}
.section {
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 2px solid #000;
}
.section-header {
font-weight: bold;
font-size: 24px;
margin-bottom: 15px;
color: #333;
}
.section-content {
font-size: 16px;
color: #666;
}
</style>
</head>
<body>
<div class="page">
<div class="logo">
<img src="<?= base_url()."public/assets/images/default_logo.png" ?>" height="50" width="50" >
<img src="https://images.rawpixel.com/image_800/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvczkzLXBtLTI3NTcuanBn.jpg" alt="Company Logo" class="logo-img">
</div>
<div class="company-details">
<div class="section-header">Company Details</div>
<div class="section-content">
<!-- Replace this with company details -->
<p><?= $data->title ?></p>
<p><?= $data->address ?></p>
<p><?= $data->postal_code ?></p>
</div>
</div>
</div>
</div>
<div class="section">
<div class="section-header">Donation Receipt</div>
<div class="section-content">
<!-- Replace this with customer details -->
<p>Receipt No: <?=$data->receipt_number?></p>
<p>Donor Name: <?=$data->customer_name?></p>
<p>Amount: <?=$data->amount?></p>
<p>Contact Number: <?=$data->mobile_no?></p>
<p>PAN No: <?=$data->pan_no?></p>
<p>Donation Date: <?=$data->receipt_date?></p>
<!-- Add other customer details here -->
</div>
</div>
<div class="section">
<div class="section-header">Company Contact Details</div>
<div class="section-content">
<!-- Replace this with company contact details -->
<p>Email: contact@company.com</p>
<p>Phone: +9876543210</p>
<!-- Add other contact details here -->
</div>
</div>
</body>
</html>

View File

@ -62,38 +62,6 @@
value="<?= isset($details['site_title']) ? $details['site_title'] : '' ?>" />
</div>
</div>
<!-- <div class="form-row">
<div class="form-group col-md-12">
<label for="site_color" class="col-form-label">Site Color</label>
<input class="form-control" type="color" id="site_color" value="#3bafda">
</div>
</div> -->
<!-- <div class="form-row">
<div class="form-group col-md-6">
<label for="site_info" class="col-form-label">Site Information</label>
<textarea class="form-control" id="site_info" name="site_info"
placeholder="Site Information"><?= isset($details['site_info']) ? $details['site_info'] : '' ?></textarea>
</div>
<div class="form-group col-md-6">
<label for="about_info" class="col-form-label">About Information</label>
<textarea class="form-control" id="about_info" name="about_info"
placeholder="About info"><?= isset($details['about_info']) ? $details['about_info'] : '' ?></textarea>
</div>
</div> -->
<!-- <div class="form-row">
<div class="form-group col-md-6">
<label for="terms_service" class="col-form-label">Terms Service</label>
<textarea class="form-control" id="terms_service" name="terms_service"
placeholder="Terms Service"
rows="5"><?= isset($details['terms_service']) ? $details['terms_service'] : '' ?></textarea>
</div>
<div class="form-group col-md-6">
<label for="footer_about" class="col-form-label">Footer about</label>
<textarea class="form-control" id="footer_about" name="footer_about"
placeholder="Footer about"
rows="5"><?= isset($details['footer_about']) ? $details['footer_about'] : '' ?></textarea>
</div>
</div> -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="admin_email" class="col-form-label">Admin Email</label>
@ -126,7 +94,7 @@
<div class="form-group col-md-6">
<label for="logo" class="col-form-label">Logo Image</label>
<input type="file" class="form-control" style="border: 0px !important; " id="logo"
name="slogo" placeholder="Logo Name" accept=".png, .jpg, .jpeg" onchange="checkFileFormat()"
name="slogo" placeholder="Logo Name" accept=".png, .jpg, .jpeg"
value="<?= isset($details['logo']) ? $details['logo'] : '' ?>" />
</div>
<?php if (!empty($details['logo'])) { ?>
@ -139,7 +107,7 @@
<div class="form-group col-md-6">
<label for="favicon" class="col-form-label">Favicon</label>
<input type="file" class="form-control" style="border: 0px !important; " id="favic"
name="favicon" placeholder="Fav-icon Name" accept=".png, .jpg, .jpeg" onchange="checkFileFormats()"
name="favicon" placeholder="Fav-icon Name" accept=".png, .jpg, .jpeg"
value="<?= isset($details['favicon']) ? $details['favicon'] : '' ?>" />
</div>
<?php if (!empty($details['favicon'])) { ?>

View File

@ -319,21 +319,7 @@
</div>
<div class="col-md-7">
<div class="text-md-right footer-links d-none d-sm-block">
<?php if ((int)$bid == 1) : ?>
<a style="margin-left : 0.45rem !important;font-size: 0.75rem !important;" data-toggle="modal" data-target="#about-us">About Us</a>
<a style="margin-left : 0.45rem !important;font-size: 0.75rem !important;" data-toggle="modal" data-target="#privacy-policy">Privacy Policy</a>
<a style="margin-left : 0.45rem !important;font-size: 0.75rem !important;" data-toggle="modal" data-target="#terms-conditions">Terms & Conditions</a>
<a style="margin-left : 0.45rem !important;font-size: 0.75rem !important;" data-toggle="modal" data-target="#delivery-payments-refunds">Delivery, Payments & Refunds</a>
<a style="margin-left : 0.45rem !important;font-size: 0.75rem !important;" data-toggle="modal" data-target="#contact-us">Contact Us</a>
<?php endif; ?>
<?php if ((int)$bid != 1) : ?>
<a data-toggle="modal" data-target="#about-us">About Us</a>
<a data-toggle="modal" data-target="#contact-us">Contact Us</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
</footer>

View File

@ -15,16 +15,16 @@
</div>
</li>
<li class="dropdown d-none d-lg-inline-block">
<!-- <li class="dropdown d-none d-lg-inline-block">
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="fullscreen" href="#">
<i class="fe-maximize noti-icon"></i>
</a>
</li>
</li> -->
<li class="dropdown d-none d-lg-inline-block topbar-dropdown">
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<!-- <a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<i class="fe-grid noti-icon"></i>
</a>
</a> -->
<div class="dropdown-menu dropdown-lg dropdown-menu-right p-0">
<div class="p-2">
@ -81,12 +81,12 @@
</a>
<?php endif; ?>
<?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<!-- <?php if ($loggedin_person_role !== 'manager' && $loggedin_person_role !== 'sadmin') : ?>
<a href="<?= base_url()."sitesetting_page/".$bid; ?>"class="dropdown-item notify-item">
<i class="ri-briefcase-4-fill"></i><span> Org Setting </span>
</a>
<?php endif; ?>
-->
<a href="<?= base_url()."lock"; ?>" class="dropdown-item notify-item">
<i class="ri-lock-line"></i>
@ -105,11 +105,11 @@
</li>
<li class="dropdown notification-list">
<!-- <li class="dropdown notification-list">
<a href="javascript:void(0);" class="nav-link right-bar-toggle waves-effect waves-light">
<i class="fe-settings noti-icon"></i>
</a>
</li>
</li> -->
</ul>
@ -156,145 +156,6 @@
</a>
<!-- End mobile menu toggle-->
</li>
<li class="dropdown d-none d-xl-block">
<a class="nav-link dropdown-toggle waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
Create New
<i class="mdi mdi-chevron-down"></i>
</a>
<div class="dropdown-menu">
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item">
<i class="fe-briefcase mr-1"></i>
<span>New Projects</span>
</a>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item">
<i class="fe-user mr-1"></i>
<span>Create Users</span>
</a>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item">
<i class="fe-settings mr-1"></i>
<span>Settings</span>
</a>
<div class="dropdown-divider"></div>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item">
<i class="fe-headphones mr-1"></i>
<span>Help & Support</span>
</a>
</div>
</li>
<li class="dropdown dropdown-mega d-none d-xl-block">
<a class="nav-link dropdown-toggle waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
Mega Menu
<i class="mdi mdi-chevron-down"></i>
</a>
<div class="dropdown-menu dropdown-megamenu">
<div class="row">
<div class="col-sm-8">
<div class="row">
<div class="col-md-4">
<h5 class="text-dark mt-0">UI Components</h5>
<ul class="list-unstyled megamenu-list">
<li>
<a href="javascript:void(0);">Widgets</a>
</li>
<li>
<a href="javascript:void(0);">Nestable List</a>
</li>
<li>
<a href="javascript:void(0);">Range Sliders</a>
</li>
<li>
<a href="javascript:void(0);">Masonry Items</a>
</li>
<li>
<a href="javascript:void(0);">Sweet Alerts</a>
</li>
<li>
<a href="javascript:void(0);">Treeview Page</a>
</li>
<li>
<a href="javascript:void(0);">Tour Page</a>
</li>
</ul>
</div>
<div class="col-md-4">
<h5 class="text-dark mt-0">Applications</h5>
<ul class="list-unstyled megamenu-list">
<li>
<a href="javascript:void(0);">eCommerce Pages</a>
</li>
<li>
<a href="javascript:void(0);">CRM Pages</a>
</li>
<li>
<a href="javascript:void(0);">Email</a>
</li>
<li>
<a href="javascript:void(0);">Calendar</a>
</li>
<li>
<a href="javascript:void(0);">Team Contacts</a>
</li>
<li>
<a href="javascript:void(0);">Task Board</a>
</li>
<li>
<a href="javascript:void(0);">Email Templates</a>
</li>
</ul>
</div>
<div class="col-md-4">
<h5 class="text-dark mt-0">Extra Pages</h5>
<ul class="list-unstyled megamenu-list">
<li>
<a href="javascript:void(0);">Left Sidebar with User</a>
</li>
<li>
<a href="javascript:void(0);">Menu Collapsed</a>
</li>
<li>
<a href="javascript:void(0);">Small Left Sidebar</a>
</li>
<li>
<a href="javascript:void(0);">New Header Style</a>
</li>
<li>
<a href="javascript:void(0);">Search Result</a>
</li>
<li>
<a href="javascript:void(0);">Gallery Pages</a>
</li>
<li>
<a href="javascript:void(0);">Maintenance & Coming Soon</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="text-center mt-3">
<h3 class="text-dark">Special Discount Sale!</h3>
<h4>Save up to 70% off.</h4>
<button class="btn btn-primary btn-rounded mt-3">Download Now</button>
</div>
</div>
</div>
</div>
</li>
</ul>
<div class="clearfix"></div>
</div>

View File

@ -44,7 +44,7 @@
&emsp; Please, write text here!.";
} ?>
</textarea>
<span class="help-block"><small>Keywords are {USER_NAME},{SCHEME_NAME},{EXPIRY_DATE}</small></span>
<span class="help-block"><small>Keywords are {USER_NAME},{SCHEME_NAME},{EXPIRY_DATE},{donor_name}','{currency_amount}','{cause_name}','{receipt_name}','{receipt_date}','{bisuness_name}</small></span>
</div>
<div class="invalid-feedback"> Please provide. </div>
@ -58,7 +58,7 @@
else{ echo "Sample Template : \n Hello {USER_NAME}, \n\t\t Please, write text here!.";
} ?>
</textarea>
<span class="help-block"><small>Keywords are {USER_NAME},{SCHEME_NAME},{EXPIRY_DATE}</small></span>
<span class="help-block"><small>Keywords are {USER_NAME},{SCHEME_NAME},{EXPIRY_DATE},{donor_name}','{currency_amount}','{cause_name}','{receipt_name}','{receipt_date}','{bisuness_name}</small></span>
</div>
<div class="invalid-feedback"> Please provide. </div>
</div>

View File

@ -1,281 +1,239 @@
<div class="row">
<div class="col-lg-12">
<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; ?> -->
<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">
<?php if ($loggedin_person_role === 'sadmin') { ?>
<div class="form-group col-md-3">
<label for="business_id" class="col-form-label">Organization<span class="text-danger">*</span></label>
<select id="business_id" name="business_id" class="form-control" required>
<?php foreach ($business_details as $business) { ?>
<option value="<?= $business['business_id']; ?>" <?= isset($details['business_id']) && ($details['business_id'] == $business['business_id']) ? 'selected' : '' ?>>
<?= $business['title']; ?>
</option>
<?php } ?>
</select>
<div class="col-lg-12">
<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; ?> -->
<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 />
</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>
</div>
<div class="form-group col-md-4">
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
<select id="role" name="role" class="form-control" required>
<option value="">Select Role</option>
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
<option value="manager" <?= isset($details['role']) && $details['role'] === 'manager' ? 'selected' : '' ?>>Manager</option>
<option value="accounts" <?= isset($details['role']) && $details['role'] === 'accounts' ? 'selected' : '' ?>>Accounts Staff</option>
<option value="auditor" <?= isset($details['role']) && $details['role'] === 'auditor' ? 'selected' : '' ?>>Auditor</option>
</select>
</div>
</div>
<div class="form-row">
<?php if ($loggedin_person_role === 'sadmin') { ?>
<div class="form-group col-md-3">
<label for="business_id" class="col-form-label">Organization<span class="text-danger">*</span></label>
<select id="business_id" name="business_id" class="form-control" required>
<?php foreach ($business_details as $business) { ?>
<option value="<?= $business['business_id']; ?>" <?= isset($details['business_id']) && ($details['business_id'] == $business['business_id']) ? 'selected' : '' ?>>
<?= $business['title']; ?>
</option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label for="F" class="col-form-label">Organization Branches<span class="text-danger">*</span></label>
<select id="branch_id" name="branch_id" class="form-control" required>
<?php if (!empty($branches)) { ?>
<?php foreach ($branches as $branch) { ?>
<option value="<?= $branch['id']; ?>" <?= isset($details['branch_id']) && ($details['branch_id'] == $branch['id']) ? 'selected' : '' ?>>
<?= $branch['branch_name']; ?>
</option>
<?php } ?>
<?php } else { ?>
<option value="">No branches available</option>
<?php } ?>
</select>
</div>
<?php } ?>
<div class="form-group col-md-3">
<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">
<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>
<?php } ?>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="address" class="col-form-label">Address<span class="text-danger"></span></label>
<input type="text" class="form-control" id="address" name="address" placeholder="Address (eg : 1234 Main St)" value="<?= isset($details['address']) ? $details['address'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="city" class="col-form-label">City<span class="text-danger"></span></label>
<input type="text" class="form-control" id="city" name="city" placeholder="City" value="<?= isset($details['city']) ? $details['city'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="state" class="col-form-label">State<span class="text-danger"></span></label>
<input type="text" class="form-control" id="state" name="state" placeholder="State" value="<?= isset($details['state']) ? $details['state'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<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">
<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)" />
<div id="error_message" style="color: red;"></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>
<select id="branch" name="branch" class="form-control">
<option value="">Select Branch</option>
<?php
// Check if branches are available
if (!empty($branches)) {
foreach ($branches as $branch) {
?>
<option data-business-id="<?= $branch['business_id']; ?>" value="<?= $branch['id']; ?>" <?= isset($details['branch_id']) && ($details['branch_id'] == $branch['id']) ? 'selected' : '' ?>>
<?= $branch['branch_name']; ?>
</option>
<?php
}
}
?>
</select>
</div>
<?php endif; ?>
<?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> -->
<input type="hidden" id="existing_profile_picture_name" name="existing_profile_picture_name" placeholder="hidden Field for profile picture name" readonly value="<?= $details['profile_picture']; ?>" />
</div>
</div>
</div>
<?php } ?>
</div>
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
<?php if (!empty($details) && $loggedin_person_role !== 'manager') { ?>
<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 } ?>
<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>
<?php if ($loggedin_person_role !== 'manager') : ?>
<a href="<?= base_url() . "user_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
<?php endif; ?>
</div>
</div>
</form>
</div>
<!-- end card-body-->
</div>
<!-- end card-->
</div>
<!-- end col-->
</div>
<div class="form-group col-md-3">
<label for="F" class="col-form-label">Organization Branches<span class="text-danger">*</span></label>
<select id="branch_id" name="branch_id" class="form-control" required>
<?php if (!empty($branches)) { ?>
<?php foreach ($branches as $branch) { ?>
<option value="<?= $branch['id']; ?>" <?= isset($details['branch_id']) && ($details['branch_id'] == $branch['id']) ? 'selected' : '' ?>>
<?= $branch['branch_name']; ?>
</option>
<?php } ?>
<?php } else { ?>
<option value="">No branches available</option>
<?php } ?>
</select>
</div>
<?php } ?>
<div class="form-group col-md-3">
<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">
<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>
<?php } ?>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="first_name" class="col-form-label">First 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 />
</div>
<div class="form-group col-md-6">
<label for="last_name" class="col-form-label">Last Name<span class="text-danger"></span></label>
<input data-parsley-type="alphanum" type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name" value="<?= isset($details['last_name']) ? $details['last_name'] : '' ?>" />
</div>
<!-- <div class="form-group col-md-4">
<label for="date_of_birth" class="col-form-label">Date Of Birth<span class="text-danger">*</span></label>
<input type="date" class="form-control" id="date_of_birth" name="date_of_birth" placeholder="Date Of birth (format : DD/MM/YYYY)" data-toggle="input-mask" data-mask-format="00/00/0000" required />
</div> -->
</div>
<div class="form-row">
<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>
</div>
<div class="form-group col-md-4">
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
<select id="role" name="role" class="form-control" required>
<option value="">Select Role</option>
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
<option value="manager" <?= isset($details['role']) && $details['role'] === 'manager' ? 'selected' : '' ?>>Manager</option>
<option value="accounts" <?= isset($details['role']) && $details['role'] === 'accounts' ? 'selected' : '' ?>>Accounts Staff</option>
<option value="auditor" <?= isset($details['role']) && $details['role'] === 'auditor' ? 'selected' : '' ?>>Auditor</option>
</select>
</div>
<div class="form-group col-md-4">
<label for="gender" class="col-form-label">Gender<span class="text-danger"></span></label>
<select id="gender" name="gender" class="form-control">
<option value="">Select Gender</option>
<option value="male" <?= isset($details['gender']) && $details['gender'] === 'male' ? 'selected' : '' ?>>Male</option>
<option value="female" <?= isset($details['gender']) && $details['gender'] === 'female' ? 'selected' : '' ?>>Female</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="address" class="col-form-label">Address<span class="text-danger"></span></label>
<input type="text" class="form-control" id="address" name="address" placeholder="Address (eg : 1234 Main St)" value="<?= isset($details['address']) ? $details['address'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="city" class="col-form-label">City<span class="text-danger"></span></label>
<input type="text" class="form-control" id="city" name="city" placeholder="City" value="<?= isset($details['city']) ? $details['city'] : '' ?>" />
</div>
<div class="form-group col-md-4">
<label for="state" class="col-form-label">State<span class="text-danger"></span></label>
<input type="text" class="form-control" id="state" name="state" placeholder="State" value="<?= isset($details['state']) ? $details['state'] : '' ?>" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<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">
<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)" />
<div id="error_message" style="color: red;"></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>
<select id="branch" name="branch" class="form-control">
<option value="">Select Branch</option>
<?php
// Check if branches are available
if (!empty($branches)) {
foreach ($branches as $branch) {
?>
<option data-business-id="<?= $branch['business_id']; ?>" value="<?= $branch['id']; ?>" <?= isset($details['branch_id']) && ($details['branch_id'] == $branch['id']) ? 'selected' : '' ?>>
<?= $branch['branch_name']; ?>
</option>
<?php
}
}
?>
</select>
</div>
<?php endif; ?>
<?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> -->
<input type="hidden" id="existing_profile_picture_name" name="existing_profile_picture_name" placeholder="hidden Field for profile picture name" readonly value="<?= $details['profile_picture']; ?>" />
</div>
</div>
</div>
<?php } ?>
</div>
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
<?php if (!empty($details) && $loggedin_person_role !== 'manager') { ?>
<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 } ?>
<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>
<?php if ($loggedin_person_role !== 'manager') : ?>
<a href="<?= base_url() . "user_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
<?php endif; ?>
</div>
</div>
</form>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
</div><!-- end row -->
<!-- end row -->
<script>
$(function() {
role = "<?php echo get_user_role() ?>";
console.log(role);
if(role == "auditor")
{
// for input
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
formElements.forEach(function(element) {
element.setAttribute('readonly', true);
});
// for select
var formElements = document.querySelectorAll('#myForm select, #myForm button');
formElements.forEach(function(element) {
element.setAttribute('disabled', true);
});
}
});
</script>
<script>
// Get the current date in "yyyy-mm-dd" format
function getCurrentDate() {
const today = new Date();
const year = today.getFullYear();
let month = today.getMonth() + 1;
let day = today.getDate();
// Add leading zeros if month or day is less than 10
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
return `${year}-${month}-${day}`;
}
// Set the max attribute of the date input field to the current date
document.getElementById('date_of_birth').setAttribute('max', getCurrentDate());
// Set the min attribute of the date input field to "1965-01-01"
document.getElementById('date_of_birth').setAttribute('min', '1965-01-01');
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
}
}
}
$(function() {
role = "<?php echo get_user_role() ?>";
console.log(role);
if(role == "auditor")
{
// for input
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
formElements.forEach(function(element) {
element.setAttribute('readonly', true);
});
// for select
var formElements = document.querySelectorAll('#myForm select, #myForm button');
formElements.forEach(function(element) {
element.setAttribute('disabled', true);
});
}
});
</script>
<script>
document.getElementById('myForm').addEventListener('submit', function(event) {
var form = event.target;
if (form.checkValidity() === false) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
$('#submitBtn').prop('disabled', false);
} else {
$('#submitBtn').prop('disabled', true);
}
});
// Get the current date in "yyyy-mm-dd" format
function getCurrentDate() {
const today = new Date();
const year = today.getFullYear();
let month = today.getMonth() + 1;
let day = today.getDate();
// Add leading zeros if month or day is less than 10
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
return `${year}-${month}-${day}`;
}
// Set the max attribute of the date input field to the current date
document.getElementById('date_of_birth').setAttribute('max', getCurrentDate());
// Set the min attribute of the date input field to "1965-01-01"
document.getElementById('date_of_birth').setAttribute('min', '1965-01-01');
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>
document.getElementById('myForm').addEventListener('submit', function(event) {
var form = event.target;
if (form.checkValidity() === false) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
$('#submitBtn').prop('disabled', false);
} else {
$('#submitBtn').prop('disabled', true);
}
});
</script>
<script>
$(document).ready(function () {
// Function to fetch branches based on selected organization
function fetchBranches(selectedBusinessId) {
var businessBranchDropdown = $('#branch_id');
// Clear existing options
businessBranchDropdown.empty().append('<option value="">Choose Organization Branch</option>');
// Fetch branches via AJAX
$.ajax({
url: '<?= base_url('users/get_branches') ?>/' + selectedBusinessId,
@ -283,13 +241,13 @@
dataType: 'json',
success: function (response) {
console.log('Response from server:', response); // Log the response for debugging
if (response && response.length > 0) {
console.log('Number of branches:', response.length); // Log the number of branches
$.each(response, function (index, branch) {
console.log('Appending option:', branch); // Log each branch before appending
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
businessBranchDropdown.append(option);
});
@ -303,99 +261,95 @@
}
});
}
// Change event handler for the organization dropdown
$('#business_id').change(function () {
var selectedBusinessId = $(this).val();
console.log('Selected Business ID:', selectedBusinessId); // Log the selected business ID
// Call the function to fetch branches
if (selectedBusinessId) {
fetchBranches(selectedBusinessId);
}
});
// Trigger the change event if the organization is pre-selected (e.g., during edit)
var preSelectedBusinessId = $('#business_id').val();
if (preSelectedBusinessId) {
fetchBranches(preSelectedBusinessId);
}
});
});
</script>
<script>
// JavaScript to show/hide branches based on selected business
$(document).ready(function () {
var branchDropdown = $('#branch');
var branches = <?= json_encode($branches); ?>; // Assuming $branches is available
// Initial branches
var initialBranches = branches.filter(branch => branch.business_id == '<?= $session_bid ?? '' ?>');
// Populate the dropdown with initial branches
populateBranchDropdown(initialBranches);
// Change event handler for the business dropdown
$('#business_id').change(function () {
var selectedBusinessId = $(this).val();
// Filter branches based on selected business
var filteredBranches = branches.filter(branch => branch.business_id == selectedBusinessId);
// Populate the dropdown with filtered branches
populateBranchDropdown(filteredBranches);
});
// Function to populate the branch dropdown
function populateBranchDropdown(branchesToDisplay) {
branchDropdown.empty().append('<option value="">Select Branch</option>');
if (branchesToDisplay.length > 0) {
branchesToDisplay.forEach(branch => {
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
branchDropdown.append(option);
});
}
}
});
// JavaScript to show/hide branches based on selected business
$(document).ready(function () {
var branchDropdown = $('#branch');
var branches = <?= json_encode($branches); ?>; // Assuming $branches is available
// Initial branches
var initialBranches = branches.filter(branch => branch.business_id == '<?= $session_bid ?? '' ?>');
// Populate the dropdown with initial branches
populateBranchDropdown(initialBranches);
// Change event handler for the business dropdown
$('#business_id').change(function () {
var selectedBusinessId = $(this).val();
// Filter branches based on selected business
var filteredBranches = branches.filter(branch => branch.business_id == selectedBusinessId);
// Populate the dropdown with filtered branches
populateBranchDropdown(filteredBranches);
});
// Function to populate the branch dropdown
function populateBranchDropdown(branchesToDisplay) {
branchDropdown.empty().append('<option value="">Select Branch</option>');
if (branchesToDisplay.length > 0) {
branchesToDisplay.forEach(branch => {
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
branchDropdown.append(option);
});
}
}
});
</script>
<!-- <script>
// JavaScript to show/hide branches based on selected business
$(document).ready(function () {
var branchDropdown = $('#branch');
var branches = <?= json_encode($branches); ?>; // Assuming $branches is available
// Initial branches
var initialBranches = branches.filter(branch => branch.business_id == '<?= $details['business_id'] ?? '' ?>');
// Populate the dropdown with initial branches
populateBranchDropdown(initialBranches);
// Change event handler for the business dropdown
$('#business_id').change(function () {
var selectedBusinessId = $(this).val();
// Filter branches based on selected business
var filteredBranches = branches.filter(branch => branch.business_id == selectedBusinessId);
// Populate the dropdown with filtered branches
populateBranchDropdown(filteredBranches);
});
// Function to populate the branch dropdown
function populateBranchDropdown(branchesToDisplay) {
branchDropdown.empty().append('<option value="">Select Branch</option>');
if (branchesToDisplay.length > 0) {
branchesToDisplay.forEach(branch => {
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
branchDropdown.append(option);
});
}
}
});
</script> -
// JavaScript to show/hide branches based on selected business
$(document).ready(function () {
var branchDropdown = $('#branch');
var branches = <?= json_encode($branches); ?>; // Assuming $branches is available
// Initial branches
var initialBranches = branches.filter(branch => branch.business_id == '<?= $details['business_id'] ?? '' ?>');
// Populate the dropdown with initial branches
populateBranchDropdown(initialBranches);
// Change event handler for the business dropdown
$('#business_id').change(function () {
var selectedBusinessId = $(this).val();
// Filter branches based on selected business
var filteredBranches = branches.filter(branch => branch.business_id == selectedBusinessId);
// Populate the dropdown with filtered branches
populateBranchDropdown(filteredBranches);
});
// Function to populate the branch dropdown
function populateBranchDropdown(branchesToDisplay) {
branchDropdown.empty().append('<option value="">Select Branch</option>');
if (branchesToDisplay.length > 0) {
branchesToDisplay.forEach(branch => {
var option = $('<option></option>').attr('value', branch.id).text(branch.branch_name);
branchDropdown.append(option);
});
}
}
});
</script> -