MERGE_UAT_FIXES

This commit is contained in:
Ubuntu 2026-03-18 12:15:07 +05:30
commit 1950457b24
6 changed files with 84 additions and 82 deletions

View File

@ -487,10 +487,6 @@ class LeadsController extends BaseController
// print_r($rules); die;
if ((int) $this->request->getPost('lead_form_type') === 2) {
$rules['client_type'] = [
'rules' => 'required',
'errors' => ['required' => 'Client Type is required'],
];
$rules['policy_type_id'] = [
'rules' => 'required',
'errors' => ['required' => 'Policy Type is required'],

View File

@ -202,52 +202,53 @@ class UserController extends AdminController
// ];
// $this->bookStack->createEditUser($bookStackData);
// if ($insert) {
// $teamData['user_id'] = $insert;
// foreach ($teams as $value) {
// $teamData['team_id'] = $value;
// $teamData['created_by'] = get_session_userid();
// $this->userTeamsModel->insert($teamData);
// }
if ($insert) {
// $db = \Config\Database::connect();
// $tableName = 'hdz_staff';
$teamData['user_id'] = $insert;
foreach ($teams as $value) {
$teamData['team_id'] = $value;
$teamData['created_by'] = get_session_userid();
$this->userTeamsModel->insert($teamData);
}
// $db = \Config\Database::connect();
// $tableName = 'hdz_staff';
// // Set default values
// $admin = 0;
// $acm = 0;
// $acm_id = null;
// // Set default values
// $admin = 0;
// $acm = 0;
// $acm_id = null;
// if ($userData['role'] == 3) {
// $admin = 0;
// $acm = 1;
// $acm_id = $insert;
// } else if (in_array($userData['role'], [1, 5])) {
// $admin = 1;
// $acm = 0;
// $acm_id = null;
// }
// if ($userData['role'] == 3) {
// $admin = 0;
// $acm = 1;
// $acm_id = $insert;
// } else if (in_array($userData['role'], [1, 5])) {
// $admin = 1;
// $acm = 0;
// $acm_id = null;
// }
// $password = '12345678'; // Default password
// $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
// $password = '12345678'; // Default password
// $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
// $hdz_staff = [
// 'emp_code' => $userData['emp_code'],
// 'fullname' => $userData['first_name'],
// 'username' => strtolower($userData['first_name']),
// 'email' => $userData['email'],
// 'admin' => $admin,
// 'acm' => $acm,
// 'acm_id' => $acm_id,
// 'registration' => time(),
// 'password' => $hashedPassword,
// 'active' => 1,
// 'department' => 'a:7:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"5";i:3;s:1:"3";i:4;s:1:"9";i:5;s:1:"4";i:6;s:2:"10";}',
// ];
// $hdz_staff = [
// 'emp_code' => $userData['emp_code'],
// 'fullname' => $userData['first_name'],
// 'username' => strtolower($userData['first_name']),
// 'email' => $userData['email'],
// 'admin' => $admin,
// 'acm' => $acm,
// 'acm_id' => $acm_id,
// 'registration' => time(),
// 'password' => $hashedPassword,
// 'active' => 1,
// 'department' => 'a:7:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"5";i:3;s:1:"3";i:4;s:1:"9";i:5;s:1:"4";i:6;s:2:"10";}',
// ];
// $db->table($tableName)->insert($hdz_staff);
// $db->table($tableName)->insert($hdz_staff);
// }
}
}
$this->myLogger->logme('error', 'User create Successfully created by id {data}', ['data' => get_session_userid()]);
return redirect()->to(base_url('/user/list'));
@ -400,17 +401,17 @@ class UserController extends AdminController
// $this->bookStack->createEditUser($bookStackData,$existingData);
// if ($update) {
if ($update) {
// if ($teams) {
// $this->userTeamsModel->where('user_id', $id)->delete();
// $teamData['user_id'] = $id;
// foreach ($teams as $value) {
// $teamData['team_id'] = $value;
// $teamData['created_by'] = get_session_userid();
// $this->userTeamsModel->insert($teamData);
// }
// }
if ($teams) {
$this->userTeamsModel->where('user_id', $id)->delete();
$teamData['user_id'] = $id;
foreach ($teams as $value) {
$teamData['team_id'] = $value;
$teamData['created_by'] = get_session_userid();
$this->userTeamsModel->insert($teamData);
}
}
// $db = \Config\Database::connect();
// $tableName = 'hdz_staff';
@ -461,7 +462,7 @@ class UserController extends AdminController
// $db->table($tableName)->insert($hdz_staff);
// }
// }
}
return redirect()->to(base_url('/user/list'));
}

