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; // print_r($rules); die;
if ((int) $this->request->getPost('lead_form_type') === 2) { 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['policy_type_id'] = [
'rules' => 'required', 'rules' => 'required',
'errors' => ['required' => 'Policy Type is required'], 'errors' => ['required' => 'Policy Type is required'],

View File

@ -202,52 +202,53 @@ class UserController extends AdminController
// ]; // ];
// $this->bookStack->createEditUser($bookStackData); // $this->bookStack->createEditUser($bookStackData);
// if ($insert) { if ($insert) {
// $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(); $teamData['user_id'] = $insert;
// $tableName = 'hdz_staff'; foreach ($teams as $value) {
$teamData['team_id'] = $value;
$teamData['created_by'] = get_session_userid();
$this->userTeamsModel->insert($teamData);
}
// // Set default values // $db = \Config\Database::connect();
// $admin = 0; // $tableName = 'hdz_staff';
// $acm = 0;
// $acm_id = null;
// if ($userData['role'] == 3) { // // Set default values
// $admin = 0; // $admin = 0;
// $acm = 1; // $acm = 0;
// $acm_id = $insert; // $acm_id = null;
// } else if (in_array($userData['role'], [1, 5])) {
// $admin = 1;
// $acm = 0;
// $acm_id = null;
// }
// $password = '12345678'; // Default password // if ($userData['role'] == 3) {
// $hashedPassword = password_hash($password, PASSWORD_DEFAULT); // $admin = 0;
// $acm = 1;
// $acm_id = $insert;
// } else if (in_array($userData['role'], [1, 5])) {
// $admin = 1;
// $acm = 0;
// $acm_id = null;
// }
// $hdz_staff = [ // $password = '12345678'; // Default password
// 'emp_code' => $userData['emp_code'], // $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
// '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); // $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);
}
} }
$this->myLogger->logme('error', 'User create Successfully created by id {data}', ['data' => get_session_userid()]); $this->myLogger->logme('error', 'User create Successfully created by id {data}', ['data' => get_session_userid()]);
return redirect()->to(base_url('/user/list')); return redirect()->to(base_url('/user/list'));
@ -400,17 +401,17 @@ class UserController extends AdminController
// $this->bookStack->createEditUser($bookStackData,$existingData); // $this->bookStack->createEditUser($bookStackData,$existingData);
// if ($update) { if ($update) {
// if ($teams) { if ($teams) {
// $this->userTeamsModel->where('user_id', $id)->delete(); $this->userTeamsModel->where('user_id', $id)->delete();
// $teamData['user_id'] = $id; $teamData['user_id'] = $id;
// foreach ($teams as $value) { foreach ($teams as $value) {
// $teamData['team_id'] = $value; $teamData['team_id'] = $value;
// $teamData['created_by'] = get_session_userid(); $teamData['created_by'] = get_session_userid();
// $this->userTeamsModel->insert($teamData); $this->userTeamsModel->insert($teamData);
// } }
// } }
// $db = \Config\Database::connect(); // $db = \Config\Database::connect();
// $tableName = 'hdz_staff'; // $tableName = 'hdz_staff';
@ -461,7 +462,7 @@ class UserController extends AdminController
// $db->table($tableName)->insert($hdz_staff); // $db->table($tableName)->insert($hdz_staff);
// } // }
// } }
return redirect()->to(base_url('/user/list')); 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;"> <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> <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;"> <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])) { ?> <?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> <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 } ?>
@ -1389,29 +1389,30 @@ form.addEventListener("submit", function(event) {
// ✅ Modal stays OPEN — do NOT hide it // ✅ Modal stays OPEN — do NOT hide it
} else { } else {
// ✅ SUCCESS // ✅ SUCCESS
toastr.success('User saved successfully!', 'Success'); toastr.success('User saved successfully!', 'Success');
// ✅ Bootstrap 4 way to close modal // ✅ Bootstrap 4 way to close modal
$('#con-close-modal').modal('hide'); $('#con-close-modal').modal('hide');
// Full reset // Full reset
form.reset(); form.reset();
$('#UserForm').parsley().reset(); $('#UserForm').parsley().reset();
$('#UserId').val(''); $('#UserId').val('');
$('#nhance_branch_id').val(null).trigger('change.select2'); $('#nhance_branch_id').val(null).trigger('change.select2');
$('#rm_id').val(null).trigger('change.select2'); $('#rm_id').val(null).trigger('change.select2');
$('#role').val('').trigger('change'); $('#role').val('').trigger('change');
$('#team').multiselect('deselectAll', false); $('#team').multiselect('deselectAll', false);
$('#team').multiselect('refresh'); $('#team').multiselect('refresh');
$('#email').removeAttr('data-original'); $('#email').removeAttr('data-original');
$('#mobile').removeAttr('data-original'); $('#mobile').removeAttr('data-original');
$('#emp_code').removeAttr('data-original'); $('#emp_code').removeAttr('data-original');
$('.modal-title').text('Add User'); $('.modal-title').text('Add User');
$('#btnSubmit').text('Submit').prop('disabled', false); $('#btnSubmit').text('Submit').prop('disabled', false);
window.location.reload();
loadUser(); loadUser();
} }
}, },
error: function(xhr) { error: function(xhr) {
toastr.error('An unexpected error occurred. Please try again.', 'Error'); toastr.error('An unexpected error occurred. Please try again.', 'Error');

View File

@ -302,13 +302,13 @@
</div> </div>
<div class="form-group col-md-4"> <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" <input type="text" class="form-control" id="branch_name" name="branch_name"
placeholder="Enter Branch Name" required> placeholder="Enter Branch Name" required>
</div> </div>
<div class="form-group col-md-4"> <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" <input type="text" class="form-control" id="branch_code" name="branch_code"
placeholder="Enter Branch Code" required> placeholder="Enter Branch Code" required>
</div> </div>
@ -321,7 +321,7 @@
</div> </div>
<div class="form-group col-md-4 freshFields"> <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" <input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
placeholder="Enter Contact Name" required> placeholder="Enter Contact Name" required>
</div> </div>
@ -401,7 +401,7 @@
</div> </div>
<div class="form-group col-md-4"> <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"> <div class="input-icon">
<input type="text" class="form-control" id="next_reminder_date" name="next_reminder_date" placeholder="DD/MM/YYYY"> <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> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
@ -1243,7 +1243,7 @@
</div> </div>
<div class="form-group col-md-4"> <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"> <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)"> <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> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>
@ -1252,7 +1252,7 @@
</div> </div>
<div class="form-group col-md-4"> <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"> <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"> <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> <i class="mdi mdi-calendar-blank-outline additional-icon"></i>

View File

@ -244,6 +244,10 @@
appendClients(res.clients, res.client_id); appendClients(res.clients, res.client_id);
appendBranch(res.branches, res.branch_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); $('#gst').val(res.data.gst);
$('#branch_name').val(res.data.branch_name); $('#branch_name').val(res.data.branch_name);
$('#branch_code').val(res.data.branch_code); $('#branch_code').val(res.data.branch_code);

View File

@ -6,7 +6,7 @@
<div class="form-row renewalCalculation"> <div class="form-row renewalCalculation">
<div class="form-group col-md-3 renewalFields" style="display: none;"> <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 ?>" <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)"> name="incurred_claim_date[]" placeholder="Enter DOE" oninput="calculatePolicyMetrics(this)">
</div> </div>