FIX_bugs : ps

This commit is contained in:
VE10-Sanjeev 2024-07-10 11:17:52 +00:00
parent 5fa3ffbe1d
commit c19f6ff061
6 changed files with 42 additions and 11 deletions

View File

@ -68,6 +68,7 @@ $routes->get("org_list/", "Business::index");
$routes->get("new_org/(:any)", "Business::new_org/$1");
$routes->post("insert_org/", "Business::insert_org");
$routes->get("delete_org/(:any)", "Business::delete_org/$1");
$routes->get("activate_org/(:any)", "Business::activate_org/$1");
#Donor Routes (also known as contributor,customer)
$routes->get("Contributor_list/", "Customer::index");

View File

@ -18,11 +18,11 @@ class Business extends BaseController
$where = ['business_id' => (int)get_business_id(), 'isactive' => 1];
} else {
$this->logger->info("Buiness: Listing In Super-admin role .");
$where = ['isactive !=' => NULL];
$where = ['business_id !=' => 0,'isactive !=' => NULL];
}
$BusinessModel = new BusinessModel();
$data['page_name'] = 'Organization Details';
$data['organzations'] = $BusinessModel->where($where)->where('business_id !=', 0)->where('isactive', 1)->findAll();
$data['organzations'] = $BusinessModel->where($where)->findAll();
// $data['lastQuery'] = $BusinessModel->getLastQuery();
// print_r($data);die;
$this->render_page('business_list', $data);
@ -291,6 +291,17 @@ class Business extends BaseController
return redirect()->route('org_list');
}
public function activate_org($id){
helper('session');
$session_uid = get_logged_user_id();
$BusinessModel = new BusinessModel();
$data['isactive'] = 1;
$data['updated_by'] = $session_uid;
$BusinessModel->update($id, $data);
return redirect()->route('org_list');
}
public function insertDonationBusiness($businessId)
{
$db = \Config\Database::connect();

View File

@ -22,13 +22,22 @@
<th>State</th>
<th>Zip</th>
<th>File</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($organzations as $business) : ?>
<?php foreach ($organzations as $business) :
if ($business['isactive']) {
$class = 'badge badge-soft-success';
$message = 'Active';
} else {
$class = 'badge badge-soft-danger';
$message = 'In-Active';
}
?>
<tr>
<td><?= $business['title']; ?></td>
<td><?= $business['email']; ?></td>
@ -38,10 +47,15 @@
<td><?= $business['state']; ?></td>
<td><?= $business['postal_code']; ?></td>
<td><?= $business['business_logo']; ?></td>
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
<td>
<a href="<?= base_url() . "new_org/" . $business['business_id']; ?>" class="edit-button" title="Click to Edit Business"><i class="ri-pencil-line"></i></a>
<?php if($loggedin_person_role === 'sadmin'): ?>
<a href="<?= base_url() . "delete_org/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
<?php if($business['isactive'] == 1) { ?>
<a href="<?= base_url() . "delete_org/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
<?php } else {?>
<a href="<?= base_url() . "activate_org/" . $business['business_id']; ?>" class="active-button" title="Click to Active Business"><i class="ri-checkbox-circle-line"></i></a>
<?php } ?>
<?php endif; ?>
</td>
</tr>

View File

@ -193,7 +193,7 @@
</span>
<span class="logo-lg" style="background: white;">
<!-- <img src="<?= base_url()."public/uploads/default.png" ?>" alt="<?= $company_name; ?>" height="24"> -->
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="50">
<img src="<?= $company_logo_large; ?>" alt="<?= $company_name; ?>" height="70">
</span>
</a>
</div>

View File

@ -10,7 +10,7 @@
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; // print_r($details); ?>
<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">
@ -23,18 +23,23 @@
<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 onchange="checkExisting(this,'mobile_no','mobile_no')">
<span id="mobileValidationMessage"></span>
</div>
<div class="form-group col-md-4">
<?php $role = isset($details['role']) ? $details['role'] : "" ;
if($role !== 'sadmin'){ ?>
<div class="form-group col-md-4">
<label for="role" class="col-form-label" id="role_label">Role <span class="text-danger">*</span></label>
<select id="role" name="role" class="form-control" required>
<option value="">--Select--</option>
<?php $roleArr = array('admin', 'accounts', 'auditor','volunteer');
foreach ($roleArr as $value) {
$selected = (isset($details['role']) && $details['role'] === $value) ? "selected" : "";
$selected = ($role === $value) ? "selected" : "";
?>
<option value="<?php echo $value; ?>" <?php echo $selected; ?>><?php echo ucfirst($value); ?></option>
<?php } ?>
</select>
</div>
</div>
<?php }else{ ?>
<input type="hidden" class="form-control" id="role" name="role" placeholder="Role" value="sadmin">
<?php } ?>
</div>
<?php if ($loggedin_person_role === 'sadmin') { ?>
<div class="form-row">

View File

@ -80,7 +80,7 @@
<a href="<?= $edit_page_route; ?>" class="edit-button" title="Click to Edit User" ><i class="ri-pencil-line"></i></a>
<?php if(get_user_role() != 'auditor') {
if($row['isactive'] == 1) { ?>
<a href="#" class="delete-button" title="Click to In-Active User"><i class="ri-delete-bin-line"></i></a>
<a href="#" class="delete-button" data-user-id="<?php echo $row['user_id']; ?>" title="Click to In-Active User"><i class="ri-delete-bin-line"></i></a>
<?php } else {?>
<a href="<?php echo "activate_user/".$row['user_id']; ?>" class="fe-user-check" title="Click to Active User" ></a>
<?php }
@ -108,7 +108,7 @@ $(document).ready(function() {
$(document).ready(function() {
$('.delete-button').click(function(event) {
event.preventDefault();
var user_id = <?php echo $row['user_id']; ?>;
var user_id = $(this).data('user-id');
Swal.fire({
title: "Are you sure?",
text: "You won't be able to revert this!",