Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-02-19 10:54:55 +05:30
commit 467b2197fa
10 changed files with 151 additions and 24 deletions

View File

@ -246,7 +246,8 @@ class medicalClaimFormConversations extends Conversation
$question = Question::create("Confirm all details:")
->addButtons([
Button::create("✅ Confirm")->value("confirm"),
Button::create("❌ Start Over")->value("restart"),
Button::create("🔁 Start Over")->value("restart"),
Button::create("❌ Cancel")->value('cancel')
]);
$this->ask($question, function ($answer) use ($finalSummary) {
@ -271,6 +272,9 @@ class medicalClaimFormConversations extends Conversation
]);
$this->run();
break;
case "cancel":
$this->bot->startConversation(new MainMenuConversation());
break;
default:
$this->say("Invalid selection. Please choose an option.");
$this->showSummary();

View File

@ -180,7 +180,8 @@ class vehicleFormConversation extends Conversation
$question = Question::create("Confim your Details:")
->addButtons([
Button::create("✅ Confirm")->value("confirm"),
Button::create("❌ No")->value("no"),
Button::create("🔁 Start Over")->value("restart"),
Button::create("❌ Cancel")->value('cancel')
]);
$this->bot->ask($question, function ($answer) use($vehicle_info) {
$path = $this->bot->userStorage()->get('path');
@ -201,8 +202,12 @@ class vehicleFormConversation extends Conversation
$this->say("There was a problem while requesting for a quotation please try again later.");
}
break;
case "no":
$this->askVehicleName();
case "restart":
$this->bot->startConversation(new vehicleFormConversation());
break;
case "cancel":
$this->say("Redirecting you to main menu...");
$this->bot->startConversation(new MainMenuConversation());
break;
default:
$this->say("Invalid selection. Please choose an option.");

View File

@ -26,6 +26,7 @@ use App\Models\InsurerModel;
use App\Models\ClientDepositModel;
use App\Models\PolicyPremium2Model;
use App\Models\AuditHistoryModel;
use App\Models\UserModel;
use App\Controllers\Jobs;
@ -66,6 +67,7 @@ class EmployeeController extends AdminController
protected $cashDepositModel;
protected $PolicyPremium2Model;
protected $auditHistory;
protected $userModel;
public function __construct()
{
@ -87,6 +89,7 @@ class EmployeeController extends AdminController
$this->cashDepositModel = new ClientDepositModel();
$this->PolicyPremium2Model = new PolicyPremium2Model();
$this->auditHistory = new AuditHistoryModel();
$this->userModel = new userModel();
}
public function list()
@ -2734,8 +2737,22 @@ class EmployeeController extends AdminController
$emp_id = $this->request->getPost('emp_id');
$data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->findAll();
$data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->orderBy('created_at', 'DESC')->findAll();
foreach ($data['emp_history'] as &$emp_history) {
$emp_history['field_name'] = $this->formatFieldName($emp_history['field_name']);
$user = $emp_history['created_by'];
if ($user != null && $user != ''){
$userData = $this->userModel->select('first_name, last_name')->where('id', $user)->where('is_active', 1)->first();
$emp_history['created_by'] = ucwords($userData['first_name'] . ' ' . $userData['last_name']);
}else{
$emp_history['created_by'] = '-';
}
$emp_history['created_at'] = date("d-m-Y H:i:s", strtotime($emp_history['created_at']));
}
unset($emp_history);
$emp_pol_pk = $this->employeePolicyModel->select('id')->where('employee_id',$emp_id)->first()['id'];
$data['emp_pol_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_pol_pk)->where('table_name','employee_polices')->findAll();
@ -2744,4 +2761,18 @@ class EmployeeController extends AdminController
}
public function formatFieldName($unformattedString){
if (str_contains($unformattedString, '_')) {
$data = str_replace('_', ' ', $unformattedString);
}else{
$data = $unformattedString;
}
$format = ucwords($data);
return $format;
}
}

View File

@ -236,6 +236,8 @@ class LeadsController extends BaseController
// Separate the insurer and insurer branch, handle missing or invalid data
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
}else{
$insurer_branch_id = 0;
$insurer_id = 0;
}
@ -1644,6 +1646,7 @@ class LeadsController extends BaseController
//get file path to attach
$file_info = $this->constructExcelToSaveTemp($lead_id, ($file_type == 'rfq' ? 1 : 2), $propsal_and_insurer);
log_message('error','File Info'.json_encode($file_info));
if ($lead_data['file_name'] != null && $lead_data['file_name'] != '') {
$temp_file_path = $file_info['filePath'];
$temp_file_name = $file_info['fileName'];
@ -1657,6 +1660,8 @@ class LeadsController extends BaseController
$result = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
// print_rr($result);
}
}else{
return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
}
// print_rr($lead_data);
// print_rr($file_info);

View File

@ -201,7 +201,7 @@ class ChatbotHelper
$message = SELF::quotationRequestMailTemplate($data);
$common = ['mail_type'=>'request_quotation_bot'];
$email_id = 'no-reply-otp@nhanceindia.in';
$email_id = getenv('email.enquiryMail');
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
$res = json_decode($res);

View File