View File

@ -388,7 +388,7 @@ table.dataTable tbody td {
<div class="btn-group dropdown" style="position: relative !important;left:0px !important;top:0px !important;">
<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 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>
<?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 } ?>
@ -1389,29 +1389,30 @@ form.addEventListener("submit", function(event) {
// ✅ Modal stays OPEN — do NOT hide it
} else {
// ✅ SUCCESS
toastr.success('User saved successfully!', 'Success');
// ✅ SUCCESS
toastr.success('User saved successfully!', 'Success');
// ✅ Bootstrap 4 way to close modal
$('#con-close-modal').modal('hide');
// ✅ Bootstrap 4 way to close modal
$('#con-close-modal').modal('hide');
// Full reset
form.reset();
$('#UserForm').parsley().reset();
$('#UserId').val('');
$('#nhance_branch_id').val(null).trigger('change.select2');
$('#rm_id').val(null).trigger('change.select2');
$('#role').val('').trigger('change');
$('#team').multiselect('deselectAll', false);
$('#team').multiselect('refresh');
$('#email').removeAttr('data-original');
$('#mobile').removeAttr('data-original');
$('#emp_code').removeAttr('data-original');
$('.modal-title').text('Add User');
$('#btnSubmit').text('Submit').prop('disabled', false);
// Full reset
form.reset();
$('#UserForm').parsley().reset();
$('#UserId').val('');
$('#nhance_branch_id').val(null).trigger('change.select2');
$('#rm_id').val(null).trigger('change.select2');
$('#role').val('').trigger('change');
$('#team').multiselect('deselectAll', false);
$('#team').multiselect('refresh');
$('#email').removeAttr('data-original');
$('#mobile').removeAttr('data-original');
$('#emp_code').removeAttr('data-original');
$('.modal-title').text('Add User');
$('#btnSubmit').text('Submit').prop('disabled', false);
window.location.reload();
loadUser();
}
loadUser();
}
},
error: function(xhr) {
toastr.error('An unexpected error occurred. Please try again.', 'Error');

View File

@ -302,13 +302,13 @@
</div>
<div class="form-group col-md-4">
<label for="client_branch">Branch Name<span class="text-danger">*</span></label>
<label for="branch_name">Branch Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" name="branch_name"
placeholder="Enter Branch Name" required>
</div>
<div class="form-group col-md-4">
<label for="client_branch">Branch Code<span class="text-danger">*</span></label>
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" name="branch_code"
placeholder="Enter Branch Code" required>
</div>
@ -321,7 +321,7 @@
</div>
<div class="form-group col-md-4 freshFields">
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
<label for="contact_person_name">Contact Person Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
placeholder="Enter Contact Name" required>
</div>
@ -401,7 +401,7 @@
</div>
<div class="form-group col-md-4">
<label for="">Next Reminder Date<span class="text-danger"></span></label>
<label for="next_reminder_date">Next Reminder Date<span class="text-danger"></span></label>
<div class="input-icon">
<input type="text" class="form-control" id="next_reminder_date" name="next_reminder_date" placeholder="DD/MM/YYYY">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
@ -1243,7 +1243,7 @@
</div>
<div class="form-group col-md-4">
<label for="">Date of Commencement <span class="text-danger">*</span></label>
<label for="policy_start_date">Date of Commencement <span class="text-danger">*</span></label>
<div class="input-icon">
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" onchange="calculatePolicyMetrics(this)">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
@ -1252,7 +1252,7 @@
</div>
<div class="form-group col-md-4">
<label for="">Date of Expiry <span class="text-danger">*</span></label>
<label for="policy_end_date">Date of Expiry <span class="text-danger">*</span></label>
<div class="input-icon">
<input type="text" class="form-control policy_end_date" id="policy_end_date_${increment}" name="policy_end_date[]" placeholder="Enter DOE">
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>

View File

@ -244,6 +244,10 @@
appendClients(res.clients, res.client_id);
appendBranch(res.branches, res.branch_id);
$('#client_name').val($('#client_name_for_modal').val());
$('#client_short_name').val($('#client_short_name_for_modal').val());
$('#contact_person_name').val(res.data.name);
$('#gst').val(res.data.gst);
$('#branch_name').val(res.data.branch_name);
$('#branch_code').val(res.data.branch_code);

View File

@ -6,7 +6,7 @@
<div class="form-row renewalCalculation">
<div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger"></span></label>
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['incurred_claims_date']) ? $lead_edit_data['incurred_claims_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date<?= $increment ?>"
name="incurred_claim_date[]" placeholder="Enter DOE" oninput="calculatePolicyMetrics(this)">
</div>