User , buiness , Recepit Fixes : ps
This commit is contained in:
parent
7cdda4a7ef
commit
5f6573b4d8
@ -49,7 +49,7 @@ $routes->get('dashboard/', 'Home::index');
|
||||
|
||||
# Users Routes
|
||||
$routes->get("user_list/", "Users::index");
|
||||
$routes->get("user_page/(:any)", "Users::user_page/$1");
|
||||
$routes->get("user_page/(:any)/(:any)", "Users::user_page/$1/$2");
|
||||
$routes->post("insert_users", "Users::insert_users");
|
||||
$routes->get("delete_user/(:any)", "Users::delete_user/$1");
|
||||
$routes->get("activateUser/(:any)", "Users::activateUser/$1");
|
||||
@ -70,7 +70,7 @@ $routes->get("delete_sitesetting/(:any)", "Books::delete_sitesetting/$1");
|
||||
|
||||
# App Site-Setting Routes(SuperAdmin)
|
||||
// $routes->get("appsetting/", "AppSettings::index");
|
||||
$routes->get("appsetting_page/(:any)", "AppSettings::appsetting_page/$1");
|
||||
$routes->get("appsetting_page", "AppSettings::appsetting_page");
|
||||
$routes->post("appsetting_synchronization", "AppSettings::appsetting_synchronization");
|
||||
// $routes->get("delete_sitesetting/(:any)", "Books::delete_sitesetting/$1");
|
||||
|
||||
@ -88,14 +88,15 @@ $routes->get('Customer/getReceiptDetails/(:num)', 'Customer::getReceiptDetails/$
|
||||
|
||||
|
||||
$routes->post("insert_donor", "Customer::insert_donor");
|
||||
$routes->post("insert_ajaxdonor", "Customer::insert_ajaxdonor");
|
||||
$routes->get("delete_donor/(:any)", "Customer::delete_donor/$1");
|
||||
|
||||
#Routes for donor group
|
||||
$routes->get('donor_group/', 'Customer::donor_group');
|
||||
$routes->get('view_donor_group/(:any)', 'Customer::view_donor_group/$1');
|
||||
$routes->get('preview_donor_group/(:any)', 'Customer::preview_donor_group/$1');
|
||||
$routes->get('delete_donor_group/(:any)', 'Customer::delete_donor_group/$1');
|
||||
$routes->post("insert_donor_group", "Customer::insert_donor_group");
|
||||
#Routes for donor group (renamed as contributor group : 20/03/2024)
|
||||
$routes->get('contributor_group/', 'Customer::donor_group');
|
||||
$routes->get('view_contributor_group/(:any)', 'Customer::view_donor_group/$1');
|
||||
$routes->get('preview_contributor_group/(:any)', 'Customer::preview_donor_group/$1');
|
||||
$routes->get('delete_contributor_group/(:any)', 'Customer::delete_donor_group/$1');
|
||||
$routes->post("insert_contributor_group", "Customer::insert_donor_group");
|
||||
|
||||
|
||||
|
||||
@ -124,10 +125,8 @@ $routes->get('generate-pdf/(:num)', 'Invoice::generatePdf/$1');
|
||||
|
||||
$routes->get('Invoice/showInvoiceModal', 'Invoice::showInvoiceModal');
|
||||
|
||||
$routes->post("load_details1/", "Invoice::load_details1/");
|
||||
$routes->post("load_details2/", "Invoice::load_details2/");
|
||||
$routes->post("get_donor_details", "Invoice::get_donor_details");
|
||||
$routes->post("save_invoice/", "Invoice::save_invoice/");
|
||||
$routes->get("delete_invoice/(:any)", "Invoice::delete_invoice/$1");
|
||||
$routes->add('approve_invoice/(:num)', 'Invoice::approve_invoice/$1');
|
||||
$routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1');
|
||||
$routes->get('print_address/(:num)', 'Invoice::print_address/$1');
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\BusinessModel;
|
||||
use App\Models\SettingsModel;
|
||||
|
||||
class Business extends BaseController
|
||||
{
|
||||
@ -32,7 +31,7 @@ class Business extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
## To Load Business Form (Add/Update)
|
||||
## For Organization Form (Add/Update)
|
||||
public function new_org($id)
|
||||
{
|
||||
helper('session');
|
||||
@ -46,44 +45,29 @@ class Business extends BaseController
|
||||
$data['businesses'] = [];
|
||||
$data['branches'] = [];
|
||||
$data['donation']=[];
|
||||
// -----------
|
||||
$data['details'] = [];
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Organization';
|
||||
$data['loged_user'] = $session_role;
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business');
|
||||
|
||||
// Fetch business details
|
||||
$edit_user_details = $model->where(['business_id ' => $id])->first();
|
||||
$data['businesses'] = $edit_user_details;
|
||||
## Fetch business details (particular business)
|
||||
$edit_business_details = $model->where(['business_id ' => $id , 'isactive' => 1])->first();
|
||||
$data['businesses'] = $edit_business_details;
|
||||
|
||||
## Fetch branch details
|
||||
$branch_details = $model->getBranchesByBusinessId($id);
|
||||
$data['branches'] = $branch_details;
|
||||
|
||||
## Fetch donation details
|
||||
if ($session_role !== 'sadmin') {
|
||||
|
||||
$donationaccepted=$model->getDonationBusinessData($id);
|
||||
$data['donation']=$donationaccepted;
|
||||
// dd($data['donation']);die;
|
||||
$donation_accepted=$model->getDonationBusinessData($id);
|
||||
$data['donation']=$donation_accepted;
|
||||
}
|
||||
// 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();
|
||||
// print_r($session_bid);die;
|
||||
}
|
||||
// echo json_decode($details);die;
|
||||
$data['details'] = $details;
|
||||
// echo json_encode($data);die;
|
||||
|
||||
|
||||
}
|
||||
$data['business_details']=$this->business_details();
|
||||
|
||||
$data['master_business_details']=$this->business_details();
|
||||
$data['session_bid']=$session_bid;
|
||||
$this->render_page('business_form', $data);
|
||||
}
|
||||
@ -109,233 +93,182 @@ class Business extends BaseController
|
||||
|
||||
|
||||
## For inserting/updating details of business
|
||||
public function insert_org()
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_role = get_user_role();
|
||||
public function insert_org()
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_role = get_user_role();
|
||||
|
||||
$img = $this->request->getFile('slogo');
|
||||
$filePath = 'public/uploads/' . $this->request->getPost('slogo');
|
||||
$fileName = $img->getName();
|
||||
|
||||
if ($fileName !== "") {
|
||||
if ($img->isValid() && !$img->hasMoved()) {
|
||||
$img->move(ROOTPATH . 'public/uploads', $fileName);
|
||||
## logo
|
||||
$img = $this->request->getFile('business_logo');
|
||||
$filePath = 'public/uploads/' . $this->request->getPost('business_logo');
|
||||
$fileName = $img->getName();
|
||||
if ($fileName !== "") {
|
||||
if ($img->isValid() && !$img->hasMoved()) {
|
||||
$img->move(ROOTPATH . 'public/uploads', $fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sign = $this->request->getFile('signature');
|
||||
$signFileName = $sign->getName();
|
||||
|
||||
if ($signFileName !== "") {
|
||||
if ($sign->isValid() && !$sign->hasMoved()) {
|
||||
$sign->move(ROOTPATH . 'public/uploads', $signFileName);
|
||||
## favicon
|
||||
$favicon = $this->request->getFile('favicon');
|
||||
$faviconFileName = $favicon->getName();
|
||||
if ($faviconFileName !== "") {
|
||||
if ($favicon->isValid() && !$favicon->hasMoved()) {
|
||||
$favicon->move(ROOTPATH . 'public/uploads', $faviconFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$BusinessModel = new BusinessModel();
|
||||
$data = [
|
||||
'title' => $this->request->getPost('bname'),
|
||||
'email' => $this->request->getPost('bmail'),
|
||||
'mobile_no' => $this->request->getPost('bmobile'),
|
||||
'address' => $this->request->getPost('baddress'),
|
||||
'city' => $this->request->getPost('bcity'),
|
||||
'state' => $this->request->getPost('bstate'),
|
||||
'postal_code' => $this->request->getPost('bzip'),
|
||||
'pan_no' => $this->request->getPost('pan_no'),
|
||||
'org_reg_no' => $this->request->getPost('org_reg_no'),
|
||||
'terms' => $this->request->getPost('bterms'),
|
||||
'80G' => $this->request->getPost('80G'),
|
||||
];
|
||||
## signature
|
||||
$sign = $this->request->getFile('signature');
|
||||
$signFileName = $sign->getName();
|
||||
if ($signFileName !== "") {
|
||||
if ($sign->isValid() && !$sign->hasMoved()) {
|
||||
$sign->move(ROOTPATH . 'public/uploads', $signFileName);
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileName !== "") {
|
||||
$data['business_logo'] = $fileName;
|
||||
}
|
||||
if ($signFileName !== "") {
|
||||
$data['signature'] = $signFileName;
|
||||
}
|
||||
|
||||
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
|
||||
|
||||
if (empty($business_id)) {
|
||||
// It's an insert operation
|
||||
$data['isactive'] = 1;
|
||||
$data['created_by'] = $session_uid;
|
||||
$businessId = $BusinessModel->insert($data);
|
||||
$BusinessModel->insertDonationBusiness($businessId);
|
||||
// $this->insert_branch($businessId);
|
||||
} else {
|
||||
// It's an update operation
|
||||
if ($session_role === 'sadmin') {
|
||||
|
||||
$data['isactive'] = 1;
|
||||
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BusinessModel->update($business_id, $data);
|
||||
$businessId = $business_id;
|
||||
$selectedDonations = $this->request->getPost('name');
|
||||
$BusinessModel->updateDonationData($businessId, $selectedDonations);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ... existing code ...
|
||||
|
||||
if (!empty($_POST['branchname'])) {
|
||||
$branchNames = $_POST['branchname'];
|
||||
$branchMobile = $_POST['mobile_no'];
|
||||
$branchMail = $_POST['email'];
|
||||
$branchAddress = $_POST['branchaddress'];
|
||||
$branchIds = isset($_POST['id']) ? $_POST['id'] : [];
|
||||
|
||||
foreach ($branchNames as $key => $branchName) {
|
||||
$branchId = isset($branchIds[$key]) ? $branchIds[$key] : null;
|
||||
|
||||
$branchData = [
|
||||
'business_id' => $businessId,
|
||||
'branch_name' => $branchName,
|
||||
'mobile_no' => $branchMobile[$key],
|
||||
'email' => $branchMail[$key],
|
||||
'address' => $branchAddress[$key],
|
||||
## Business Data
|
||||
$BusinessModel = new BusinessModel();
|
||||
$data = [
|
||||
'title' => $this->request->getPost('bname'),
|
||||
'email' => $this->request->getPost('bmail'),
|
||||
'mobile_no' => $this->request->getPost('bmobile'),
|
||||
'address' => $this->request->getPost('baddress'),
|
||||
'city' => $this->request->getPost('bcity'),
|
||||
'state' => $this->request->getPost('bstate'),
|
||||
'postal_code' => $this->request->getPost('bzip'),
|
||||
'pan_no' => $this->request->getPost('pan_no'),
|
||||
'org_reg_no' => $this->request->getPost('org_reg_no'),
|
||||
'terms' => $this->request->getPost('bterms'),
|
||||
'80G' => $this->request->getPost('80G'),
|
||||
'site_name' => $this->request->getPost('site_name'),
|
||||
'site_title' => $this->request->getPost('site_title'),
|
||||
'admin_email' => $this->request->getPost('admin_email'),
|
||||
'site_mobile'=> $this->request->getPost('site_mobile'),
|
||||
'copyright'=> $this->request->getPost('copyright'),
|
||||
'currency'=> $this->request->getPost('currency'),
|
||||
'country'=> $this->request->getPost('country'),
|
||||
'start_no'=> $this->request->getPost('start_no'),
|
||||
'left_pad'=> $this->request->getPost('left_pad'),
|
||||
'prefix_format'=> $this->request->getPost('prefix_format'),
|
||||
];
|
||||
|
||||
if (!empty($branchId)) {
|
||||
// Update the existing branch
|
||||
$db = \Config\Database::connect();
|
||||
$db->table('business_branches')
|
||||
->where('id', $branchId)
|
||||
->update($branchData);
|
||||
if ($fileName !== "") {
|
||||
$data['business_logo'] = $fileName;
|
||||
}
|
||||
if ($faviconFileName !== "") {
|
||||
$data['favicon'] = $faviconFileName;
|
||||
}
|
||||
if ($signFileName !== "") {
|
||||
$data['signature'] = $signFileName;
|
||||
}
|
||||
|
||||
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
|
||||
|
||||
if (empty($business_id)) {
|
||||
// It's an insert operation
|
||||
$data['created_by'] = $session_uid;
|
||||
$businessId = $BusinessModel->insert($data);
|
||||
} else {
|
||||
// Insert new branch
|
||||
$db = \Config\Database::connect();
|
||||
$db->table('business_branches')->insert($branchData);
|
||||
// It's an update operation
|
||||
$businessId = $business_id;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BusinessModel->update($business_id, $data);
|
||||
}
|
||||
|
||||
## Donation Business Data (Note: not a super-admin means)
|
||||
if ($session_role !== 'sadmin') {
|
||||
if (empty($business_id)) {
|
||||
$BusinessModel->insertDonationBusiness($businessId);
|
||||
}else{
|
||||
$selectedDonations = $this->request->getPost('name');
|
||||
$BusinessModel->updateDonationData($businessId, $selectedDonations);
|
||||
}
|
||||
}
|
||||
|
||||
## Buiness Branch Data
|
||||
if(!empty($_POST['branch_name'])){
|
||||
$requestData = $this->request->getPost();
|
||||
$bb_result = $this->save_business_branch($requestData, $businessId);
|
||||
$this->logger->info("business branch: final message = " .implode(" ",$bb_result));
|
||||
}
|
||||
|
||||
if ($session_role === 'sadmin') {
|
||||
session()->setFlashdata('success', 'organization details has been updated successfully.');
|
||||
return redirect()->route('org_list');
|
||||
}else{
|
||||
session()->setFlashdata('success', 'organization details has been updated successfully.');
|
||||
return redirect()->to(base_url("new_org/{$business_id}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//SITE SETTINGS
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_role = get_user_role();
|
||||
public function save_business_branch($requestData, $bid)
|
||||
{
|
||||
try {
|
||||
|
||||
$getBuinessBranchdetails = $this->get_business_branch($bid);
|
||||
|
||||
|
||||
$BBprimaryid = $requestData['id'] ; // Available Buiness Branch Primary IDS in Form Fields.
|
||||
|
||||
|
||||
$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();
|
||||
$model = new BusinessModel();
|
||||
|
||||
if($fileName !== ""){
|
||||
## IF Any Missing value Means that values are Inactive here....
|
||||
if(!empty($BBprimaryid)){
|
||||
$this->logger->info("BuinessBranch: Primary ID = ".implode(",",$BBprimaryid));
|
||||
$filteringIds = [];
|
||||
for ($y = 0; $y < count($getBuinessBranchdetails); $y++) {
|
||||
$filteringIds[$y] = $getBuinessBranchdetails[$y]['id'];
|
||||
}
|
||||
|
||||
if ($img->isValid() && !$img->hasMoved()) {
|
||||
|
||||
if (!empty($filteringIds)) {
|
||||
$A = $filteringIds;
|
||||
$B = $BBprimaryid;
|
||||
$missingValues = array_diff($A, $B);
|
||||
if (!empty($missingValues)) {
|
||||
$where = ['isactive' => 1, 'business_id'=>$bid];
|
||||
$model->inactiveMissingBuinessBranchDetails($where, $missingValues);
|
||||
echo
|
||||
$this->logger->info("BuinessBranch: Inactived Missing Count = " . count($missingValues)." That Primary ID = ".implode(",",$BBprimaryid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$img->move(ROOTPATH . 'public/uploads', $fileName);
|
||||
|
||||
$count = count($BBprimaryid);
|
||||
|
||||
$branchData = [];
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
$branchData[$x]['id'] = $requestData['id'][$x];
|
||||
$branchData[$x]['branch_name'] = $requestData['branch_name'][$x];
|
||||
$branchData[$x]['business_id'] = $bid;
|
||||
$branchData[$x]['email'] = $requestData['email'][$x];
|
||||
$branchData[$x]['mobile_no'] = $requestData['mobile_no'][$x];
|
||||
$branchData[$x]['address'] = $requestData['branchaddress'][$x];
|
||||
}
|
||||
|
||||
$statement = !empty($branchData) ? $model->saveBuinessBranchDetails($branchData) : ["No data found For buisness branch"];
|
||||
$this->logger->info("BuinessBranch: Final message = " . implode(",",$statement));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("BuinessBranch: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
$statement = ['Message: ' . $e->getMessage()];
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$favicon = $this->request->getFile('favicon');
|
||||
$faviconName = $favicon->getName();
|
||||
|
||||
if($faviconName !== ""){
|
||||
|
||||
if ($favicon->isValid() && !$favicon->hasMoved()) {
|
||||
|
||||
$favicon->move(ROOTPATH . 'public/uploads', $faviconName);
|
||||
public function get_business_branch($bid){
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business_branches');
|
||||
$where = ['business_id'=> (int)$bid , 'isactive' => 1];
|
||||
$details = $model->where($where)->findAll();
|
||||
return $details;
|
||||
}
|
||||
}
|
||||
|
||||
$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 ...
|
||||
|
||||
// Redirect based on user role
|
||||
// ... existing code ...
|
||||
|
||||
// Redirect based on user role
|
||||
if ($session_role === 'sadmin') {
|
||||
return redirect()->route('org_list');
|
||||
}
|
||||
|
||||
|
||||
// Redirect based on user role
|
||||
if ($session_role !== 'sadmin') {
|
||||
|
||||
session()->setFlashdata('success', 'User has been updated successfully.');
|
||||
// Assuming 'index' is the route name for your index page
|
||||
return redirect()->to(base_url("new_org/{$business_id}"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
## For delete the business details (Which means inactive the details)
|
||||
## For delete the business details (Which means inactive the details)
|
||||
public function delete_org($id)
|
||||
{
|
||||
helper('session');
|
||||
@ -357,7 +290,8 @@ if ($session_role !== 'sadmin') {
|
||||
}
|
||||
public function insertDonationBusiness($businessId)
|
||||
{
|
||||
$donationData = $this->db->table('donation_accepted')
|
||||
$db = \Config\Database::connect();
|
||||
$donationData = $db->table('donation_accepted')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
@ -368,7 +302,7 @@ if ($session_role !== 'sadmin') {
|
||||
}
|
||||
|
||||
// Insert data into donation_business table
|
||||
$this->db->table('donation_business')->insertBatch($donationData);
|
||||
$db->table('donation_business')->insertBatch($donationData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,40 @@ class Customer extends BaseController
|
||||
}
|
||||
|
||||
|
||||
## For inserting/updating details of customer
|
||||
|
||||
public function insert_ajaxdonor(){
|
||||
|
||||
helper('session');
|
||||
$model = new CustomerModel();
|
||||
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$pan = ($this->request->getPost('pan_no') == '') ? $this->request->getPost('o_pan_no') : $this->request->getPost('pan_no');
|
||||
|
||||
$data = [
|
||||
'first_name' => $this->request->getPost('cfname'),
|
||||
'mobile_no' => $this->request->getPost('mobile'),
|
||||
'email' => $this->request->getPost('cmail'),
|
||||
'pan_no' => $pan,
|
||||
'donor_type' => $this->request->getPost('DonorType'),
|
||||
'org_name' => $this->request->getPost('org_name') !== '' || $this->request->getPost('org_name') !== null ? $this->request->getPost('org_name') : NULL,
|
||||
'org_reg_details'=> $this->request->getPost('org_reg_Details'),
|
||||
'business_id' => $session_bid,
|
||||
'isactive' => 1,
|
||||
'created_by' => $session_uid
|
||||
];
|
||||
|
||||
if ($model->insert($data)) {
|
||||
$results = ['status' => true, 'message' => 'added successfully','donor_id' => $model->insertID()];
|
||||
}else {
|
||||
$results = ['status' => false, 'message' => 'could not be added','donor_id' => ''];
|
||||
}
|
||||
|
||||
$donor_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$this->request->getPost('DonorType')];
|
||||
$results['donor'] = $model->getData('donor', $donor_where);
|
||||
return $this->response->setJSON(['data' => $results]);
|
||||
}
|
||||
public function insert_donor()
|
||||
{
|
||||
$requestData = $this->request->getPost();
|
||||
|
||||
@ -20,13 +20,15 @@ use Dompdf\Options;
|
||||
class Invoice extends BaseController
|
||||
{
|
||||
|
||||
protected $AuditHistoryModel;
|
||||
protected $UserModel;
|
||||
protected $BusinessModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->AuditHistoryModel = new AuditHistoryModel();
|
||||
$this->UserModel = new UsersModel();
|
||||
$this->Business_Model = new BusinessModel();
|
||||
|
||||
$this->BusinessModel = new BusinessModel();
|
||||
}
|
||||
|
||||
## For Invoice Listing..
|
||||
@ -48,11 +50,6 @@ class Invoice extends BaseController
|
||||
$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;
|
||||
|
||||
$this->logger->info("Invoice: Listing Count ." . count($data['receipt']));
|
||||
$this->render_page('invoice_list', $data);
|
||||
} else {
|
||||
@ -116,20 +113,19 @@ class Invoice extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
## To Load Invoice ADD/EDIT page...
|
||||
## To Save/Update the Recepit Details
|
||||
public function new_receipt($id = '0')
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$bmodel = new BooksModel();
|
||||
$setting_model = new SettingsModel();
|
||||
|
||||
$where = ['business_id' => (int)get_business_id() ];
|
||||
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1];
|
||||
$rec_where = ['business_id' => (int)get_business_id(), 'YEAR(created_on)' => date('Y')];
|
||||
$receipt = $model->getData('receipt', $rec_where);
|
||||
|
||||
// receipt number
|
||||
$settingData = $setting_model->select('*')->where($where)->findAll();
|
||||
$settingData = $this->BusinessModel->select('*')->where($where)->findAll();
|
||||
$count_receipt_no = (count($receipt) > 0) ? count($receipt) + $settingData[0]['start_no'] + 1 : $settingData[0]['start_no'] + 1;
|
||||
|
||||
// Calculate padding based on the count of digits in count_receipt_no
|
||||
@ -139,12 +135,12 @@ class Invoice extends BaseController
|
||||
$data['count_receipt_no'] = $settingData[0]['prefix_format'] . $padding . $count_receipt_no;
|
||||
|
||||
// Get customer names for the dropdown, events details, and books details
|
||||
$data['currency'] = $setting_model->select('currency')->where($where)->findAll();
|
||||
$data['customers'] = $model->getData('donor', $cus_where);
|
||||
$data['currency'] = $this->BusinessModel->select('currency')->where($where)->findAll();
|
||||
|
||||
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id())->where('isactive',1)->get()->getResult();
|
||||
$data['campaign'] = $model->getData('campaign', $where);
|
||||
$data['invoice_number_formatting'] = $model->getData('settings', $where);
|
||||
|
||||
$data['receipt_type'] = "option1";
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Receipt: In Add Details");
|
||||
$data['page_name'] = 'Add Receipt Details';
|
||||
@ -160,8 +156,22 @@ class Invoice extends BaseController
|
||||
{
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id, 'isactive' => 1])->first();
|
||||
}
|
||||
$get_receipt_type_where = [
|
||||
'business_id' => (int)get_business_id(),
|
||||
'isactive' => 1,
|
||||
'donor_id' => $data['receipt_details']['donor_id']
|
||||
];
|
||||
|
||||
$get_receipt_type = $model->getData('donor', $get_receipt_type_where);
|
||||
if (!empty($get_receipt_type)) {
|
||||
$firstItem = reset($get_receipt_type);
|
||||
$data['receipt_type'] = $firstItem->donor_type;
|
||||
}
|
||||
}
|
||||
|
||||
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$data['receipt_type']];
|
||||
$data['typebaseddonors'] = $model->getData('donor', $cus_where);
|
||||
$data['alldonors'] = $model->getData('donor', ['business_id' => (int)get_business_id() , 'isactive' => 1]);
|
||||
|
||||
$this->render_page('invoice_form', $data);
|
||||
}
|
||||
|
||||
@ -234,50 +244,6 @@ class Invoice extends BaseController
|
||||
return redirect()->route('receipt_list');
|
||||
}
|
||||
|
||||
|
||||
## For Ajax Call To Fetch/Retrive All Address Details Based On Customer...
|
||||
public function load_details1()
|
||||
{
|
||||
$id = $this->request->getPost('selectedValue');
|
||||
$where = ['customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$id];
|
||||
$where['address_type'] = 1;
|
||||
$data['customer_billing'] = $this->get_customer_address($where, []);
|
||||
$select = ["customer_address_id", "CONCAT(address_1,' ',address_2) as address"];
|
||||
$where['address_type'] = 2;
|
||||
$data['customer_shipping'] = $this->get_customer_address($where, $select);
|
||||
$data['customer_membership'] = $this->get_customer_membership("membership",(int)$id);
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
|
||||
## For Ajax Call To Fetch/Retrive Shipping Address Details Only Based On Customer...
|
||||
public function load_details2()
|
||||
{
|
||||
$customer_id = $this->request->getPost('customerValue');
|
||||
$address_id = $this->request->getPost('selectedValue');
|
||||
$where = ['customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$customer_id, 'address_type' => 2, 'customer_address_id' => (int)$address_id];
|
||||
$data['customer_shipping'] = $this->get_customer_address($where, []);
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
// public function generate_serial_no(){}
|
||||
|
||||
## For Gethering Address Details...
|
||||
public function get_customer_address($where, $select)
|
||||
{
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('customer_addresses');
|
||||
if (empty($select)) {
|
||||
$select = ["customer_addresses.customer_id","customer_addresses.customer_address_id","customer_addresses.first_name","customer_addresses.last_name ","customer_addresses.company","customer_addresses.email","customer_addresses.mobile_no","customer_addresses.address_type","customer_addresses.address_1","customer_addresses.address_2","customer_addresses.city","customer_addresses.state","customer_addresses.postal_code","customer_addresses.country","states.state_name","countries.country_name"];
|
||||
}
|
||||
$address_details = $model->select($select)->join('states', 'states.state_short_name = customer_addresses.state AND customer_addresses.country = "IN"', 'left')->join('countries', 'countries.country_short_name = customer_addresses.country', 'left')->where($where)->findAll();
|
||||
return $address_details;
|
||||
}
|
||||
|
||||
public function get_customer_membership($category,$id){
|
||||
$model = new InvoiceModel();
|
||||
$result = $model->getMembershipListForCustomer($category,$id);
|
||||
return $result;
|
||||
}
|
||||
|
||||
## To insert or update the details of the invoice
|
||||
public function save_invoice()
|
||||
{
|
||||
@ -290,11 +256,12 @@ class Invoice extends BaseController
|
||||
$receipt_date = $this->request->getVar('receipt_date');
|
||||
|
||||
$receipt_id = (!empty($this->request->getPost('receipt_id'))) ? $this->request->getPost('receipt_id') : "";
|
||||
$customer_id = (int)$this->request->getPost('donor_id');
|
||||
$donor_id = (int)$this->request->getPost('donor_id');
|
||||
|
||||
$data = [
|
||||
'receipt_type' => $this->request->getPost('receipt_type'),
|
||||
'receipt_number' => $this->request->getPost('receipt_number'),
|
||||
'donor_id' => $customer_id,
|
||||
'donor_id' => $donor_id,
|
||||
'campaign_id' => (int)$this->request->getPost('campaign_id'),
|
||||
'notes'=>$this->request->getPost('notes'),
|
||||
'receipt_date' => (!empty($receipt_date)) ? date("Y-m-d", strtotime($receipt_date)) : NULL,
|
||||
@ -395,8 +362,8 @@ class Invoice extends BaseController
|
||||
$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();
|
||||
$d_name = $donormodel->select('first_name')->where('donor_id',$donor_id)->findAll();
|
||||
$business = $this->BusinessModel->select('*')->where('business_id',(int)get_business_id())->findAll();
|
||||
|
||||
$donor_name = $d_name[0]['first_name'];
|
||||
$currency_amount = $this->request->getPost('amount');
|
||||
@ -450,7 +417,6 @@ class Invoice extends BaseController
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$usermodel = new UsersModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$data = $model->getData('audit_history', $where);
|
||||
// echo $data[0]->current_data;die;
|
||||
@ -466,7 +432,7 @@ class Invoice extends BaseController
|
||||
foreach ($arr1[0] as $key => $value) {
|
||||
$con = $key != 'created_on' && $key != 'created_by' && $key != 'updated_on' && $key != 'updated_by';
|
||||
if ($audit_data->is_edit == 1 && $arr2[0][$key] !== $value) {
|
||||
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
$user = $this->UserModel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
if($con){
|
||||
$temp_diff[] = (object) [
|
||||
'id' => $audit_data->id,
|
||||
@ -482,7 +448,7 @@ class Invoice extends BaseController
|
||||
}
|
||||
else if($con && $audit_data->is_add == 1){
|
||||
// echo $key;die;
|
||||
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->created_by)->findAll();
|
||||
$user = $this->UserModel->select('first_name,last_name')->where('user_id',$audit_data->created_by)->findAll();
|
||||
$temp_diff[] = (object) [
|
||||
'id' => $audit_data->id,
|
||||
'key' => '-',
|
||||
@ -497,7 +463,7 @@ class Invoice extends BaseController
|
||||
}
|
||||
else if($con && $audit_data->is_delete == 1){
|
||||
// echo $key;die;
|
||||
$user = $usermodel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
$user = $this->UserModel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
$temp_diff[] = (object) [
|
||||
'id' => $audit_data->id,
|
||||
'key' => '-',
|
||||
@ -539,132 +505,21 @@ class Invoice extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
## To insert or update invoice item details based on invoice ID
|
||||
public function save_invoice_item($id, $requestData)
|
||||
{
|
||||
|
||||
## Get Invoice item details (to checking purpose exist or not based on invoice ID)
|
||||
$getInvoiceItemDetails = $this->get_invoice_item($id);
|
||||
|
||||
## Declaration
|
||||
$statement = "";
|
||||
$model = new InvoiceModel();
|
||||
$itemid = $requestData['invoice_child_id'];
|
||||
|
||||
## IF Any Missing value Means that values are Inactive here....
|
||||
if (!empty($itemid)) {
|
||||
$filteringInvoiceItemIds = [];
|
||||
for ($y = 0; $y < count($getInvoiceItemDetails); $y++) {
|
||||
$filteringInvoiceItemIds[$y] = $getInvoiceItemDetails[$y]['invoice_child_id'];
|
||||
}
|
||||
|
||||
if (!empty($filteringInvoiceItemIds)) {
|
||||
$A = $filteringInvoiceItemIds;
|
||||
$B = $itemid;
|
||||
$missingValues = array_diff($A, $B);
|
||||
|
||||
if (!empty($missingValues)) {
|
||||
$where = ['isactive' => 1, 'receipt_id' => (int)$id];
|
||||
$model->inactiveMissingInvoiceItemDetails($where, $missingValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
// echo "<br/>....................";
|
||||
$count = count($itemid);
|
||||
$invoiceitem_arr = [];
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
if(!empty($requestData['item_details'][$x])){
|
||||
$invoiceitem_arr[$x]['receipt_id'] = $id;
|
||||
$invoiceitem_arr[$x]['product'] = (int)$requestData['item_details'][$x];
|
||||
$invoiceitem_arr[$x]['quantity'] = (int)$requestData['quantity'][$x];
|
||||
$invoiceitem_arr[$x]['tax'] = (int)$requestData['tax'][$x];
|
||||
$invoiceitem_arr[$x]['unit_price'] = (int)$requestData['rate'][$x];
|
||||
$invoiceitem_arr[$x]['subtotal'] = (int)$requestData['amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_amount'] = (int)$requestData['discount_amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_type'] =$requestData['discount_type'][$x];
|
||||
if (!empty($requestData['from_subscription'])) {
|
||||
$invoiceitem_arr[0]['from_subscription'] = $requestData['from_subscription'];
|
||||
}
|
||||
|
||||
if (!empty($requestData['to_subscription'])) {
|
||||
$invoiceitem_arr[0]['to_subscription'] = $requestData['to_subscription'];
|
||||
}
|
||||
$invoiceitem_arr[$x]['created_by'] = (int)get_logged_user_id();
|
||||
$invoiceitem_arr[$x]['updated_by'] = (int)get_logged_user_id();
|
||||
$invoiceitem_arr[$x]['isactive'] = 1;
|
||||
$invoiceitem_arr[$x]['invoice_child_id'] = $itemid[$x];
|
||||
}
|
||||
}
|
||||
$statement = $model->saveInvoiceItemDetails($invoiceitem_arr);
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
## To Retrive Invoice item details based on invoice ID
|
||||
public function get_invoice_item($id)
|
||||
{
|
||||
$model = new InvoiceModel();
|
||||
$model->setTable('invoiceitems');
|
||||
$where = ['isactive' => 1, 'receipt_id' => (int)$id];
|
||||
$details = $model->where($where)->findAll();
|
||||
return $details;
|
||||
}
|
||||
|
||||
## To Inactive Invoice details based on invoice ID Including Invoice Item Details also
|
||||
public function delete_invoice($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
try {
|
||||
$model = new InvoiceModel();
|
||||
$where = ['isactive' => 1, 'business_id' => (int)get_business_id(), 'receipt_id' => (int)$id];
|
||||
$existed = $model->where($where)->findAll();
|
||||
$this->logger->Info("Invoice : Going to Inactive ID = " . $id);
|
||||
|
||||
if ($existed) {
|
||||
$data['isactive'] = 0;
|
||||
$data['updated_by'] = get_logged_user_id();
|
||||
|
||||
if ($model->update($id, $data)) {
|
||||
session()->setFlashdata('success', 'Deleted successfully.');
|
||||
$this->logger->info("Invoice: has been Inactived successfully. Inactived ID = " . $id);
|
||||
} else {
|
||||
$this->logger->error("Invoice: Not able to Inactive ID =" . $id);
|
||||
throw new \Exception("Data Not able to Deleted");
|
||||
}
|
||||
$getInvoiceItemDetails = $this->get_invoice_item($id);
|
||||
if ($getInvoiceItemDetails) {
|
||||
$update_where = ['receipt_id' => (int)$id];
|
||||
$model->updateData('invoiceitems', $data, $update_where);
|
||||
}
|
||||
} else {
|
||||
$this->logger->error("Invoice: Does Not Exist To Inactive, ID = " . $id);
|
||||
throw new \Exception("Invoice Already Deleted");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Invoice: Err Occur = " . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('receipt_list');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function generate_invoice_pdf($id, $dest = null)
|
||||
{
|
||||
try {
|
||||
// Fetch the receipt data based on $receipt_id
|
||||
$model = new InvoiceModel();
|
||||
$usermodel = new UsersModel();
|
||||
$setting_model = new SettingsModel();
|
||||
$business_model = new BusinessModel();
|
||||
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$currency_data = $setting_model->select('currency')->where($where)->findAll();
|
||||
$terms_data = $business_model->select('terms,signature')->where($where)->findAll();
|
||||
$terms_data = $this->BusinessModel->select('terms,signature')->where($where)->findAll();
|
||||
$data = $model->getInvoiceData($id);
|
||||
// Check if data is empty
|
||||
if (!$data || !$currency_data) {
|
||||
throw new Exception('Data not found or empty');
|
||||
throw new \Exception('Data not found or empty');
|
||||
}
|
||||
|
||||
$options = new Options();
|
||||
@ -680,7 +535,7 @@ 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();
|
||||
$user = $this->UserModel->select('first_name')->where('user_id',$data[0]->created_by)->findAll();
|
||||
$logoPath = base_url()."public/uploads/".$data[0]->business_logo;
|
||||
|
||||
if ($data[0]->business_logo && file_exists($logoPath)) {
|
||||
@ -689,11 +544,13 @@ class Invoice extends BaseController
|
||||
// Logo does not exist, handle this case accordingly
|
||||
$baseurl = base_url()."public/uploads/default.png";
|
||||
}
|
||||
$digits = strlen((string)$data[0]->amount);
|
||||
$amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount;
|
||||
|
||||
$html = view('invoice_pdf_template', [
|
||||
'data' => $data[0],
|
||||
'currency' => $data[0]->currency,
|
||||
'currency_in_words' => $this->convertNumberToWords($data[0]->amount) ,
|
||||
'currency_in_words' => $amount_in_words ,
|
||||
'baseurl' => $baseurl,
|
||||
'signature' => $terms_data[0]['signature'],
|
||||
'staff_name' => $user[0]['first_name'],
|
||||
@ -720,7 +577,7 @@ class Invoice extends BaseController
|
||||
return $html;
|
||||
}
|
||||
$dompdf->stream('Receipt.pdf', ['Attachment' => 1]);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// Handle the exception
|
||||
// For example, log the error, display a user-friendly message, or return an error response
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
@ -763,14 +620,28 @@ class Invoice extends BaseController
|
||||
if ($number == 0) {
|
||||
return $words[0];
|
||||
}
|
||||
|
||||
|
||||
$num = (int)$number;
|
||||
$result = '';
|
||||
|
||||
// Handle numbers greater than 10 million (crores)
|
||||
if ($num >= 10000000) {
|
||||
$crores = floor($num / 10000000);
|
||||
$result .= $this->convertNumberToWords($crores) . ' Crore ';
|
||||
$num %= 10000000;
|
||||
}
|
||||
|
||||
// Handle numbers between 1 million and 9 million (lakhs)
|
||||
if ($num >= 100000) {
|
||||
$lakhs = floor($num / 100000);
|
||||
$result .= $this->convertNumberToWords($lakhs) . ' Lakh ';
|
||||
$num %= 100000;
|
||||
}
|
||||
|
||||
// Handle numbers greater than 1000
|
||||
// Handle numbers between 1000 and 99999
|
||||
if ($num >= 1000) {
|
||||
$thousands = floor($num / 1000);
|
||||
$result .= $words[$thousands] . ' Thousand ';
|
||||
$result .= $this->convertNumberToWords($thousands) . ' Thousand ';
|
||||
$num %= 1000;
|
||||
}
|
||||
|
||||
@ -796,196 +667,18 @@ class Invoice extends BaseController
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
## For Ajax Call To Retrive Donor Details Based On Donor type...
|
||||
public function get_donor_details()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$value = $this->request->getPost('donor_type');
|
||||
//For Donor Name And Donor Mobile Number Dropdown..
|
||||
$where = ['business_id' => (int)get_business_id() , 'donor_type'=>$value, 'isactive' => 1];
|
||||
$data['donor_details'] = $model->getData('donor', $where);
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public function approve_notifications($receipt_id)
|
||||
// {
|
||||
// $model = new InvoiceModel();
|
||||
// $where = ['I.business_id' => (int)get_business_id(), 'I.receipt_id' => $receipt_id, 'I.isactive' => 1];
|
||||
// $details = $model->getDetailForApproveNotifications($where);
|
||||
// $records = [];
|
||||
// $reference_number = "";
|
||||
// $invoice_serial_number = "";
|
||||
// $recipient_name = "";
|
||||
// $approval_date = "";
|
||||
// $approved_by = "";
|
||||
// $recipient_email = "";
|
||||
// $recipient_mobile = "";
|
||||
// $subtotal = "";
|
||||
// $tax = "";
|
||||
// $total_amount = "";
|
||||
// $payment_method = "";
|
||||
// $business_name= "";
|
||||
// $business_address= "";
|
||||
// $business_city= "";
|
||||
// $business_state= "";
|
||||
// $business_postal_code= "";
|
||||
// $business_email= "";
|
||||
// $business_mobile_no= "";
|
||||
// if (isset($details)) {
|
||||
// $this->logger->info("Invoice: approve notification Request data type = ".gettype($details));
|
||||
// }
|
||||
// helper('notification');
|
||||
// $notification = new NotificationHelper();
|
||||
// foreach ($details['invoice'] as $rec) {
|
||||
// $reference_number = $rec['order_number'];
|
||||
// $invoice_serial_number = $rec['invoice_number'];
|
||||
// $recipient_name = $rec['customer_name'];
|
||||
// $approval_date = $rec['updated_on'];
|
||||
// $approved_by = $rec['updated_by_name'];
|
||||
// $recipient_email = $rec['customer_email'];
|
||||
// $recipient_mobile = $rec['customer_mobile'];
|
||||
// $subtotal = $rec['subtotal'];
|
||||
// $tax = $rec['tax'];
|
||||
// $total_amount = $rec['total_amount'];
|
||||
// $payment_method = $rec['payment_method'];
|
||||
// $business_name= $rec['business_name'];
|
||||
// $business_address= $rec['business_address'];
|
||||
// $business_city= $rec['business_city'];
|
||||
// $business_state= $rec['business_state'];
|
||||
// $business_postal_code= $rec['business_postal_code'];
|
||||
// $business_email= $rec['business_email'];
|
||||
// $business_mobile_no= $rec['business_mobile_no'];
|
||||
// }
|
||||
// $records['invoice_order_number'] = $reference_number;
|
||||
// $records['invoice_serial_number'] = $invoice_serial_number;
|
||||
// $records['recipient_name'] = $recipient_name;
|
||||
// $records['recipient_email'] = $recipient_email ? $recipient_email : "sanjeev.p@venbainfotech.com";
|
||||
// $records['subtotal'] = $subtotal;
|
||||
// $records['tax'] = $tax;
|
||||
// $records['total_amount'] = $total_amount;
|
||||
// $records['payment_method'] = $payment_method;
|
||||
// $records['favicon'] = base_url("public/uploads/default.ico");
|
||||
// $records['browser_title'] = "bbb-bp | Approve Template";
|
||||
// $records['page_name'] = 'Approve Template';
|
||||
// // view('approve_template',$records);
|
||||
// // $this->logger->info("Approve : Request data = ".json_encode($records));
|
||||
// // view('approve_template',$records);
|
||||
|
||||
// $records['template_name'] = 'approve_template';
|
||||
// $records['item'] = $details['item'];
|
||||
// $records['subject'] = $invoice_serial_number . " - Approval Notification";
|
||||
|
||||
// $records['description'] = "<html><head><title>VBP Approve Information</title></head><body>
|
||||
// <p>Dear $recipient_name,</p>
|
||||
// <p>    We are pleased to inform you that your Invoice has been approved.</p>
|
||||
// <p><strong>Details:</strong></p>
|
||||
// <ul><li>Approval Date:" . $approval_date . "</li>
|
||||
// <li>Approved By:" . $approved_by . "</li>
|
||||
// <li>Reference ID:" . $reference_number . "</li>
|
||||
// </ul><br>
|
||||
// <p>Best regards,</p>
|
||||
// <ul style='list-style: none;'>
|
||||
// <li>".$business_name.",</li>
|
||||
// <li>".$business_address." ".$business_city." ".$business_state." - ".$business_postal_code."</li>
|
||||
// <li>Call Us: +91 ".$business_mobile_no."</li>
|
||||
// <li>Email Us: ".$business_email."</li></body></html>";
|
||||
|
||||
// $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;
|
||||
|
||||
// $params = (object) Null;
|
||||
// $params->number = (int)'91' . $recipient_mobile;
|
||||
// $params->type = "text";
|
||||
// $params->message = $template;
|
||||
// $params->instance_id = WAAI_INSTANCE;
|
||||
// $params->access_token = WAAI_TOKEN;
|
||||
// $this->logger->info("receipt: approve notification Email Request data = ".json_encode($records));
|
||||
// $email_result = $notification->sendEmail($records);
|
||||
// $this->logger->info("receipt: approve notification Email Response = " . json_encode($email_result));
|
||||
// $this->logger->info("receipt: approve notification Whatsapp Request data = ".json_encode($params));
|
||||
// $whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
|
||||
// $this->logger->info("receipt: approve notification Whatsapp Response = " . json_encode($whatsapp_result));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// public function general_inv_rp()
|
||||
// {
|
||||
// if($this->request->getmethod() == 'get')
|
||||
// {
|
||||
// $model = new InvoiceModel();
|
||||
// $data['report_data'] = $model->get_general_invoice_data();
|
||||
// $this->logger->info("Invoice Report ");
|
||||
// $data['page_name'] = 'General Invoice Report';
|
||||
// $this->render_page('report_general_invoice', $data);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
// $fromDate = $dateParts[0];
|
||||
// $toDate = $dateParts[1];
|
||||
|
||||
// $dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
// $dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
// $model = new InvoiceModel();
|
||||
// $data['report_data'] = $model->get_general_invoice_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
// $this->logger->info("Invoice Report ");
|
||||
// $data['page_name'] = 'General Invoice Report';
|
||||
// $data['selected_data'] = $this->request->getVar('date');
|
||||
// $this->render_page('report_general_invoice', $data);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function general_membership_inv_rp()
|
||||
// {
|
||||
// if($this->request->getmethod() == 'get')
|
||||
// {
|
||||
// $model = new InvoiceModel();
|
||||
// $data['report_data'] = $model->get_mem_invoice_data();
|
||||
// $this->logger->info("Membership Invoice Report ");
|
||||
// $data['page_name'] = 'Membership Invoice Report';
|
||||
// $this->render_page('report_mem_invoice', $data);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
// $fromDate = $dateParts[0];
|
||||
// $toDate = $dateParts[1];
|
||||
|
||||
// $dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
// $dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
// $model = new InvoiceModel();
|
||||
// $data['report_data'] = $model->get_mem_invoice_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
// $this->logger->info("Membership Invoice Report ");
|
||||
// $data['page_name'] = 'Membership Invoice Report';
|
||||
// $data['selected_data'] = $this->request->getVar('date');
|
||||
// $this->render_page('report_mem_invoice', $data);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function itemwise_report()
|
||||
// {
|
||||
// if($this->request->getmethod() == 'get')
|
||||
// {
|
||||
// $model = new InvoiceModel();
|
||||
// $data['report_data'] = $model->itemwise_report_data();
|
||||
// $this->logger->info("Itemwise Report ");
|
||||
// $data['page_name'] = 'Itemwise Report';
|
||||
// $this->render_page('report_itemwise', $data);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
// $fromDate = $dateParts[0];
|
||||
// $toDate = $dateParts[1];
|
||||
|
||||
// $dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
// $dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
// $model = new InvoiceModel();
|
||||
// $data['report_data'] = $model->itemwise_report_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
// $this->logger->info("Itemwise Report ");
|
||||
// $data['page_name'] = 'Itemwise Report';
|
||||
// $data['selected_data'] = $this->request->getVar('date');
|
||||
// $this->render_page('report_itemwise', $data);
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -42,14 +42,15 @@ class Users extends BaseController
|
||||
}
|
||||
|
||||
## To Load User Add/Update page
|
||||
public function user_page($id)
|
||||
public function user_page($id,$flag)
|
||||
{
|
||||
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$data['business_details'] = $this->business_details();
|
||||
|
||||
$data['dummy_flag'] = $flag; // for redirect purpose.
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Users: In Add page");
|
||||
$data['page_name'] = 'Add User';
|
||||
@ -300,7 +301,11 @@ class Users extends BaseController
|
||||
}
|
||||
|
||||
// Redirect back to the user_page function or any other appropriate page
|
||||
return redirect()->to(base_url("user_page/{$user_id}"));
|
||||
if($this->request->getPost('dummy_flag') == 1){
|
||||
return redirect()->to(base_url("user_page/{$user_id}/1"));
|
||||
}else{
|
||||
return redirect()->route('user_list');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ class BusinessModel extends Model
|
||||
{
|
||||
protected $table = 'business';
|
||||
protected $primaryKey = 'business_id';
|
||||
protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature'];
|
||||
protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature','favicon','start_no','left_pad','prefix_format','site_name','site_title','site_mobile','site_info','admin_email','terms_service','footer_about','copyright','pagination_limit','about_info','currency'];
|
||||
|
||||
public function insertBusiness($data)
|
||||
{
|
||||
@ -19,6 +19,7 @@ class BusinessModel extends Model
|
||||
{
|
||||
return $this->db->table('business_branches')
|
||||
->where('business_id', $businessId)
|
||||
->where('isactive', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
@ -75,5 +76,32 @@ public function updateDonationData($businessId, $selectedDonations)
|
||||
}
|
||||
}
|
||||
|
||||
public function inactiveMissingBuinessBranchDetails($where,$missingValues){
|
||||
$dataToUpdate = ['isactive' => 0];
|
||||
$this->db->table('business_branches')->where($where)->whereIn('id',$missingValues)->update($dataToUpdate);
|
||||
}
|
||||
|
||||
public function saveBuinessBranchDetails($data){
|
||||
$i = 0;
|
||||
$statement = [];
|
||||
foreach ($data as $row) {
|
||||
$id = $row['id'];
|
||||
if($id != ''){
|
||||
unset($row['id']); // Remove the id from the data to avoid updating it
|
||||
$this->db->table('business_branches')->where('id', $id)->update($row);// Update the row with the specified id
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement[$i] = "business branches id - ".$id." ". ($affectedRows ? " Updated":" Nothing to Updated");
|
||||
}else{
|
||||
$this->db->table('business_branches')->insert($row);
|
||||
$insertID = $this->db->insertID();
|
||||
$statement[$i] = "business branches id - ".$insertID." Inserted";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -168,6 +168,15 @@ public function getReceiptDetailsByDonorId($donorId)
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getData($table, $where = null)
|
||||
{
|
||||
$query = $this->db->table($table);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
@ -17,13 +16,15 @@
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
|
||||
.toggle-icon {
|
||||
cursor: pointer;
|
||||
margin-left: 5px;
|
||||
}
|
||||
#error-message{
|
||||
color:red;
|
||||
|
||||
|
||||
#error-message {
|
||||
color: red;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -43,405 +44,339 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_org"; ?>" id="myForm">
|
||||
<hr />
|
||||
<h4 class="header-title" id="org-settings-title">
|
||||
Organization Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('org-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<div class="form-group" id="org-settings">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bname" class="col-form-label">Organization Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="bname" name="bname" value="<?= isset($businesses['title']) ? $businesses['title'] : '' ?>" placeholder="Organization Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<hr />
|
||||
<h4 class="header-title" id="org-settings-title">
|
||||
Organization Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('org-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<div class="form-group" id="org-settings">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bname" class="col-form-label">Organization Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="bname" name="bname" value="<?= isset($businesses['title']) ? $businesses['title'] : '' ?>" placeholder="Organization Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmail" class="col-form-label">Organization Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" name="bmail" value="<?= isset($businesses['email']) ? $businesses['email'] : '' ?>" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmail" class="col-form-label">Organization Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" name="bmail" value="<?= isset($businesses['email']) ? $businesses['email'] : '' ?>" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmobile" class="col-form-label">Organization PAN Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="pan_no" value="<?= isset($businesses['pan_no']) ? $businesses['pan_no'] : '' ?>" placeholder="PAN Number" required pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" title="Enter a valid PAN number" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="baddress" class="col-form-label">Organization Reg Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="org_reg_no" value="<?= isset($businesses['org_reg_no']) ? $businesses['org_reg_no'] : '' ?>" placeholder="Organization Register Number" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bmobile" class="col-form-label">Organization Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="tel" class="form-control" name="bmobile" value="<?= isset($businesses['mobile_no']) ? $businesses['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d{10}" title="Please enter a 10-digit mobile number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="baddress" class="col-form-label">Organization Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="baddress" value="<?= isset($businesses['address']) ? $businesses['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($businesses['loged_user'])) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="baddress" class="col-form-label">80G</label>
|
||||
<input type="text" class="form-control" name="80G" value="<?= isset($businesses['80G']) ? $businesses['80G'] : '' ?>" placeholder="80G Tax Free" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bcity" class="col-form-label">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bcity" value="<?= isset($businesses['city']) ? $businesses['city'] : '' ?>" placeholder="City" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bstate" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bstate" value="<?= isset($businesses['state']) ? $businesses['state'] : '' ?>" placeholder="State" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bzip" value="<?= isset($businesses['postal_code']) ? $businesses['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" pattern="[0-9]{6}" maxlength="6" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmobile" class="col-form-label">Organization PAN Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="pan_no" value="<?= isset($businesses['pan_no']) ? $businesses['pan_no'] : '' ?>" placeholder="PAN Number" required pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" title="Enter a valid PAN number" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="baddress" class="col-form-label">Organization Reg Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="org_reg_no" value="<?= isset($businesses['org_reg_no']) ? $businesses['org_reg_no'] : '' ?>" placeholder="Organization Register Number" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bmobile" class="col-form-label">Organization Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="tel" class="form-control" name="bmobile" value="<?= isset($businesses['mobile_no']) ? $businesses['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d{10}" title="Please enter a 10-digit mobile number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="baddress" class="col-form-label">Organization Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="baddress" value="<?= isset($businesses['address']) ? $businesses['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<!-- Existing form fields above this section -->
|
||||
<!-- ################################################################################################# -->
|
||||
<hr />
|
||||
<h4 class="header-title" id="site-settings-title">
|
||||
Site Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('site-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="site-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12" style="display:none;">
|
||||
<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 ($master_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>
|
||||
|
||||
<?php if (isset($businesses['loged_user'])) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="baddress" class="col-form-label">80G</label>
|
||||
<input type="text" class="form-control" name="80G" value="<?= isset($businesses['80G']) ? $businesses['80G'] : '' ?>" placeholder="80G Tax Free" />
|
||||
<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($businesses['site_name']) ? $businesses['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($businesses['site_title']) ? $businesses['site_title'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bcity" class="col-form-label">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bcity" value="<?= isset($businesses['city']) ? $businesses['city'] : '' ?>" placeholder="City" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
||||
<div class="invalid-feedback"> Please provide. </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($businesses['admin_email']) ? $businesses['admin_email'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_mobile" class="col-form-label">Mobile Number</label>
|
||||
<input type="text" class="form-control" id="site_mobile" name="site_mobile" placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number" value="<?= isset($businesses['site_mobile']) ? $businesses['site_mobile'] : '' ?>" pattern="\d{10}" title="Please enter a 10-digit mobile number" maxlength="10" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bstate" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bstate" value="<?= isset($businesses['state']) ? $businesses['state'] : '' ?>" placeholder="State" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
||||
<div class="invalid-feedback"> Please provide. </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($businesses['copyright']) ? $businesses['copyright'] : '' ?>" />
|
||||
</div>
|
||||
<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($businesses['currency']) ? $businesses['currency'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bzip" value="<?= isset($businesses['postal_code']) ? $businesses['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" pattern="[0-9]{6}" maxlength="6" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Existing form fields above this section -->
|
||||
<!-- ################################################################################################# -->
|
||||
<hr />
|
||||
<h4 class="header-title" id="site-settings-title">
|
||||
Site Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('site-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="site-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12" style="display:none;">
|
||||
<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 class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="country" class="col-form-label">Country</label>
|
||||
<input type="text" class="form-control" id="country" name="country" placeholder="Country" value="<?= isset($businesses['country']) ? $businesses['country'] : '' ?>" />
|
||||
</div>
|
||||
</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" />
|
||||
<!-- ################################################################################################# -->
|
||||
<?php if ($loged_user !== 'sadmin') : ?>
|
||||
<hr />
|
||||
<!-- -->
|
||||
<h4 class="header-title" id="donaton-accepted-title">
|
||||
Accepted Contribution
|
||||
<span class="toggle-icon" onclick="toggleSettings('donaton-accepted')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="donaton-accepted" style="display: none;">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" placeholder="PAN Number" id="name" name="name[]" required data-toggle="select2" multiple>
|
||||
<option value="0" disabled>--Select--</option>
|
||||
<?php foreach ($donation as $val) : ?>
|
||||
<option value="<?= $val["id"] ?>" <?php if ($val["is_active"] == 1) echo "selected"; ?>> <?= $val["name"] ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<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'] : '' ?>" />
|
||||
<?php endif; ?>
|
||||
<!--#################################################################### -->
|
||||
<hr />
|
||||
<h4 class="header-title" id="branch-settings-title">
|
||||
Branch Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('branch-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div id="branch-settings" style="display: none;">
|
||||
<div class="after-busi-branch-add-more">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger"> </span></label>
|
||||
<input type="text" class="form-control" id="branchname" name="branch_name[]" placeholder="Branch Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="branchaddress" name="branchaddress[]" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile_no" class="col-form-label">Contact Person Mobile Number<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="mobile_no" name="mobile_no[]" placeholder="Contact Person Mobile Number" required data-parsley-type="number" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="email" name="email[]" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<!-- Add hidden input for branch id -->
|
||||
<input type="hidden" id="buiness_branch_id" name="id[]" placeholder="hidden for buisness branch id" />
|
||||
<input type="hidden" id="counter" value=<?= 0; ?> readonly />
|
||||
</div>
|
||||
<div class="form-group col-md-9 busi-branch-div-change text-right m-b-0">
|
||||
<a class="btn btn-success waves-effect waves-light mr-1 busi-branch-add-more">+ Add More </a>
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1 busi-branch-remove">- Remove </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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'] : '' ?>" pattern="\d{10}" title="Please enter a 10-digit mobile number" 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="currency" class="col-form-label">Currency</label>
|
||||
<input type="text" class="form-control" id="currency" name="currency"
|
||||
placeholder="currency (eg : Rupees,Dollar,Euro)"
|
||||
value="<?= isset($details['currency']) ? $details['currency'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="country" class="col-form-label">Country</label>
|
||||
<input type="text" class="form-control" id="country" name="country"
|
||||
placeholder="Country"
|
||||
value="<?= isset($details['country']) ? $details['country'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ################################################################################################# -->
|
||||
<?php if ($loged_user !== 'sadmin') : ?>
|
||||
<hr />
|
||||
<!-- -->
|
||||
<h4 class="header-title" id="donaton-accepted-title">
|
||||
Accepted Contribution
|
||||
<span class="toggle-icon" onclick="toggleSettings('donaton-accepted')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="donaton-accepted" style="display: none;">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" placeholder="PAN Number" id="name" name="name[]" required data-toggle="select2" multiple >
|
||||
<option value="0" disabled>--Select--</option>
|
||||
<?php foreach ($donation as $val) : ?>
|
||||
<option value="<?= $val["id"] ?>" <?php if ($val["is_active"] == 1) echo "selected"; ?> > <?= $val["name"] ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<!-- ############################################################################################### -->
|
||||
|
||||
|
||||
<div class="form-group col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!--#################################################################### -->
|
||||
<hr />
|
||||
<h4 class="header-title" id="branch-settings-title">
|
||||
Branch Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('branch-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div id="branchesContainer">
|
||||
<div class="after-shipping-addr-add-more" id="branch-settings" style="display: none;">
|
||||
<?php if (empty($branches)) : ?>
|
||||
|
||||
<!-- Display at least one set of branch fields when the array is empty -->
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger"> </span></label>
|
||||
<input type="text" class="form-control" id="branchname" name="branchname[]" placeholder="Branch Name"required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="branchaddress" name="branchaddress[]" placeholder="Address (eg : 1234 Main St)"required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<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="number" class="form-control" id="mobile_no" name="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">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="email" name="email[]" placeholder="Email" required/>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add hidden input for branch id -->
|
||||
<input type="hidden" name="id[]" />
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<!-- Display branch fields for each branch in the $branches array -->
|
||||
<?php foreach ($branches as $branch) : ?>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="branchname" name="branchname[]" value="<?= isset($branch['branch_name']) ? $branch['branch_name'] : '' ?>" placeholder="Branch Name"required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger"> </span></label>
|
||||
<input type="text" class="form-control" id="branchaddress" name="branchaddress[]" value="<?= isset($branch['address']) ? $branch['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<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" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger"></span></label>
|
||||
<input type="email" class="form-control" id="email" name="email[]" value="<?= isset($branch['email']) ? $branch['email'] : '' ?>" placeholder="Email"required/>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add hidden input for branch id -->
|
||||
<input type="hidden" name="id[]" value="<?= isset($branch['id']) ? $branch['id'] : '' ?>" />
|
||||
</div>
|
||||
<hr />
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<!-- Add more branches when clicking the "Add More Branches" button -->
|
||||
<div class="form-group col-md-12 text-right m-b-0">
|
||||
<a class="btn btn-success waves-effect waves-light mr-1 add-brnach-details"id="addBranchButton">+ Add More Branches </a>
|
||||
<!-- <a class="btn btn-danger waves-effect waves-light mr-1 remove-brnach-details">- Remove </a> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Remaining form fields below this section -->
|
||||
|
||||
<!-- Add more branches when clicking the "Add More Branches" button -->
|
||||
<!-- <div class="form-group col-md-12 text-right m-b-0">
|
||||
<a class="btn btn-success waves-effect waves-light mr-1 add-brnach-details">+ Add More Branches </a>
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1 remove-brnach-details">- Remove </a>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- ############################################################################################### -->
|
||||
|
||||
|
||||
<hr />
|
||||
<h4 class="header-title" id="logo-settings-title">
|
||||
Logo Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('logo-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="logo-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="logo" class="col-form-label">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'] : '' ?>" />
|
||||
<hr />
|
||||
<h4 class="header-title" id="logo-settings-title">
|
||||
Logo Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('logo-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="logo-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="logo" class="col-form-label">Logo</label>
|
||||
<input type="file" class="form-control" style="border: 0px !important; " id="logo" name="business_logo" placeholder="Logo Name" accept=".png, .jpg, .jpeg" value="<?= isset($businesses['business_logo']) ? $businesses['business_logo'] : '' ?>" />
|
||||
<p id="logo-error-message" style="color: red;"></p>
|
||||
|
||||
</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($businesses['business_logo'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="business_logo" class="col-form-label"> Logo</label>
|
||||
<img src="<?= base_url('public/uploads/' . $businesses['business_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($businesses['favicon']) ? $businesses['favicon'] : '' ?>" />
|
||||
<p id="favic-error-message" style="color: red;"></p>
|
||||
|
||||
</div>
|
||||
<?php if (!empty($businesses['favicon'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Favicon</label>
|
||||
<img src="<?= base_url('public/uploads/' . $businesses['favicon']) ?>" alt="Icon" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if (!empty($details['favicon'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Favicon</label>
|
||||
<img src="<?= base_url('public/uploads/'. $details['favicon']) ?>" alt="Icon"
|
||||
class="preview-image" />
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Signature</label>
|
||||
<input type="file" onchange="validateImage(this)" class="form-control" style="border: 0px !important;" id="signature" name="signature" value="<?= isset($businesses['signature']) ? $businesses['signature'] : null ?>" multiple />
|
||||
<p id="error-message"></p>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($businesses['signature'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Current Signature</label>
|
||||
<img src="<?= base_url('public/uploads/' . $businesses['signature']) ?>" alt="Signature" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for Organization id" value="<?= isset($businesses['business_id']) ? $businesses['business_id'] : '' ?>" />
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Signature</label>
|
||||
<input type="file" onchange="validateImage(this)" class="form-control" style="border: 0px !important;" id="signature" name="signature" value="<?= isset($businesses['signature']) ? $businesses['signature'] : null ?>" multiple />
|
||||
<p id="error-message"></p>
|
||||
<div class="after-add-more">
|
||||
<hr />
|
||||
<h4 class="header-title" id="receipt-settings-title">
|
||||
Receipt Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('receipt-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="receipt-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<div>
|
||||
<label for="prefix_format" class="col-form-label">Prefix</label>
|
||||
<input type="text" class="form-control" id="prefix_format" name="prefix_format" placeholder="Receipt Number Format" value="<?= isset($businesses['prefix_format']) ? $businesses['prefix_format'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="left_pad" class="col-form-label">Left Padding</label>
|
||||
<input type="text" class="form-control" id="left_pad" name="left_pad" placeholder="Left Padding Number" value="<?= isset($businesses['left_pad']) ? $businesses['left_pad'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="start_no" class="col-form-label">Start Number</label>
|
||||
<input type="text" class="form-control" id="start_no" name="start_no" value="<?= isset($businesses['start_no']) ? $businesses['start_no'] : '1' ?>" placeholder="Start Number" />
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="bterms" class="col-form-label">Receipt Note</label>
|
||||
<textarea class="form-control" id="terms" name="bterms" rows="5" cols="50"><?= isset($businesses['terms']) ? $businesses['terms'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($businesses['signature'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Current Signature</label>
|
||||
<img src="<?= base_url('public/uploads/' . $businesses['signature']) ?>" alt="Signature" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for Organization id" value="<?= isset($businesses['business_id']) ? $businesses['business_id'] : '' ?>" />
|
||||
|
||||
<?php if (!empty($businesses) && ($loggedin_person_role === 'sadmin')) { ?>
|
||||
<?php if (!empty($details)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
|
||||
</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'] : '' ?>" />
|
||||
<?php if (!empty($businesses) && ($loggedin_person_role === 'sadmin')) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<input type="checkbox" id="bcheckbox" name="bcheckbox" class="form-control" <?= isset($businesses) && $businesses['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="bcheckbox"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="after-add-more">
|
||||
<hr />
|
||||
<h4 class="header-title" id="receipt-settings-title">
|
||||
Receipt Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('receipt-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="receipt-settings" style="display: none;">
|
||||
<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 class="form-group col-md-12">
|
||||
<label for="bterms" class="col-form-label">Receipt Note</label>
|
||||
<textarea class="form-control" id="terms" name="bterms" rows="5" cols="50"><?= isset($businesses['terms']) ? $businesses['terms'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($details)){ ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
|
||||
</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">Save</button>
|
||||
<?php
|
||||
// $business_id=$businesses['business_id'];
|
||||
$business_id = isset($businesses['business_id']) ? $businesses['business_id']: null;
|
||||
// Check if the logged-in user's ID matches the user's ID
|
||||
if ($session_bid == $business_id) {
|
||||
|
||||
// Redirect to the dashboard with logged_user_id parameter
|
||||
$redirect_url = base_url() . "dashboard";
|
||||
} else {
|
||||
// Redirect to the user list
|
||||
$redirect_url = base_url() . "org_list";
|
||||
}
|
||||
?>
|
||||
<!-- -->
|
||||
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
|
||||
$business_id = isset($businesses['business_id']) ? $businesses['business_id'] : null;
|
||||
// Check if the logged-in user's ID matches the user's ID
|
||||
if ($session_bid == $business_id) {
|
||||
|
||||
// Redirect to the dashboard with logged_user_id parameter
|
||||
$redirect_url = base_url() . "dashboard";
|
||||
} else {
|
||||
// Redirect to the user list
|
||||
$redirect_url = base_url() . "org_list";
|
||||
}
|
||||
?>
|
||||
<!-- -->
|
||||
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -452,147 +387,58 @@ Receipt Settings
|
||||
<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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function validateImage(input) {
|
||||
function validateImage(input) {
|
||||
|
||||
const errorMessageElement = document.getElementById('error-message');
|
||||
errorMessageElement.textContent = '';
|
||||
const errorMessageElement = document.getElementById('error-message');
|
||||
errorMessageElement.textContent = '';
|
||||
|
||||
|
||||
const image = input.files[0];
|
||||
const image = input.files[0];
|
||||
|
||||
// Check image type
|
||||
const allowedImageTypes = ['image/jpeg', 'image/png', 'image/gif']; // Add more if needed
|
||||
if (!allowedImageTypes.includes(image.type)) {
|
||||
errorMessageElement.textContent = 'Invalid image type. Please select a JPEG, PNG, or GIF image.';
|
||||
return;
|
||||
}
|
||||
|
||||
const maxWidth = 150;
|
||||
const maxHeight = 100;
|
||||
|
||||
const img = new Image();
|
||||
img.onload = function () {
|
||||
if (img.width > maxWidth || img.height > maxHeight) {
|
||||
errorMessageElement.textContent = `Image dimensions should not exceed ${maxWidth}x${maxHeight}.`;
|
||||
// Check image type
|
||||
const allowedImageTypes = ['image/jpeg', 'image/png', 'image/gif']; // Add more if needed
|
||||
if (!allowedImageTypes.includes(image.type)) {
|
||||
errorMessageElement.textContent = 'Invalid image type. Please select a JPEG, PNG, or GIF image.';
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
img.src = URL.createObjectURL(image);
|
||||
}
|
||||
const maxWidth = 150;
|
||||
const maxHeight = 100;
|
||||
|
||||
const img = new Image();
|
||||
img.onload = function() {
|
||||
if (img.width > maxWidth || img.height > maxHeight) {
|
||||
errorMessageElement.textContent = `Image dimensions should not exceed ${maxWidth}x${maxHeight}.`;
|
||||
}
|
||||
};
|
||||
|
||||
img.src = URL.createObjectURL(image);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('addBranchButton').addEventListener('click', function () {
|
||||
addBranch();
|
||||
});
|
||||
});
|
||||
|
||||
function addBranch(branchData) {
|
||||
var html = '';
|
||||
var i = document.querySelectorAll('.after-shipping-addr-add-more').length + 1; // Get the count of existing branches and increment
|
||||
html += '<div class="after-shipping-addr-add-more" id="branch-settings-' + i + '">';
|
||||
html += '<div class="form-group">';
|
||||
html += '<div class="form-row">';
|
||||
html += '<div class="form-group col-md-6">';
|
||||
html += '<label for="branchname' + i + '" class="col-form-label">Branch Name<span class="text-danger"> </span></label>';
|
||||
html += '<input type="text" class="form-control" id="branchname' + i + '" name="branchname[]" placeholder="Branch Name" required value="' + (branchData && branchData.branch_name ? branchData.branch_name : '') + '" />';
|
||||
html += '<div class="invalid-feedback"> Please provide. </div>';
|
||||
html += '</div>';
|
||||
html += '<div class="form-group col-md-6">';
|
||||
html += '<label for="branchaddress' + i + '" class="col-form-label">Branch Address<span class="text-danger"></span></label>';
|
||||
html += '<input type="text" class="form-control" id="branchaddress' + i + '" name="branchaddress[]" placeholder="Address (eg: 1234 Main St)" required value="' + (branchData && branchData.address ? branchData.address : '') + '" />';
|
||||
html += '<div class="invalid-feedback"> Please provide. </div>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
html += '<div class="form-row">';
|
||||
html += '<div class="form-group col-md-6">';
|
||||
html += '<label for="mobile_no' + i + '" class="col-form-label">Contact Person<span class="text-danger"></span></label>';
|
||||
html += '<input type="number" class="form-control" id="mobile_no' + i + '" name="mobile_no[]" placeholder="Contact Person" required data-parsley-type="number" maxlength="10" value="' + (branchData && branchData.mobile_no ? branchData.mobile_no : '') + '" />';
|
||||
html += '<div class="invalid-feedback"> Please provide. </div>';
|
||||
html += '</div>';
|
||||
html += '<div class="form-group col-md-6">';
|
||||
html += '<label for="email' + i + '" class="col-form-label">Email<span class="text-danger"></span></label>';
|
||||
html += '<input type="email" class="form-control" id="email' + i + '" name="email[]" placeholder="Email" required value="' + (branchData && branchData.email ? branchData.email : '') + '" />';
|
||||
html += '<div class="invalid-feedback"> Please provide. </div>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
html += '<input type="hidden" name="id[]" />';
|
||||
html += '<div class="form-group col-md-12 text-right m-b-0">'
|
||||
html += '<button class="btn btn-success waves-effect waves-light mr-1 add-branch-button">+ Add More Branches </button>';
|
||||
html += '<button class="btn btn-danger waves-effect waves-light mr-1 remove-branch-button" data-branch-id="' + i + '">Remove Branch</button>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
// Append the generated HTML to the container
|
||||
document.getElementById('branchesContainer').insertAdjacentHTML('beforeend', html);
|
||||
|
||||
// Attach event handler to the newly added remove button
|
||||
var removeButton = document.querySelector('#branch-settings-' + i + ' .remove-branch-button[data-branch-id="' + i + '"]');
|
||||
removeButton.addEventListener('click', function() {
|
||||
var branchId = this.getAttribute('data-branch-id');
|
||||
var branchElement = document.getElementById('branch-settings-' + branchId);
|
||||
if (branchElement) {
|
||||
branchElement.remove();
|
||||
function toggleSettings(id) {
|
||||
var settingsDiv = document.getElementById(id);
|
||||
var titleIcon = document.querySelector("#" + id + "-title .toggle-icon");
|
||||
if (settingsDiv.style.display === "none") {
|
||||
settingsDiv.style.display = "block";
|
||||
titleIcon.textContent = "▲"; // Change icon to up arrow
|
||||
} else {
|
||||
settingsDiv.style.display = "none";
|
||||
titleIcon.textContent = "▼"; // Change icon to down arrow
|
||||
}
|
||||
});
|
||||
|
||||
// Attach event handler to the newly added add button
|
||||
var addButton = document.querySelector('#branch-settings-' + i + ' .add-branch-button');
|
||||
addButton.addEventListener('click', function() {
|
||||
addBranch();
|
||||
});
|
||||
}
|
||||
|
||||
// Usage example:
|
||||
<?php foreach ($branches as $branch) : ?>
|
||||
addBranch(<?php echo json_encode($branch); ?>);
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
// Event delegation to handle removing branches
|
||||
// Event delegation to handle adding and removing branches
|
||||
|
||||
|
||||
|
||||
// Event delegation to handle removing branches
|
||||
// document.getElementById('branchesContainer').addEventListener('click', function (event) {
|
||||
// if (event.target.classList.contains('remove-branch-button')) {
|
||||
// var branchId = event.target.getAttribute('data-branch-id');
|
||||
// var branchElement = document.getElementById('branch-settings-' + branchId);
|
||||
// if (branchElement) {
|
||||
// branchElement.remove();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
function toggleSettings(id) {
|
||||
var settingsDiv = document.getElementById(id);
|
||||
var titleIcon = document.querySelector("#"+id+"-title .toggle-icon");
|
||||
if (settingsDiv.style.display === "none") {
|
||||
settingsDiv.style.display = "block";
|
||||
titleIcon.textContent = "▲"; // Change icon to up arrow
|
||||
} else {
|
||||
settingsDiv.style.display = "none";
|
||||
titleIcon.textContent = "▼"; // Change icon to down arrow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('logo').addEventListener('change', function() {
|
||||
@ -652,8 +498,67 @@ function toggleSettings(id) {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var busiBranchArray = <?php echo json_encode($branches); ?>;
|
||||
|
||||
if (busiBranchArray.length > 0) {
|
||||
j = 0;
|
||||
for (var i = 0; i < busiBranchArray.length; i++) {
|
||||
if (i == 0) {
|
||||
var html = $(".after-busi-branch-add-more").first();
|
||||
} else {
|
||||
var html = $(".after-busi-branch-add-more").first().clone();
|
||||
}
|
||||
html.find('input#buiness_branch_id').val(busiBranchArray[i]['id']);
|
||||
html.find('input#mobile_no').val(busiBranchArray[i]['mobile_no']);
|
||||
html.find('input#email').val(busiBranchArray[i]['email']);
|
||||
html.find('input#branchaddress').val(busiBranchArray[i]['address']);
|
||||
html.find('input#branchname').val(busiBranchArray[i]['branch_name']);
|
||||
|
||||
if (i !== 0) {
|
||||
html.find(".busi-branch-div-change").html("<a class='btn btn-success waves-effect waves-light mr-1 busi-branch-add-more'>+ Add More </a><a class='btn btn-danger waves-effect waves-light mr-1 busi-branch-remove'>- Remove </a>");
|
||||
html.insertAfter(".after-busi-branch-add-more:last");
|
||||
}
|
||||
j++;
|
||||
swapButtons();
|
||||
}
|
||||
} else {
|
||||
swapButtons();
|
||||
}
|
||||
|
||||
$("body").on("click", ".busi-branch-add-more", function() {
|
||||
var html = $(".after-busi-branch-add-more").first().clone();
|
||||
var count = $(".after-busi-branch-add-more").length;
|
||||
|
||||
html.find('input').val(''); // Clear input values in the cloned element
|
||||
html.find('input#counter').val(count).prop("readonly", true);
|
||||
html.find(".busi-branch-div-change").html("<a class='btn btn-success waves-effect waves-light mr-1 busi-branch-add-more'>+ Add More </a><a class='btn btn-danger waves-effect waves-light mr-1 busi-branch-remove'>- Remove </a>");
|
||||
html.insertAfter(".after-busi-branch-add-more:last");
|
||||
swapButtons();
|
||||
});
|
||||
|
||||
$("body").on("click", ".busi-branch-remove", function() {
|
||||
var rows = $(".after-busi-branch-add-more");
|
||||
if (rows.length > 1) {
|
||||
$(this).parents(".after-busi-branch-add-more").remove();
|
||||
} else {
|
||||
alert("At least one Shipping Address must be displayed.");
|
||||
}
|
||||
swapButtons();
|
||||
});
|
||||
|
||||
function swapButtons() {
|
||||
var elementCount = $(".after-busi-branch-add-more").length;
|
||||
if (elementCount > 1) {
|
||||
$(".busi-branch-remove").show(); // Show the "busi-branch-remove" buttons
|
||||
} else {
|
||||
$(".busi-branch-remove").hide(); // Hide the "busi-branch-remove" buttons
|
||||
}
|
||||
$(".after-busi-branch-add-more .busi-branch-add-more").hide();
|
||||
$(".after-busi-branch-add-more:last .busi-branch-add-more").show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
<input type="hidden" id="campaign_id" name="campaign_id" placeholder="hidden for template id" value="<?= isset($campaign_details['campaign_id']) ? $campaign_details['campaign_id'] : '' ?>" />
|
||||
<?php if (!empty($campaign_details)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($campaign_details) && $campaign_details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="DonorType" class="col-form-label">Contributor Type<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="DonorType" name="DonorType" required disabled>
|
||||
<option value="" disabled>Select Contributor Type</option>
|
||||
<option value="" disabled>--Select--</option>
|
||||
<option value="option1" <?= isset($customer['donor_type']) && $customer['donor_type'] === 'option1' ? 'selected' : '' ?>>Individual</option>
|
||||
<option value="option2" <?= isset($customer['donor_type']) && $customer['donor_type'] === 'option2' ? 'selected' : '' ?>>Organization</option>
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bcountry" class="col-form-label">Country</label>
|
||||
<select class="form-control" id="bcountry" name="country">
|
||||
<option value="<?= isset($customer['country']) ? $customer['country'] : '';?>"><?= isset($customer['country']) ? $customer['country'] : 'Choose your Country';?></option>
|
||||
<option value="<?= isset($customer['country']) ? $customer['country'] : '';?>"><?= isset($customer['country']) ? $customer['country'] : '--Select--';?></option>
|
||||
<?php foreach ($country_details as $value) { ?>
|
||||
<option value="<?php echo $value['country_name']; ?>">
|
||||
<?php
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url()."view_donor_group/0"; ?>" class="btn btn-primary"><i class="ri-team-line"></i> Add Contributor Group </a>
|
||||
<a href="<?= base_url()."view_contributor_group/0"; ?>" class="btn btn-primary"><i class="ri-team-line"></i> Add Contributor Group </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
@ -52,10 +52,10 @@
|
||||
<td><?= $group['created_by_name']; ?></td>
|
||||
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
|
||||
<td>
|
||||
<a href="<?= base_url() . "view_donor_group/" . $group['group_id']; ?>" class="edit-button" title="Edit" ><i class="ri-pencil-line"></i></a>
|
||||
<a class="preview-button" title="Customer list" data-toggle="modal" data-target="#scrollable-modal" data-primary-key="<?php echo $group['group_id']; ?>" data-group-name="<?php echo $group['group_name']; ?>"><i class="ri-pages-line"></i></a>
|
||||
<a href="<?= base_url() . "view_contributor_group/" . $group['group_id']; ?>" class="edit-button" title="Edit" ><i class="ri-pencil-line"></i></a>
|
||||
<a class="preview-button" title="preview" data-toggle="modal" data-target="#scrollable-modal" data-primary-key="<?php echo $group['group_id']; ?>" data-group-name="<?php echo $group['group_name']; ?>"><i class="ri-pages-line"></i></a>
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<?php if ($group['isactive']) { ?> <a href="<?= base_url() . "delete_donor_group/" . $group['group_id']; ?>" class="delete-button" title="Delete" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
|
||||
<?php if ($group['isactive']) { ?> <a href="<?= base_url() . "delete_contributor_group/" . $group['group_id']; ?>" class="delete-button" title="Delete" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -118,7 +118,7 @@ $(document).ready(function() {
|
||||
|
||||
// Get the table reference
|
||||
var table = $("#data-table tbody");
|
||||
var route = "<?= base_url().'preview_donor_group/'?>"+primaryKey;
|
||||
var route = "<?= base_url().'preview_contributor_group/'?>"+primaryKey;
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"></p>
|
||||
<form id="myForm" class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor_group"; ?>" >
|
||||
<form id="myForm" class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_contributor_group"; ?>" >
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="groupname" class="col-form-label">Group Name<span class="text-danger"> *</span></label>
|
||||
@ -115,7 +115,7 @@
|
||||
<button type="button" id="addItem" class="btn btn-soft-dark btn-rounded waves-effect waves-light mr-3 add-item"> + Add New Criteria</button>
|
||||
</div>
|
||||
<?php if (!empty($donor_group)) { ?>
|
||||
<div class="form-group text-right checkbox checkbox-purple mr-3">
|
||||
<div class="form-group text-right checkbox checkbox-purple mr-3" style="display: none;">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($donor_group) && $donor_group['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
@ -456,7 +456,7 @@ document.getElementById("addItem").addEventListener("click", function() {
|
||||
var table = $("#data-table tbody");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'insert_donor_group' ?>",
|
||||
url: "<?= base_url() . 'insert_contributor_group' ?>",
|
||||
data: formData,
|
||||
dataType: "json", // Expect JSON response
|
||||
success: function(response) {
|
||||
|
||||
@ -1,68 +1,96 @@
|
||||
<style>
|
||||
td .select2-container{
|
||||
td .select2-container {
|
||||
width: 249px !important;
|
||||
}
|
||||
|
||||
.fe-plus-circle:hover {
|
||||
color: #ff0000; /* Change to the desired hover color */
|
||||
}
|
||||
color: #ff0000;
|
||||
/* Change to the desired hover color */
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-6"><h4 class="header-title"><?= $page_name; ?></h4></div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<form method="POST" enctype="multipart/form-data" action="<?= base_url() . "save_invoice"; ?>" class="main-form" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="receipt_type" class="col-form-label">Type</label>
|
||||
|
||||
<input type="radio" class="receipt_type" name="receipt_type" value="option1" <?php if ($receipt_type == "option1") echo "checked"; ?> onchange="get_donor_details(this.value);">
|
||||
Individual
|
||||
|
||||
<input type="radio" class="receipt_type" name="receipt_type" value="option2" <?php if ($receipt_type == "option2") echo "checked"; ?> onchange="get_donor_details(this.value);">
|
||||
Organization
|
||||
<!-- <select class="form-control" id="receipt_type" onchange="get_donor_details(this.value);">
|
||||
<option value="option1" <?php if ($receipt_type == "option1") {
|
||||
echo "selected";
|
||||
} ?> >Individual</option>
|
||||
<option value="option2" <?php if ($receipt_type == "option2") {
|
||||
echo "selected";
|
||||
} ?> >Organization</option>
|
||||
</select> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="customerMobile" class="col-form-label">Donor Mobile<span class="text-danger"> *</span></label>
|
||||
<?php if(get_user_role() != 'accounts') { ?>
|
||||
<!-- <?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 } ?>
|
||||
<?php } ?> -->
|
||||
<select class="form-control" id="donor_mobile" name="donor_mobile" required data-toggle="select2">
|
||||
<option value="">--Select--</option>
|
||||
<?php foreach ($customers as $customer) : ?>
|
||||
<option value="<?= $customer->mobile_no ?>" <?php if (isset($receipt_details['donor_id']) && ($receipt_details['donor_id'] == $customer->donor_id)) echo "selected"; ?> > <?= $customer->mobile_no ?> </option>
|
||||
<?php if (get_user_role() != 'accounts') { ?> <option class="blueText" value="0"> + Add a donor</option> <?php } ?>
|
||||
<?php foreach ($typebaseddonors as $customer) : ?>
|
||||
<option value="<?= $customer->mobile_no ?>" <?php if (isset($receipt_details['donor_id']) && ($receipt_details['donor_id'] == $customer->donor_id)) echo "selected"; ?>> <?= $customer->mobile_no ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<label for="donor_first_name" class="col-form-label">Donor Name<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="donor_first_name" name="donor_id" required data-toggle="select2">
|
||||
<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 if (get_user_role() != 'accounts') { ?> <option class="blueText" value="0"> + Add a donor</option><?php } ?>
|
||||
<?php foreach ($typebaseddonors 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>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="event" class="col-form-label">Causes<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="event" name="causes_id" required >
|
||||
<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->name ?> <?= ($causesData->from_date != '') ? '('. 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 class="form-control" id="event" name="causes_id" required>
|
||||
<option value="">--Select--</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->name ?> <?= ($causesData->from_date != '') ? '(' . 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>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="event" class="col-form-label">Campaign</label>
|
||||
<select class="form-control" id="campaign" name="campaign_id" data-toggle="select2" >
|
||||
<option value="">Select the Campaign</option>
|
||||
<?php foreach ($campaign as $cam) : if(date("Y-m-d") >= $cam->start_date && date("Y-m-d") <= $cam->end_date || $cam->start_date == '' && $cam->end_date == ''){?>
|
||||
<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 class="form-control" id="campaign" name="campaign_id" data-toggle="select2">
|
||||
<option value="">--Select--</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 ?> ( <?= date("d-m-Y", strtotime($cam->start_date)) ?> - <?= date("d-m-Y", strtotime($cam->end_date)) ?> )</option>
|
||||
<?php }
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -80,37 +108,49 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-1">
|
||||
<label for="csname" class="col-form-label">Currency<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="currency" name="currency" data-toggle="select2" required>
|
||||
<?php
|
||||
$currencies = explode(",", $currency[0]['currency']);
|
||||
$selectedCurrency = isset($receipt_details['currency']) ? $receipt_details['currency'] : '';
|
||||
?>
|
||||
<?php foreach ($currencies as $index => $currencyOption) : ?>
|
||||
<option value="<?= $currencyOption ?>" <?= ($index === 0 || $selectedCurrency === $currencyOption) ? 'selected' : '' ?>>
|
||||
<?= $currencyOption ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
<label for="csname" class="col-form-label">Currency<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="currency" name="currency" data-toggle="select2" required>
|
||||
<?php
|
||||
$currencies = explode(",", $currency[0]['currency']);
|
||||
$selectedCurrency = isset($receipt_details['currency']) ? $receipt_details['currency'] : '';
|
||||
?>
|
||||
<?php foreach ($currencies as $index => $currencyOption) : ?>
|
||||
<option value="<?= $currencyOption ?>" <?= ($index === 0 || $selectedCurrency === $currencyOption) ? 'selected' : '' ?>>
|
||||
<?= $currencyOption ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-5">
|
||||
<label for="csname" class="col-form-label">Amount<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="org_name_field" name="amount" value="<?= isset($receipt_details['amount']) ? $receipt_details['amount'] : '' ?>" placeholder="Amount" oninput="this.value = this.value.replace(/[^0-9]/g, '')" required />
|
||||
<input type="text" class="form-control" id="org_name_field" name="amount" value="<?= isset($receipt_details['amount']) ? $receipt_details['amount'] : '' ?>" placeholder="Amount" oninput="this.value = this.value.replace(/[^0-9]/g, '')" required maxlength="9" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="invoiceDate" class="col-form-label">Payment Mode<span class="text-danger"> *</span></label>
|
||||
<select class="form-control" id="paymentMode" name="payment_mode" required>
|
||||
<option value="" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == '' ) { echo 'selected'; } ?> >Select Payment Mode</option>
|
||||
<option value="credit" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'credit' ) { echo 'selected'; } ?>>Credit Card</option>
|
||||
<option value="debit" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'debit' ) { echo 'selected'; } ?>>Debit Card</option>
|
||||
<option value="cash" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'cash' ) { echo 'selected'; } ?>>Cash</option>
|
||||
<option value="upi" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'upi' ) { echo 'selected'; } ?>>UPI</option>
|
||||
<option value="banktransfer" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'banktransfer' ) { echo 'selected'; } ?>>Bank Transfer</option>
|
||||
</select>
|
||||
</div>
|
||||
<option value="" <?php if (isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == '') {
|
||||
echo 'selected';
|
||||
} ?>>--Select--</option>
|
||||
<option value="credit" <?php if (isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'credit') {
|
||||
echo 'selected';
|
||||
} ?>>Credit Card</option>
|
||||
<option value="debit" <?php if (isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'debit') {
|
||||
echo 'selected';
|
||||
} ?>>Debit Card</option>
|
||||
<option value="cash" <?php if (isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'cash') {
|
||||
echo 'selected';
|
||||
} ?>>Cash</option>
|
||||
<option value="upi" <?php if (isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'upi') {
|
||||
echo 'selected';
|
||||
} ?>>UPI</option>
|
||||
<option value="banktransfer" <?php if (isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'banktransfer') {
|
||||
echo 'selected';
|
||||
} ?>>Bank Transfer</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="invoiceDate" class="col-form-label">Payment Reference No</label>
|
||||
<input type="text" class="form-control" id="invoiceDate" name="payment_ref_no" value="<?= isset($receipt_details['payment_ref_no']) ? $receipt_details['payment_ref_no'] : '' ?>" placeholder="Payment Reference No">
|
||||
@ -126,7 +166,7 @@
|
||||
</div>
|
||||
<input type="hidden" id="hiddenInvoiceId" name="receipt_id" placeholder="hidden for invoice id" value="<?= isset($receipt_details['receipt_id']) ? $receipt_details['receipt_id'] : '' ?>" />
|
||||
<div class="form-group text-right m-b-0">
|
||||
<?php if(get_user_role() != 'accounts') { ?>
|
||||
<?php if (get_user_role() != 'accounts') { ?>
|
||||
<button type="submit" class="btn btn-primary waves-effect mr-1" name="saveas" value="Draft" id="saveDraftButton"><?= isset($receipt_details['receipt_id']) ? 'Update' : 'Save' ?></button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@ -159,25 +199,25 @@
|
||||
<!-- Your existing JavaScript code -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#myForm').submit(function (e) {
|
||||
$(document).ready(function() {
|
||||
$('#myForm').submit(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?= base_url("save_invoice"); ?>',
|
||||
data: $(this).serialize(),
|
||||
success: function (response) {
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
$('#successModal').modal('show');
|
||||
$('#downloadButton').attr('href', "<?= base_url('generate_invoice_pdf/'); ?>" + response.invoice_id);
|
||||
|
||||
|
||||
} else {
|
||||
// Handle errors or display a different modal for failure
|
||||
console.log(response.message);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
error: function(error) {
|
||||
console.log('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
@ -186,167 +226,212 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var data = <?php echo json_encode($customers); ?>;
|
||||
var editdata = <?php echo json_encode($receipt_details); ?>;
|
||||
console.log(editdata,'data');
|
||||
var data = <?php echo json_encode($typebaseddonors); ?>;
|
||||
var alldonors = <?php echo json_encode($alldonors); ?>;
|
||||
var editdata = <?php echo json_encode($receipt_details); ?>;
|
||||
$(function() {
|
||||
|
||||
$(function() {
|
||||
// onload function
|
||||
// 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 you have a select element with the id `#donor_select`
|
||||
// $('#customerName').html(options);
|
||||
// }
|
||||
$('#donor_mobile').on('change', function() {
|
||||
if ($(this).val()) {
|
||||
if ($(this).val() == '0') {
|
||||
$('#standard-modal').modal('show');
|
||||
} else {
|
||||
$('#standard-modal').modal('hide');
|
||||
$('#donor-form-submit').prop('disabled', false);
|
||||
}
|
||||
if ($(this).val() != '0') {
|
||||
var selectedMobile = $(this).val();
|
||||
var options = '<option value="">--Select--</option>';
|
||||
|
||||
$('#donor_mobile').on('change', function(){
|
||||
console.log($(this).val());
|
||||
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 `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`
|
||||
$('#donor_first_name').html(options);
|
||||
}
|
||||
} else {
|
||||
var selectedMobile = $(this).val();
|
||||
var options = '<option value="">--Select--</option>';
|
||||
options += '<option value="0">+ Add 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`
|
||||
$('#donor_first_name').html(options);
|
||||
}
|
||||
});
|
||||
|
||||
$('#donor_first_name').on('change', function() {
|
||||
var type = $('.receipt_type:checked').val();
|
||||
if ($(this).val() == '0') {
|
||||
$('#standard-modal').modal('show');
|
||||
} else {
|
||||
$('#standard-modal').modal('hide');
|
||||
$('#donor-form-submit').prop('disabled', false);
|
||||
if (type == "option2") {
|
||||
|
||||
var selectedID = $(this).val();
|
||||
var options = '<option value="">--Select--</option>';
|
||||
options += '<option value="0">+ Add a donor</option>';
|
||||
// Filter the donors array based on the selectedID
|
||||
var filter_array = alldonors.filter(function(d) {
|
||||
return d.donor_id === selectedID;
|
||||
});
|
||||
|
||||
|
||||
if (filter_array.length > 0) {
|
||||
|
||||
var donor = filter_array[0];
|
||||
options += `<option value="${donor.mobile_no}" selected>${donor.mobile_no}</option>`;
|
||||
}
|
||||
|
||||
// Set the options to the donor_mobile select element
|
||||
$('#donor_mobile').html(options);
|
||||
}
|
||||
}
|
||||
|
||||
// Assuming you have a select element with the id `#donor_select`
|
||||
$('#customerName').html(options);
|
||||
}
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
$(function() {
|
||||
$('#donor_mobile').on('change', function(){
|
||||
var selectedMobile = $(this).val();
|
||||
|
||||
// Find the donor with the selected mobile number
|
||||
var matchingDonor = data.find(donor => donor.mobile_no == selectedMobile);
|
||||
|
||||
// Set the donor name directly if there's a matching donor
|
||||
if (matchingDonor) {
|
||||
$('#customerName').val(matchingDonor.donor_id).trigger('change');
|
||||
} else {
|
||||
// If there's no matching donor or multiple donors, reset the donor name input
|
||||
$('#customerName').val('').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(function() {
|
||||
$('#form-submit').on('click', function(){
|
||||
console.log('edakfibsefui');
|
||||
$(function() {
|
||||
$('#donor-form-submit').on('click', function() {
|
||||
// Disable the button to prevent multiple clicks
|
||||
if ($('.myForm')[0].checkValidity()) {
|
||||
if ($('.donorForm')[0].checkValidity()) {
|
||||
this.disabled = true;
|
||||
}
|
||||
$('#submitBtn').click();
|
||||
// Perform any other actions (e.g., form submission)
|
||||
// For example, you can use AJAX to submit the form data
|
||||
// $('#submitBtn').click();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'insert_ajaxdonor' ?>",
|
||||
data: $('#donorForm').serialize(),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response['data']['status']) {
|
||||
dropdown = response['data']['donor'];
|
||||
alert(response['data']['message']);
|
||||
if (dropdown.length > 0) {
|
||||
$('#donor_mobile').empty().append($('<option>', {
|
||||
value: "",
|
||||
text: "--Select--"
|
||||
}));
|
||||
$('#donor_mobile').append($('<option>', {
|
||||
value: "0",
|
||||
text: "+ Add a donor"
|
||||
}));
|
||||
$('#donor_first_name').empty().append($('<option>', {
|
||||
value: "",
|
||||
text: "--Select--"
|
||||
}));
|
||||
$('#donor_first_name').append($('<option>', {
|
||||
value: "0",
|
||||
text: "+ Add a donor"
|
||||
}));
|
||||
$.each(dropdown, function(k, v) {
|
||||
$('#donor_mobile').append($('<option>', {
|
||||
value: v.mobile_no,
|
||||
text: v.mobile_no,
|
||||
selected: (v.donor_id == response['data']['donor_id']) ? true : false
|
||||
}));
|
||||
$('#donor_first_name').append($('<option>', {
|
||||
value: v.donor_id,
|
||||
text: v.first_name,
|
||||
selected: (v.donor_id == response['data']['donor_id']) ? true : false
|
||||
}));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
alert(response['data']['message']);
|
||||
}
|
||||
$('#standard-modal').modal('hide');
|
||||
// Reset the form
|
||||
$('#donorForm').get(0).reset();
|
||||
$('#donor-form-submit').prop('disabled', false);
|
||||
},
|
||||
error: function() {
|
||||
alert("Error occur.");
|
||||
$('#donor-form-submit').prop('disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$('#saveDraftButton').on('click', function() {
|
||||
// Check if the form is valid
|
||||
if ($('.main-form')[0].checkValidity()) {
|
||||
// Disable the button to prevent multiple clicks
|
||||
$(this).prop('disabled', true);
|
||||
|
||||
$(function() {
|
||||
$('#saveDraftButton').on('click', function(){
|
||||
// Check if the form is valid
|
||||
if ($('.main-form')[0].checkValidity()) {
|
||||
// Disable the button to prevent multiple clicks
|
||||
$(this).prop('disabled', true);
|
||||
|
||||
// Submit the form
|
||||
$('.main-form').submit();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// hide all fields for account login
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "accounts" || 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');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
// Submit the form
|
||||
$('.main-form').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#add-quk-donar').attr('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for input
|
||||
// var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('readonly', false);
|
||||
// });
|
||||
// // for select
|
||||
// var formElements = document.querySelectorAll('form select');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('disabled', false);
|
||||
// });
|
||||
}
|
||||
});
|
||||
function restriction(event) {
|
||||
var charCode = event.which || event.keyCode;
|
||||
if ((charCode >= 48 && charCode <= 57)) {
|
||||
return true;
|
||||
} else {
|
||||
event.preventDefault(); // Prevent the character from being entered
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// hide all fields for account login
|
||||
$(function() {
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if (role == "accounts" || 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');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
|
||||
$('#add-quk-donar').attr('disabled', true);
|
||||
} else {
|
||||
// for input
|
||||
// var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('readonly', false);
|
||||
// });
|
||||
// // for select
|
||||
// var formElements = document.querySelectorAll('form select');
|
||||
// formElements.forEach(function(element) {
|
||||
// element.setAttribute('disabled', false);
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
function restriction(event) {
|
||||
var charCode = event.which || event.keyCode;
|
||||
if ((charCode >= 48 && charCode <= 57)) {
|
||||
return true;
|
||||
} else {
|
||||
event.preventDefault(); // Prevent the character from being entered
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#org_details_form').hide();
|
||||
|
||||
|
||||
$('#DonorType').on('change', function(){
|
||||
$('#DonorType').on('change', function() {
|
||||
|
||||
let DonorType = $(this).val();
|
||||
|
||||
if(DonorType === 'option2'){
|
||||
if (DonorType === 'option2') {
|
||||
$('#org_details_form').show();
|
||||
$('#org_name_fie').prop('required', true);
|
||||
$('#pan_no_org').prop('required', true);
|
||||
$('#org_reg_details').prop('required', true);
|
||||
$('#pan_no').prop('required', false);
|
||||
$('#ind_pan').hide();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$('#org_details_form').hide();
|
||||
$('#org_name_fie').prop('required', false);
|
||||
$('#pan_no_org').prop('required', false);
|
||||
@ -357,7 +442,6 @@ $(document).ready(function(){
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Standard modal content -->
|
||||
@ -369,16 +453,16 @@ $(document).ready(function(){
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="needs-validation myForm" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor"; ?>" id="myForm" name="myForm">
|
||||
|
||||
<input type="hidden" name="new_receipt" value="new_receipt"/>
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?php echo get_business_id() ?>" />
|
||||
<form class="needs-validation donorForm" novalidate method="POST" enctype="multipart/form-data" id="donorForm" name="donorForm">
|
||||
|
||||
<input type="hidden" name="new_receipt" value="new_receipt" />
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?php echo get_business_id() ?>" />
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<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="<?= isset($receipt_details['donor_type']) ? $receipt_details['donor_type'] : '' ?>"><?= isset($receipt_details['donor_type']) ? ($receipt_details['donor_type'] === 'option1' ? 'Individual' : ($receipt_details['donor_type'] === 'option2' ? 'Organization' : 'Select Donor Type')) : 'Select Donor Type'; ?></option>
|
||||
<option value="<?= isset($receipt_details['donor_type']) ? $receipt_details['donor_type'] : '' ?>"><?= isset($receipt_details['donor_type']) ? ($receipt_details['donor_type'] === 'option1' ? 'Individual' : ($receipt_details['donor_type'] === 'option2' ? 'Organization' : '--Select--')) : '--Select--'; ?></option>
|
||||
<option value="option1">Individual</option>
|
||||
<option value="option2">Organization</option>
|
||||
</select>
|
||||
@ -389,15 +473,15 @@ $(document).ready(function(){
|
||||
<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_fie" name="org_name" value="" placeholder="Organization Name" >
|
||||
<label for="org_name" class="col-form-label">Organization Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="org_name_fie" 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<span class="text-danger"> *</span></label>
|
||||
<label for="o_pan_no" class="col-form-label"><span class="contactPerson">Organization PAN Number<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="pan_no_org" name="o_pan_no" value="" placeholder="PAN Number" oninput="validatePANFormatOrg(this)" />
|
||||
<div id="panNoErrors" style="display: none; color: red;">Invalid PAN format</div>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
@ -406,8 +490,8 @@ $(document).ready(function(){
|
||||
|
||||
<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"/>
|
||||
<label for="org_reg_Details" 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>
|
||||
@ -424,15 +508,15 @@ $(document).ready(function(){
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>Email<span class="text-danger"> *</span></label>
|
||||
<input type="email" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide a valid email address. </div>
|
||||
<label for="cmail" class="col-form-label"><span class="contactPerson">Contact Person </span>Email<span class="text-danger"> *</span></label>
|
||||
<input type="email" class="form-control" id="cmail" name="cmail" value="<?= isset($receipt_details['email']) ? $receipt_details['email'] : '' ?>" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide a valid email address. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="ind_pan">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="csname" class="col-form-label">PAN Number<span class="text-danger"> *</span></label>
|
||||
<label for="pan_no" 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" oninput="validatePANFormat(this)" required />
|
||||
<div id="panNoError" style="display: none; color: red;">Invalid PAN format</div>
|
||||
|
||||
@ -451,27 +535,27 @@ $(document).ready(function(){
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit" hidden></button>
|
||||
<!-- <button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit" hidden></button> -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
|
||||
<button type="button" id="form-submit" class="btn btn-primary">Save changes</button>
|
||||
<button type="button" id="donor-form-submit" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
function validateEmailFormat(email) {
|
||||
var emailPattern = /^(.+)@(gmail\.com|yahoo\.com|hotmail\.com|[^@]+\.com\.org)$/i;
|
||||
function validateEmailFormat(email) {
|
||||
var emailPattern = /^(.+)@(gmail\.com|yahoo\.com|hotmail\.com|[^@]+\.com\.org)$/i;
|
||||
|
||||
if (!emailPattern.test(email)) {
|
||||
alert("Please provide a valid email addres");
|
||||
// You can also update the UI to indicate the error, e.g., by adding a class to the input field.
|
||||
// Example: $('#cmail').addClass('is-invalid');
|
||||
}
|
||||
}
|
||||
if (!emailPattern.test(email)) {
|
||||
alert("Please provide a valid email addres");
|
||||
// You can also update the UI to indicate the error, e.g., by adding a class to the input field.
|
||||
// Example: $('#cmail').addClass('is-invalid');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function validatePANFormat(input) {
|
||||
@ -489,8 +573,8 @@ if (!emailPattern.test(email)) {
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#invoiceDate').on('change', function () {
|
||||
$(document).ready(function() {
|
||||
$('#invoiceDate').on('change', function() {
|
||||
var selectedDate = new Date($(this).val());
|
||||
var currentDate = new Date();
|
||||
|
||||
@ -500,9 +584,52 @@ if (!emailPattern.test(email)) {
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
function get_donor_details(option) {
|
||||
|
||||
$('#donor_mobile').val("");
|
||||
$('#donor_first_name').val("");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'get_donor_details' ?>",
|
||||
data: {
|
||||
donor_type: option
|
||||
},
|
||||
success: function(response) {
|
||||
donor = response['data']['donor_details'];
|
||||
if (donor.length > 0) {
|
||||
$('#donor_mobile').empty().append($('<option>', {
|
||||
value: "",
|
||||
text: "--Select--"
|
||||
}));
|
||||
$('#donor_mobile').append($('<option>', {
|
||||
value: "0",
|
||||
text: "+ Add a donor"
|
||||
}));
|
||||
$('#donor_first_name').empty().append($('<option>', {
|
||||
value: "",
|
||||
text: "--Select--"
|
||||
}));
|
||||
$('#donor_first_name').append($('<option>', {
|
||||
value: "0",
|
||||
text: "+ Add a donor"
|
||||
}));
|
||||
$.each(donor, function(k, v) {
|
||||
$('#donor_mobile').append($('<option>', {
|
||||
value: v.mobile_no,
|
||||
text: v.mobile_no
|
||||
}));
|
||||
$('#donor_first_name').append($('<option>', {
|
||||
value: v.donor_id,
|
||||
text: v.first_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
alert("Error Occur.");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -208,7 +208,7 @@
|
||||
<input type="hidden" id="setting_id" name="setting_id" placeholder="hidden for setting id" value="<?= isset($details['setting_id']) ? $details['setting_id'] : '' ?>" />
|
||||
|
||||
<?php if(!empty($details)){ ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control"
|
||||
<?= isset($details) && $details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
|
||||
@ -124,19 +124,23 @@
|
||||
<span> Dashboard </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($loggedin_person_role !== 'sadmin') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."receipt_list"; ?>">
|
||||
<i class="fe-file-text"></i>
|
||||
<span> Receipts </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'sadmin') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."Contributor_list"; ?>">
|
||||
<i class="ri-map-pin-user-fill"></i>
|
||||
<span> Contributor </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."audit_history"; ?>">
|
||||
<i class="ri-history-fill"></i>
|
||||
@ -144,9 +148,6 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."causes_list"; ?>">
|
||||
@ -178,15 +179,15 @@
|
||||
<span> Org Settings </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?> -->
|
||||
<?php endif; ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."appsetting_page/1"; ?>">
|
||||
<a href="<?= base_url()."appsetting_page"; ?>">
|
||||
<i class="ri-list-settings-line"></i>
|
||||
<span> App Settings </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?> -->
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."campaign_list"; ?>">
|
||||
@ -239,7 +240,7 @@
|
||||
<ul class="nav-second-level">
|
||||
<?php if ($loggedin_person_role !== 'volunteer' && $loggedin_person_role !== 'sadmin' && $loggedin_person_role !== 'accounts') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."donor_group"; ?>">
|
||||
<a href="<?= base_url()."contributor_group"; ?>">
|
||||
<i class="ri-team-line"></i>
|
||||
<span> Contributor Groups </span>
|
||||
</a>
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
</div>
|
||||
|
||||
<!-- item-->
|
||||
<a href="<?= base_url()."user_page/".$loggedin_person_id; ?>" class="dropdown-item notify-item">
|
||||
<a href="<?= base_url()."user_page/".$loggedin_person_id."/1"; ?>" class="dropdown-item notify-item">
|
||||
<i class="ri-account-circle-line"></i>
|
||||
<span>My Account</span>
|
||||
</a>
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
</div>
|
||||
<input type="hidden" id="template_id" name="template_id" placeholder="hidden for template id" value="<?= isset($template_details['template_id']) ? $template_details['template_id'] : '' ?>" />
|
||||
<?php if (!empty($template_details)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($template_details) && $template_details['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<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="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 alert-dismissible fade show" role="alert">
|
||||
<?= session('success') ?>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
@ -11,270 +11,260 @@
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form class="parsley-examples" action="<?= base_url() . "insert_users"; ?>" method="post" enctype="multipart/form-data" id="myForm">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="first_name" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<input 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">Phone Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Phone Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
|
||||
<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="volunteer" <?= isset($details['role']) && $details['role'] === 'volunteer' ? 'selected' : '' ?>>Volunteer</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-4">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?= isset($details['email']) ? $details['email'] : '' ?>" required />
|
||||
</div>
|
||||
<?php if (empty($details)) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="password" class="col-form-label">Password<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="password" name="password" placeholder="Password" value="<?= isset($details['password']) ? $details['password'] : '' ?>" required />
|
||||
</div>
|
||||
<?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="" 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">
|
||||
|
||||
<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>
|
||||
<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 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">Phone Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Phone Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
|
||||
<select id="role" name="role" class="form-control" required>
|
||||
<option value="">--Select--</option>
|
||||
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
|
||||
<option value="volunteer" <?= isset($details['role']) && $details['role'] === 'volunteer' ? 'selected' : '' ?>>Volunteer</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>
|
||||
<?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 !== 'volunteer') { ?>
|
||||
<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 } ?>
|
||||
<?php if ($loggedin_person_role === 'sadmin') { ?>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<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-6">
|
||||
<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>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?= isset($details['email']) ? $details['email'] : '' ?>" required />
|
||||
</div>
|
||||
<?php if (empty($details)) { ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="password" class="col-form-label">Password<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="password" name="password" placeholder="Password" value="<?= isset($details['password']) ? $details['password'] : '' ?>" required />
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?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--</option>
|
||||
<?php 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; ?>
|
||||
</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-3">
|
||||
<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-3">
|
||||
<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 class="form-group col-md-2">
|
||||
<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>
|
||||
<div class="form-row">
|
||||
<?php if (!empty($details['profile_picture'])) { ?>
|
||||
<div class="form-group col-md-4 mt-3">
|
||||
<div class="media">
|
||||
|
||||
<!-- ... (existing code) -->
|
||||
<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'] : '' ?>" />
|
||||
<input type="hidden" id="dummy_flag" name="dummy_flag" placeholder="hidden for dummy flag redirect purpose" value="<?= isset($dummy_flag) ? $dummy_flag : '' ?>" />
|
||||
<?php if (!empty($details) && $loggedin_person_role !== 'volunteer') { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<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">
|
||||
Save
|
||||
</button>
|
||||
<?php if (isset($success_message)) : ?>
|
||||
<div class="alert alert-success"><?= esc($success_message) ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">
|
||||
<?= isset($details['user_id']) ? 'Update' : 'Save' ?>
|
||||
</button>
|
||||
<?php if (isset($success_message)) : ?>
|
||||
<div class="alert alert-success"><?= esc($success_message) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if ($loggedin_person_role !== 'volunteer') : ?>
|
||||
<?php
|
||||
// Assuming $session_uid holds the ID of the logged-in user
|
||||
// Assuming $details['user_id'] holds the ID of the user being edited
|
||||
$user_id = isset($details['user_id']) ? $details['user_id'] : null;
|
||||
|
||||
// Check if the logged-in user's ID matches the user's ID
|
||||
if ($session_uid == $user_id) {
|
||||
// Redirect to the dashboard with logged_user_id parameter
|
||||
$redirect_url = base_url() . "dashboard";
|
||||
} else {
|
||||
// Redirect to the user list
|
||||
$redirect_url = base_url() . "user_list";
|
||||
}
|
||||
?>
|
||||
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<?php if ($loggedin_person_role !== 'volunteer') : ?>
|
||||
<?php
|
||||
// Assuming $session_uid holds the ID of the logged-in user
|
||||
// Assuming $details['user_id'] holds the ID of the user being edited
|
||||
$user_id = isset($details['user_id']) ? $details['user_id'] : null;
|
||||
|
||||
<!-- -->
|
||||
// Check if the logged-in user's ID matches the user's ID
|
||||
if ($session_uid == $user_id) {
|
||||
// Redirect to the dashboard with logged_user_id parameter
|
||||
$redirect_url = base_url() . "dashboard";
|
||||
} else {
|
||||
// Redirect to the user list
|
||||
$redirect_url = base_url() . "user_list";
|
||||
}
|
||||
?>
|
||||
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- end card-body-->
|
||||
</div>
|
||||
<!-- end card-->
|
||||
</div>
|
||||
<!-- end col-->
|
||||
<!-- -->
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- end card-body-->
|
||||
</div>
|
||||
<!-- end card-->
|
||||
</div>
|
||||
<!-- end col-->
|
||||
</div>
|
||||
<!-- 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);
|
||||
});
|
||||
}
|
||||
});
|
||||
$(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
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
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 () {
|
||||
$(document).ready(function() {
|
||||
// Function to fetch branches based on selected organization
|
||||
function fetchBranches(selectedBusinessId, preSelectedBranchId) {
|
||||
var businessBranchDropdown = $('#branch_id');
|
||||
|
||||
// Clear existing options
|
||||
businessBranchDropdown.empty().append('<option value="">Choose Organization Branch</option>');
|
||||
businessBranchDropdown.empty().append('<option value="">--Select--</option>');
|
||||
|
||||
// Fetch branches via AJAX
|
||||
$.ajax({
|
||||
url: '<?= base_url('users/get_branches') ?>/' + selectedBusinessId,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
console.log('Response from server:', response); // Log the response for debugging
|
||||
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
|
||||
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
|
||||
$.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);
|
||||
|
||||
@ -286,20 +276,20 @@
|
||||
businessBranchDropdown.append(option);
|
||||
});
|
||||
} else {
|
||||
console.log('No branches available.'); // Log if no branches are available
|
||||
console.log('No branches available.'); // Log if no branches are available
|
||||
businessBranchDropdown.append('<option value="">No branches available</option>');
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
error: function(error) {
|
||||
console.error('Error fetching branches:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Change event handler for the organization dropdown
|
||||
$('#business_id').change(function () {
|
||||
$('#business_id').change(function() {
|
||||
var selectedBusinessId = $(this).val();
|
||||
console.log('Selected Business ID:', selectedBusinessId); // Log the selected business ID
|
||||
console.log('Selected Business ID:', selectedBusinessId); // Log the selected business ID
|
||||
|
||||
// Call the function to fetch branches
|
||||
if (selectedBusinessId) {
|
||||
@ -315,7 +305,7 @@
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Get the form group element
|
||||
var formGroup = document.querySelector('.form-group.text-right.checkbox.checkbox-purple');
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
|
||||
<a href="<?= base_url()."user_page/0/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
@ -54,7 +54,7 @@
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
$edit_page_route = base_url()."user_page/".$row['user_id'];
|
||||
$edit_page_route = base_url()."user_page/".$row['user_id']."/0";
|
||||
$addressParts = array(
|
||||
$row['address'],
|
||||
$row['city'],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user