@ -123,12 +123,17 @@ class TicketMasterModel extends Model
public function getTemplateDataByTicketID($ticket_id)
{
$template_data = $this
->select("ticket_mail_template.*, ticket_master.emp_mail,ticket_master.claim_status_id")
->select("ticket_mail_template.*, CASE
WHEN employees.email_corporate IS NULL OR employees.email_corporate = ''
THEN ticket_master.emp_mail
ELSE employees.email_corporate
END as emp_mail, ,ticket_master.claim_status_id")
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
->join('ticket_mail_template', '
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
and ticket_mail_template.is_active = 1')
->join('employees','employees.id = ticket_master.emp_id','left')
->where('ticket_master.id', $ticket_id)
->where('ticket_master.is_active', 1)
->where('ticket_claim_status.is_active', 1)
@ -141,6 +146,11 @@ class TicketMasterModel extends Model
{
$ticket_data = $this->select("
ticket_master.*,
CASE
WHEN employees.email_corporate IS NULL OR employees.email_corporate = ''
THEN ticket_master.emp_mail
ELSE employees.email_corporate
END as emp_mail,
user_profiles.first_name as acm,
user_profiles.mobile as acm_mobile,
@ -158,6 +168,7 @@ class TicketMasterModel extends Model
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left')
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
->join('employees','employees.id = ticket_master.emp_id','left')
->where('ticket_master.id', $ticket_id)
->where('ticket_master.is_active', 1)
->first();

View File

@ -310,8 +310,8 @@
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="emp_history_modal_label">Employee History</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id = "emp_history_content"></div>
</div>
</div>
@ -591,10 +591,28 @@
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
return false;
}
function showModal() {
var myModal = new bootstrap.Modal(document.getElementById('emp_history_modal'));
myModal.show();
var modalInstance; // Store the modal instance globally
function showModal() {
var myModalEl = document.getElementById('emp_history_modal');
modalInstance = new bootstrap.Modal(myModalEl, {
backdrop: true, // Ensures the backdrop is shown
keyboard: true // Allows closing with the Escape key
});
modalInstance.show();
}
function closeModal() {
if (modalInstance) {
modalInstance.hide(); // Hide the modal and its backdrop
// Manually remove backdrop if it's still visible
setTimeout(function () {
document.querySelector('.modal-backdrop').classList.remove('show');
}, 150); // Wait for animation to finish
}
}
function get_emp_history(input, emp_id) {
$('.loader').fadeIn();
@ -671,12 +689,12 @@
});
}
function closeModal(){
var myModalEl = document.getElementById('emp_history_modal');
var modalInstance = bootstrap.Modal.getInstance(myModalEl);
if (modalInstance) {
modalInstance.hide();
}
}
// function closeModal(){
// var myModalEl = document.getElementById('emp_history_modal');
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
// if (modalInstance) {
// modalInstance.hide();
// }
// }
</script>

View File

@ -127,7 +127,7 @@ table.dataTable tbody td {
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit2" data-id="<?= $row['id']; ?>">
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
</a>
<!-- <?php if($row['qcr_count'] > 0) { ?>
@ -226,6 +226,11 @@ document.addEventListener("DOMContentLoaded", function () {
if (id) {
getLeadsDataForEdit(id);
}
}else{
const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) {
eval(onclickAttr);
}
}
// For RFQ links

View File

@ -1395,7 +1395,7 @@
console.log("Creating new editor instance...");
editor = unlayer.createEditor({
id: `${template_name}_editor_container`,
projectId: 263979,
projectId: <?=getenv('unlayer.projectID') ?>,
displayMode: "email",
features: {
textEditor: {
@ -1972,4 +1972,52 @@
});
}
}
$(document).on('click', '#notification_enable_form_submit', function() {
var formData = [];
console.log($('#hr_mail_id').val());
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()})
formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() });
formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() });
formData.push({ name: 'mail_domain', value: $('#mail_domain').val() });
formData.push({ name: 'reply_to', value: $('#reply_to').val() });
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') });
formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') });
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') });
formData.push({ name: 'member_review_and_summary_mail_btn', value: $('#member_review_and_summary_mail_btn').prop('checked') });
formData.push({ name: 'account_maneger_summary_mail_btn', value: $('#account_maneger_summary_mail_btn').prop('checked') });
formData.push({ name: 'client_hr_summary_mail_btn', value: $('#client_hr_summary_mail_btn').prop('checked') });
var form_action = '<?= base_url("client/notification/update_enable") ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: form_action,
type: "POST",
data: formData,
dataType: 'json',
success: function(res)
{
console.log(res);
if (res)
{
toastr.success('Update Successfully');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
},
error: function (xhr, status, error)
{
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function()
{
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning');
}, 1000);
}
});
})
</script>

View File

@ -371,7 +371,7 @@
<div class="form-row" id="input_for_row">
</div>
</div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary" onclick="constructURL(1)">Send Mail</button>
</div>
@ -432,9 +432,9 @@
</div>
</div>
<br>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
<button type="submit" class="btn btn-primary" onclick="constructURL(2)">Send Mail</button>
</div>
</div>
</div><!-- /.modal-content -->