FIX_LIVE_ISSUES_3

This commit is contained in:
VENKATESHWARAN 2026-03-17 17:01:40 +05:30
parent 9f132c12b6
commit 89b555fc66
4 changed files with 83 additions and 19 deletions

View File

@ -100,6 +100,7 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "UserController::list");
$routes->get("getuser/(:hash)", "UserController::getuser/$1");
$routes->get("deactive/(:hash)", "UserController::deactive/$1");
$routes->get("activateUser/(:any)", "UserController::activateUser/$1");
$routes->get("rolesandteams", "UserController::getRolesAndTeams");
$routes->get("getUserActivityHistory", "UserController::getUserActivityHistory");
$routes->match(['get','post','put'], 'partner', 'UserController::partner');

View File

@ -370,7 +370,9 @@ class LeadsController extends BaseController
$actual_lead_id = ! empty($actual_lead_id) ? $actual_lead_id : null;
$postData = $this->request->getPost();
$data = $this->prepareLeadData();
$rules = [
$rules = [
'lead_type' => [
'rules' => 'integer',
@ -380,21 +382,6 @@ class LeadsController extends BaseController
'rules' => 'required',
'errors' => ['required' => 'Issuer is required'],
],
'entity_type_id' => [
'rules' => 'required',
'errors' => ['required' => 'Entity Type is required'],
],
'client_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]',
'errors' => [
'required' => 'Client Name is required',
'regex_match' => 'Client Name only letters, numbers, space, hyphens and underscores are allowed',
],
],
'client_short_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => ['required' => 'Client Short Name is required', 'regex_match' => 'Client Short Name only letters, numbers, hyphens and underscores are allowed'],
],
'gst' => [
'rules' => 'required|regex_match[/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/]',
'errors' => [
@ -460,6 +447,30 @@ class LeadsController extends BaseController
],
];
if (isset($postData['lead_type']) && $postData['lead_type'] == 1) {
$rules['entity_type_id'] = [
'rules' => 'required',
'errors' => ['required' => 'Entity Type is required'],
];
$rules['client_name'] = [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]',
'errors' => [
'required' => 'Client Name is required',
'regex_match' => 'Client Name only letters, numbers, space, hyphens and underscores are allowed',
],
];
$rules['client_short_name'] = [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Client Short Name is required',
'regex_match' => 'Client Short Name only letters, numbers, hyphens and underscores are allowed'
],
];
}
foreach ($postData as $key => $value) {
// Check if the key starts with 'docs_name_'
if (strpos($key, 'docs_name_') === 0) {

View File

@ -466,7 +466,29 @@ class UserController extends AdminController
$emailToDelete = $model->where('id', $id)->first();
$deactive = $model->where('id', $id)->set(['is_active' => 0])->update();
$this->bookStack->deleteUser($emailToDelete);
// $this->bookStack->deleteUser($emailToDelete);
if($deactive)
{
// $db = \Config\Database::connect();
// $tableName = 'hdz_staff';
// $db->table($tableName)->insert($hdz_staff);
echo json_encode(array("status" => true));
}else{
echo json_encode(array("status" => false));
}
}
public function activateUser($id = null)
{
$model = new UserModel();
$emailToDelete = $model->where('id', $id)->first();
$deactive = $model->where('id', $id)->set(['is_active' => 1])->update();
// $this->bookStack->deleteUser($emailToDelete);
if($deactive)
{
// $db = \Config\Database::connect();

View File

@ -389,7 +389,15 @@ table.dataTable tbody td {
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right" style="cursor: pointer;">
<a data-toggle="modal" data-target="#con-close-modal" class="dropdown-item btnEdit" data-id="<?php echo $row->id; ?>"><i data-id="<?php echo $row->id; ?>" class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle btnEdit"></i>Edit</a>
<a class="dropdown-item btnDelete" data-id="<?php echo $row->id; ?>"><i data-id="<?php echo $row->id; ?>" class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle btnDelete"></i>Delete</a>
<?php if($row->is_active == 1 && in_array(get_session_userid(), [1, 5])) { ?>
<a class="dropdown-item btnDelete" data-id="<?php echo $row->id; ?>"><i data-id="<?php echo $row->id; ?>" class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle btnDelete"></i>Delete</a>
<?php } ?>
<?php if($row->is_active == 0 && in_array(get_session_userid(), [1, 5])) { ?>
<a class="dropdown-item btnActivate" data-id="<?php echo $row->id; ?>">
<i class="mdi mdi-account-check mr-2 text-muted font-18 vertical-middle btnActivate" data-id="<?php echo $row->id; ?>"></i>
Activate
</a>
<?php } ?>
</div>
</div>
</td>
@ -1201,7 +1209,29 @@ table.dataTable tbody td {
})
}
});
});
});
$('body').on('click', '.btnActivate', function () {
Swal.fire({
title: "Are you sure?",
text: "You need to active this user",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var student_id = $(this).attr('data-id');
$.get('<?php echo base_url('user/activateUser/');?>'+student_id, function (data) {
console.log(data);
toastr.success('User actived successfully', 'Success');
window.location.reload()
})
}
});
});
$('body').on('click', '.btnPartnerEdit', function () {
let user = JSON.parse($(this).attr('data-obj')); // ✅ convert back to object