MERGE_TEST_CLAIMS_LIVE_FEEDBACK
This commit is contained in:
commit
e64b5563a8
@ -531,6 +531,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post('note/(:any)','TicketController::crudNote/$1');
|
||||
$routes->post('reply','TicketController::saveReply');
|
||||
$routes->match( ['get', 'post'], 'ticket_reports','TicketController::ticketReports');
|
||||
$routes->post('getPolicyStartDate','TicketController::getPolicyStartDate');
|
||||
$routes->post("getPoliciesbyEmpID","TicketController::getPoliciesbyEmpID");
|
||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||
});
|
||||
|
||||
|
||||
@ -1,110 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
|
||||
class BotService
|
||||
{
|
||||
public static function sendMainOptions(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Welcome! Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Card Download'],
|
||||
['Network Hospital'],
|
||||
['Reimbursement Claim Process'],
|
||||
['Reimbursement Claim Status'],
|
||||
['New Policy'],
|
||||
['Renew Policy']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleCardDownload(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Download Card'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleNetworkHospital(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Find Hospital'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleReimbursementClaimProcess(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Submit Claim'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleReimbursementClaimStatus(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Check Status'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleNewPolicy(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Get Quote'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleRenewPolicy(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Renew Now'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
||||
|
||||
class ClaimHandler
|
||||
{
|
||||
public static function handle(BotMan $bot, $option)
|
||||
{
|
||||
$responses = [
|
||||
'reimbursement_claim_process' => "Reimbursement Claim Process: Here is a dummy response.",
|
||||
'reimbursement_claim_status' => "Reimbursement Claim Status: Here is a dummy response."
|
||||
];
|
||||
|
||||
if (isset($responses[$option])) {
|
||||
$bot->reply($responses[$option]);
|
||||
} else {
|
||||
$bot->reply("Unknown claim option.");
|
||||
}
|
||||
|
||||
// Send Back Button
|
||||
self::sendBackButton($bot);
|
||||
}
|
||||
|
||||
private static function sendBackButton(BotMan $bot)
|
||||
{
|
||||
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
||||
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
||||
);
|
||||
}
|
||||
}
|
||||
26
app/Controllers/Chatbot/LoginToContiueConversation.php
Normal file
26
app/Controllers/Chatbot/LoginToContiueConversation.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
use BotMan\Drivers\Web\WebDriver;
|
||||
|
||||
class LoginToContiueConversation extends Conversation
|
||||
{
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->bot->userStorage()->delete();
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
$this->showLoginMessage();
|
||||
}
|
||||
|
||||
protected function showLoginMessage()
|
||||
{
|
||||
$this->say("Kindly Login to use the chatbot");
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
||||
|
||||
class PolicyHandler
|
||||
{
|
||||
public static function handle(BotMan $bot, $option)
|
||||
{
|
||||
$responses = [
|
||||
'ecard_download' => "Ecard Download: Here is a dummy response.",
|
||||
'network_hospital' => "Network Hospital: Here is a dummy response.",
|
||||
'new_policy' => "New Policy: Here is a dummy response.",
|
||||
'renew_policy' => "Renew Policy: Here is a dummy response."
|
||||
];
|
||||
|
||||
if (isset($responses[$option])) {
|
||||
$bot->reply($responses[$option]);
|
||||
} else {
|
||||
$bot->reply("Unknown policy option.");
|
||||
}
|
||||
|
||||
// Send Back Button
|
||||
self::sendBackButton($bot);
|
||||
}
|
||||
|
||||
private static function sendBackButton(BotMan $bot)
|
||||
{
|
||||
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
||||
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
|
||||
class TypingMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle the middleware logic.
|
||||
*
|
||||
* @param BotMan $bot
|
||||
* @param callable $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($bot, $next)
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->myLogger->logme('error', 'MIDDLEWARE');
|
||||
|
||||
// Simulate typing indicator
|
||||
$bot->types();
|
||||
sleep(0.1); // Cap delay at 5 seconds (convert to microseconds)
|
||||
// Proceed to the next middleware or response
|
||||
return $next($bot);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\Chatbot\LoginToContiueConversation;
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\BotManFactory;
|
||||
use BotMan\BotMan\Drivers\DriverManager;
|
||||
@ -19,6 +20,7 @@ class ChatbotControllerNew extends BaseController
|
||||
protected $myLogger;
|
||||
protected $session;
|
||||
protected $botman;
|
||||
protected $isMemberLoggedIn;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -90,6 +92,12 @@ class ChatbotControllerNew extends BaseController
|
||||
// $this->myLogger->logme('error', ('TEST' . $id));
|
||||
$this->session->set('CHATBOT_RANDOM_USER_ID', $id);
|
||||
}
|
||||
|
||||
$this->isMemberLoggedIn = false;
|
||||
$chat_session_info = get_chatbot_session_info();
|
||||
if (!empty($chat_session_info['emp_id']) && !empty($chat_session_info['emp_code'] )){
|
||||
$this->isMemberLoggedIn = true;
|
||||
}
|
||||
|
||||
$this->botman->hears('.*', function ($bot) {
|
||||
|
||||
@ -98,8 +106,13 @@ class ChatbotControllerNew extends BaseController
|
||||
});
|
||||
// Start the Main Menu when user says "hi" or "start"
|
||||
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
||||
$bot->reply('Hi how can i assist?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
if ($this->isMemberLoggedIn){
|
||||
$bot->reply('Hi how can i assist?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
}else {
|
||||
$bot->startConversation(new LoginToContiueConversation());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -4295,7 +4295,7 @@ class ClientController extends AdminController
|
||||
// dd($policyTerms);
|
||||
// Re-encode the ordered policy terms
|
||||
$updatedPolicyTerms = json_encode($policyTerms);
|
||||
dd($updatedPolicyTerms);
|
||||
// dd($updatedPolicyTerms);
|
||||
|
||||
// dd($orderedPolicyTerms, $updatedPolicyTerms);
|
||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||
@ -4574,7 +4574,7 @@ class ClientController extends AdminController
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
@ -4705,6 +4705,9 @@ class ClientController extends AdminController
|
||||
// $this->loadLayout('tat_report_band_wise_list', $reportData);
|
||||
// $data = $ticketModel->getTATReport(1);
|
||||
|
||||
// $empmodel = new EmployeeModel();
|
||||
// $data = $empmodel->getEmployeePolicy(348);
|
||||
// dd($data);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -102,70 +102,68 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
try {
|
||||
$email = $this->request->getJSON()->email;
|
||||
|
||||
|
||||
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
|
||||
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', 'self')
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.email_corporate', $email)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['active'])
|
||||
->first();
|
||||
|
||||
if (isset($employeeData['employee_id']))
|
||||
{
|
||||
|
||||
$employeeData = $this->employeeModel->select('
|
||||
employees.relationship,
|
||||
EP.employee_id,
|
||||
employees.client_id,
|
||||
employees.client_branch_id,
|
||||
employees.email_corporate
|
||||
|
||||
')
|
||||
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', 'Self')
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.email_corporate', $email)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||
->first();
|
||||
|
||||
if (isset($employeeData['employee_id'])) {
|
||||
|
||||
$otp = random_int(100000, 999999);
|
||||
|
||||
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
||||
->where('is_active', 1)->set(array('otp' => $otp ))
|
||||
->update();
|
||||
if($update)
|
||||
{
|
||||
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
|
||||
->where('is_active', 1)->set(array('otp' => $otp))
|
||||
->update();
|
||||
if ($update) {
|
||||
|
||||
$common = [
|
||||
'client_id' => $employeeData['client_id'],
|
||||
'client_branch_id' => $employeeData['client_branch_id'],
|
||||
'client_policy_id' => null,
|
||||
'employee_policy_id' => null,
|
||||
'employee_id' => $employeeData['id'],
|
||||
'employee_id' => $employeeData['employee_id'],
|
||||
'mail_type' => 'otp_mail',
|
||||
];
|
||||
];
|
||||
$subject = 'Nhance user verification - OTP';
|
||||
$mail_content = $otp.' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]);
|
||||
$mail_content = $otp . ' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||
$this->myLogger->logme("info", $res);
|
||||
|
||||
if(json_decode($res)->status == 'success')
|
||||
{
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
|
||||
}else{
|
||||
$result = ['user_verification' => false , 'message' => "Mail sending failed , try again"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
if (json_decode($res)->status == 'success') {
|
||||
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
}else{
|
||||
|
||||
$result = ['user_verification' => false , 'message' => "Verification failed , try again"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getVerifiedUserData()
|
||||
{
|
||||
|
||||
@ -12,6 +12,9 @@ use App\Models\TicketMailTemplateModel;
|
||||
use App\Models\TicketMessageModel;
|
||||
use App\Models\TicketNoteModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
use DOMDocument;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Kint\Kint;
|
||||
@ -45,6 +48,8 @@ class TicketController extends BaseController
|
||||
protected $triggerType;
|
||||
protected $userModel;
|
||||
protected $employeeModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $employeePolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -80,10 +85,10 @@ class TicketController extends BaseController
|
||||
];
|
||||
$this->claimType = [
|
||||
1 => [
|
||||
1 => "Main",
|
||||
1 => "Main Hospitalization",
|
||||
3 => "Pre / Post",
|
||||
2 => "OPD",
|
||||
3 => "Pre ReOpen",
|
||||
4 => "Post ReOpen",
|
||||
4 => "ReOpen",
|
||||
],
|
||||
2 => [
|
||||
1 => "TTD",
|
||||
@ -157,6 +162,8 @@ class TicketController extends BaseController
|
||||
$this->ticketMessageModel = new TicketMessageModel();
|
||||
$this->userModel = new UserModel();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
}
|
||||
|
||||
public function ticketList()
|
||||
@ -439,7 +446,6 @@ class TicketController extends BaseController
|
||||
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
|
||||
}
|
||||
$data = $this->ticket_form_data($ticket_data['ticket_type_id'], $ticket_data['claim_status_id']);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
$data['reply_data'] = $template_data;
|
||||
$data['placeHolders'] = $this->placeHolders;
|
||||
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
||||
@ -447,6 +453,12 @@ class TicketController extends BaseController
|
||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||
$data['ticket_history'] = $this->ticketHistory($ticket_id);
|
||||
$data['ticket_check_list'] = db_connect()->table('ticket_check_list')->where('is_active', 1)->where('ticket_type_id', $ticket_data['ticket_type_id'])->get()->getResultArray();
|
||||
if (!empty($ticket_data['client_policy_id'])){
|
||||
$ticket_data['client_policy_id_text'] = $this->clientPolicyModel->select('concat(policy_type.policy_type,"-",client_policy.policy_no) as client_policy_name')->join('policy_type','policy_type.id = client_policy.policy_type_id and policy_type.is_active = 1')->where('client_policy.id',$ticket_data['client_policy_id'])->first()['client_policy_name'];
|
||||
}
|
||||
// dd($ticket_data);
|
||||
$data['ticket_data'] = $ticket_data;
|
||||
|
||||
// dd($data);
|
||||
|
||||
return $this->loadLayout('ticket_edit_onbording', $data);
|
||||
@ -841,8 +853,16 @@ class TicketController extends BaseController
|
||||
$replaceData = $ticket_data[$value] ?? '';
|
||||
} else if ($value == "policy_type") {
|
||||
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
|
||||
} else {
|
||||
$replaceData = isset($ticket_data[$value]) ? strtoupper($ticket_data[$value]) : '';
|
||||
} else if ($value == 'emp_name'){
|
||||
if(empty($ticket_data['emp_id'])){
|
||||
$replaceData = $ticket_data['emp_name']??"";
|
||||
}
|
||||
}else if ($value == 'insured_name'){
|
||||
if(empty($ticket_data['insured_emp_id'])){
|
||||
$replaceData = $ticket_data['insured_name']?? "";
|
||||
}
|
||||
}else {
|
||||
$replaceData = isset($ticket_data[$value]) ? $ticket_data[$value] : '';
|
||||
}
|
||||
|
||||
$content = str_replace($key, $replaceData, $content);
|
||||
@ -1433,5 +1453,73 @@ class TicketController extends BaseController
|
||||
|
||||
return $lastMatchedStatus;
|
||||
}
|
||||
|
||||
public function getPolicyStartDate()
|
||||
{
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$client_policy_id = $data['policy_id'];
|
||||
$policy_start_date = $this->clientPolicyModel->select('policy_start_date')->where('id', $client_policy_id)->first()['policy_start_date'];
|
||||
// dd($data);
|
||||
if (isset($data['employeeId']) && $data['employeeId'] != "" && $data['employeeId'] != null) {
|
||||
// dd($data);
|
||||
$emp_id = $data['employeeId'];
|
||||
$empData = $this->employeeModel->select('dob,doj')->where('id',$emp_id)->findAll();
|
||||
|
||||
if (!empty($empData) && $empData != "" && $empData != null ) {
|
||||
foreach ($empData as &$emp) { // Loop through the data
|
||||
$emp['dob'] = date('d/m/Y', strtotime($emp['dob']));
|
||||
$emp['doj'] = date('d/m/Y', strtotime($emp['doj']));
|
||||
}
|
||||
}
|
||||
|
||||
if ($empData){
|
||||
return $this->respond(['status' => true, 'minDate' => $policy_start_date,'empData'=> $empData], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => "Policy Not Found"]);
|
||||
}
|
||||
|
||||
} else {
|
||||
// dd($policy_start_date);
|
||||
if ($policy_start_date) {
|
||||
return $this->respond(['status' => true, 'minDate' => $policy_start_date], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'message' => "Policy Not Found"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getPoliciesbyEmpID() {
|
||||
$received_data = $this->request->getPost();
|
||||
$emp_id = $received_data['emp_id'];
|
||||
|
||||
// Get all client policy IDs for the given employee
|
||||
$policies = $this->employeePolicyModel
|
||||
->select('client_policy_id')
|
||||
->where('employee_id', $emp_id)
|
||||
->findAll();
|
||||
|
||||
if (empty($policies)) {
|
||||
return []; // Return empty if no policies found
|
||||
}
|
||||
|
||||
// Extract client policy IDs into an array
|
||||
$policy_ids = array_column($policies, 'client_policy_id');
|
||||
|
||||
// Fetch all policy names and IDs in one query
|
||||
$policyNameandID = $this->clientPolicyModel
|
||||
->select('CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name, client_policy.id as client_policy_value,client_policy.policy_type_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
|
||||
->whereIn('client_policy.id', $policy_ids)
|
||||
->findAll();
|
||||
|
||||
// dd($policyNameandID);
|
||||
if ($policyNameandID){
|
||||
|
||||
return $this->respond(['status'=>true,'policy_data'=> $policyNameandID]);
|
||||
}else{
|
||||
return $this->respond(['status'=>false,'message'=> "Policy Not Found"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -682,7 +682,7 @@ if (!function_exists('generate_relationship_code'))
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship_code = $slug->slugify($arr['relationship']);
|
||||
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
|
||||
$relationship_code = $gender[ $arr['gender'] ] . $relationship[ $relationship_code ] ;
|
||||
$relationship_code = $gender[ trim($arr['gender']) ] . $relationship[ trim($relationship_code) ];
|
||||
return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1247,7 +1247,7 @@ class sendMailNotification
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$rand_string = 'HX3kUh';
|
||||
$link = generate_download_link($rand_string);
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$name = 'John Doe';
|
||||
$mobile = 9080706050;
|
||||
|
||||
@ -149,7 +149,21 @@ class EmployeeModel extends Model
|
||||
{
|
||||
|
||||
return $this->db->table('employee_polices')
|
||||
->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment,client_policy.disclaimer,client_policy.policy_type_id , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
|
||||
->select('
|
||||
policy_type.long_name as Policy_Name ,
|
||||
client_policy.policy_terms as Policy_Terms,
|
||||
client_policy.client_id as ClientId,
|
||||
client_policy.policy_id as PolicyId,
|
||||
client_policy.id as ClientPolicyId,
|
||||
CASE
|
||||
WHEN client_policy.open_for_enrollment IS NULL THEN 0
|
||||
ELSE client_policy.open_for_enrollment
|
||||
END AS OpenForEnrollment,
|
||||
client_policy.disclaimer,
|
||||
client_policy.policy_type_id ,
|
||||
employee_polices.tpa_id as tpa_id ,
|
||||
employee_polices.rand_string as rand_string
|
||||
', FALSE) // Select all columns from both tables
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.policy_status', 1)
|
||||
|
||||
@ -607,7 +607,8 @@ class PolicyTransactionModel extends Model
|
||||
policy_type.policy_type,
|
||||
pt_co_share_details.agreed_amt AS amount,
|
||||
pt_co_share_details.bp_amt AS bp,
|
||||
pt_co_share_details.tp_amt AS tp
|
||||
pt_co_share_details.tp_amt AS tp,
|
||||
clients.pan
|
||||
')
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
|
||||
@ -72,6 +72,8 @@ class TicketMasterModel extends Model
|
||||
'non_id_reason',
|
||||
'head_rejection_reason',
|
||||
'pay_initiate_date',
|
||||
'emp_personal_mail',
|
||||
'client_policy_id'
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
if (window.botmanWidget) {
|
||||
botmanChatWidget.open();
|
||||
setTimeout(function(){
|
||||
botmanChatWidget.sayAsBot('Hi '+ emp_name +',This is ILA your Insurance Assistant, plz choose the following options')
|
||||
botmanChatWidget.sayAsBot('Hi '+ (typeof emp_name !== "undefined" && emp_name !== null && emp_name !== "" ? emp_name : "Guest User") +',This is ILA your Insurance Assistant, plz choose the following options')
|
||||
botmanChatWidget.whisper('Hi');
|
||||
},3000);
|
||||
|
||||
|
||||
@ -691,111 +691,121 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Policy Transactions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
|
||||
<span>Policy Transactions</span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
<span> Policy Reports </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Policy Transactions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="#policyTransactionsSub" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span>Policy Transactions</span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactionsSub">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
<span> Policy Reports </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<li>
|
||||
<a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyPendingActions">
|
||||
<ul class="nav-third-level">
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyMasters">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">
|
||||
<i class="ri-book-open-line"></i>
|
||||
<span> Documents</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -480,7 +480,7 @@
|
||||
<input id="policy_end_date" type="text" class="form-control" name="policy_end_date" placeholder="DD/MM/YYYY" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-3" id="tpa_div">
|
||||
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
|
||||
<select class="form-control" id="tpa" name="tpa" >
|
||||
<option value="" selected>Select TPA</option>
|
||||
@ -1307,6 +1307,12 @@ $(document).ready(function(){
|
||||
$('#client_type option[value="2"]').show();
|
||||
}
|
||||
|
||||
if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 38 || value == 40){
|
||||
$('#tpa_div').hide();
|
||||
}else{
|
||||
$('#tpa_div').show();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -1507,6 +1513,13 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
|
||||
$('#tpa').val(tpaValue).change();
|
||||
|
||||
let policy_type_id_for_hide_tpa = res.data.master_policy_type_id;
|
||||
if(policy_type_id_for_hide_tpa == 1 || policy_type_id_for_hide_tpa == 2 || policy_type_id_for_hide_tpa == 3 || policy_type_id_for_hide_tpa == 4 || policy_type_id_for_hide_tpa == 5 || policy_type_id_for_hide_tpa == 38 || policy_type_id_for_hide_tpa == 40){
|
||||
$('#tpa_div').hide();
|
||||
}else{
|
||||
$('#tpa_div').show();
|
||||
}
|
||||
|
||||
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||
$('#hide_file_upload').show();
|
||||
}else{
|
||||
@ -2484,9 +2497,15 @@ function appendOwner(data) {
|
||||
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
let client_show_name = item.client_name;
|
||||
if (item.client_type == 2) {
|
||||
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
|
||||
}
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
text: client_show_name,
|
||||
});
|
||||
|
||||
$('#owner').append(option);
|
||||
@ -3362,9 +3381,14 @@ $('#client_type').on('change', function() {
|
||||
|
||||
$.each(client_list, function(index, item) {
|
||||
if (item.client_type == selectedClientType) {
|
||||
|
||||
let client_show_name = item.client_name;
|
||||
if (item.client_type == 2) {
|
||||
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
|
||||
}
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
text: client_show_name,
|
||||
'data-cn': item.client_name,
|
||||
'data-ct': item.client_type
|
||||
});
|
||||
@ -3418,7 +3442,7 @@ $('#Owner_type').on('change', function() {
|
||||
|
||||
var option = $('<option>', {
|
||||
value: owner.id,
|
||||
text: (owner.client_name + ' - ' + (owner.pan ?? ''))
|
||||
text: (owner.client_name + ' - ' + (owner.pan ?? 'N/A'))
|
||||
});
|
||||
|
||||
$('#owner').append(option);
|
||||
@ -3450,6 +3474,7 @@ $('#policy_status').change(function(){
|
||||
var client_branch_id = $('#client_branch_id').val();
|
||||
|
||||
if(status == 'completed'){
|
||||
|
||||
if(pt_id == ''){
|
||||
removeAllColumnsExceptFirst('insurerTable');
|
||||
}
|
||||
@ -3482,6 +3507,12 @@ $('#policy_status').change(function(){
|
||||
});
|
||||
}
|
||||
|
||||
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 38 || policy_type_id == 40){
|
||||
$('#tpa_div').hide();
|
||||
}else{
|
||||
$('#tpa_div').show();
|
||||
}
|
||||
|
||||
}else{
|
||||
$('#sales_row').hide()
|
||||
$('#policy_no').prop('required', false)
|
||||
|
||||
@ -302,7 +302,7 @@ table.dataTable tbody td {
|
||||
<td><?php echo $issuer[$row['issuer']]; ?></td>
|
||||
<td><?php echo $issuing_type[$row['issue_type']]; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['client_type'] == 2 ? $row['client_name'] : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td>
|
||||
<td><?php echo $row['client_type'] == 2 ? $row['client_name'] . " - " . (!empty($row['pan']) ? $row['pan'] : 'N/A') : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td>
|
||||
<td><?php echo $row['insurer_short_name']; ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['policy_no']; ?></td>
|
||||
@ -734,17 +734,22 @@ function appendClients(data)
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
let client_show_name = item.client_name;
|
||||
if (item.client_type == 2) {
|
||||
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
|
||||
}
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
text: client_show_name,
|
||||
'data-cn': item.client_name,
|
||||
'data-ct': item.client_type,
|
||||
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
|
||||
class: item.client_type == 1 ? 'group' : item.client_type == 2 ? 'individual' : ''
|
||||
});
|
||||
|
||||
$('#client_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendVehicles(data, vehicle_id)
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
<style>
|
||||
.select2-selection__choice {
|
||||
background-color: #0a8794 !important;
|
||||
color: white !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.select2-selection__choice__remove {
|
||||
color: white !important;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
@ -8,156 +20,174 @@
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_auto_query_customButton" class="form-control"
|
||||
style="border:none;right: 13px;width: auto;position: absolute;z-index: 1;top: -19px;height: 32px;float: right;">
|
||||
<option value="">Documents</option>
|
||||
<div class="form-group col-md-9">
|
||||
<label>Documents</label> <br />
|
||||
<select class="form-control" name="documents[]" id="ticket_mail_auto_query_customButton" multiple>
|
||||
<?php foreach ($ticket_check_list as $value): ?>
|
||||
<option value="<?= $value['document']; ?>"><?= $value['document']; ?></option>
|
||||
<option value="<?= $value['document']; ?>"
|
||||
<?php //
|
||||
// if (!isset($getData) || (isset($getData['documents']) && in_array($value['document'], $getData['documents']))) {
|
||||
// echo 'selected';
|
||||
// }
|
||||
?>>
|
||||
<?= $value['document']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div style="padding-top:30px;padding-left:20px;" class="col-md-3">
|
||||
<button type="button" class="btn btn-primary" id="insertSelectedDocumnets">Insert Documents</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
|
||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
||||
placeholder="Enter Text"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div><input type="hidden" id="query_note_id"><input type="hidden" <div
|
||||
class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div><input type="hidden" id="query_note_id">
|
||||
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
url = '<?= base_url('ticket/note/1') ?>';
|
||||
data = {
|
||||
id: $('#ticket_master_id').val(),
|
||||
is_auto_query: 1
|
||||
};
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#ticket_auto_query_note').val(res.data.note);
|
||||
$('#query_note_id').val(res.data.id);
|
||||
$(document).ready(function() {
|
||||
|
||||
// $('#ticket_mail_auto_query_customButton').select2();
|
||||
$('#ticket_mail_auto_query_customButton').select2({
|
||||
placeholder: "Select Documents",
|
||||
allowClear: true,
|
||||
closeOnSelect: false, // This is the key option to keep the dropdown open
|
||||
tags: true
|
||||
});
|
||||
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
|
||||
const auto_query_editor = Jodit.make("#ticket_auto_query_note", editorConfig);
|
||||
let lastActiveField = null;
|
||||
|
||||
auto_query_editor.events.on("focus", function() {
|
||||
lastActiveField = auto_query_editor;
|
||||
});
|
||||
|
||||
$("#insertSelectedDocumnets").on("click", function() {
|
||||
// Get all selected documents
|
||||
const selectedDocuments = $("#ticket_mail_auto_query_customButton").val();
|
||||
|
||||
if (!selectedDocuments || selectedDocuments.length === 0) {
|
||||
toastr.warning('Please select documents first', 'Warning');
|
||||
return;
|
||||
}
|
||||
},
|
||||
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 Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
if (lastActiveField === auto_query_editor) {
|
||||
// Insert each document on a new line
|
||||
selectedDocuments.forEach(document => {
|
||||
auto_query_editor.selection.insertHTML(document + '<br>');
|
||||
});
|
||||
|
||||
// Clear the selection
|
||||
$("#ticket_mail_auto_query_customButton").val(null).trigger('change');
|
||||
} else {
|
||||
toastr.warning('Please focus on the text area first', 'Warning');
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("#ticket_auto_query").submit(function(event) {
|
||||
// $("#ticket_mail_auto_query_customButton").change(function (){
|
||||
// event.stopPropagation();
|
||||
// })
|
||||
|
||||
event.preventDefault();
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$(document).ready(function() {
|
||||
|
||||
var url = '<?= base_url("/ticket/note/2"); ?>';
|
||||
var formData = $(this).serializeArray();
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != '') {
|
||||
formData.push({
|
||||
name: 'ticket_id',
|
||||
value: ticket_id
|
||||
});
|
||||
}
|
||||
var primary_key = $('#query_note_id').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
formData.push({
|
||||
name: 'is_auto_query',
|
||||
value: 1
|
||||
})
|
||||
console.log(formData);
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully', 'Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#query_note_id').val(response.id);
|
||||
|
||||
|
||||
} else {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
let message = response.message;
|
||||
toastr.error(message, 'ERROR');
|
||||
url = '<?= base_url('ticket/note/1') ?>';
|
||||
data = {
|
||||
id: $('#ticket_master_id').val(),
|
||||
is_auto_query: 1
|
||||
};
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
console.log('auto query res', res)
|
||||
if (res.status == true) {
|
||||
$('.jodit-wysiwyg').html(res.data.note);
|
||||
$('#query_note_id').val(res.data.id);
|
||||
}
|
||||
},
|
||||
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 Went Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
|
||||
$("#ticket_auto_query").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var url = '<?= base_url("/ticket/note/2"); ?>';
|
||||
var formData = $(this).serializeArray();
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != '') {
|
||||
formData.push({
|
||||
name: 'ticket_id',
|
||||
value: ticket_id
|
||||
});
|
||||
}
|
||||
var primary_key = $('#query_note_id').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
formData.push({
|
||||
name: 'is_auto_query',
|
||||
value: 1
|
||||
})
|
||||
console.log(formData);
|
||||
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
||||
if (response.status == true) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Note Added Successfully', 'Success');
|
||||
// console.log("Respone id is ")
|
||||
// console.log(response.id);
|
||||
$('#query_note_id').val(response.id);
|
||||
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetching the report page.', 'ERROR');
|
||||
} else {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
let message = response.message;
|
||||
toastr.error(message, 'ERROR');
|
||||
}
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetching the report page.', 'ERROR');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
$("#ticket_auto_query_note").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
|
||||
var target = event.target;
|
||||
|
||||
if (target.matches('#ticket_mail_auto_query_customButton')) {
|
||||
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "ticket_auto_query_note") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
|
||||
textToInsert += '\n';
|
||||
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = textToInsert;
|
||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||
let startPos = input.selectionStart;
|
||||
let endPos = input.selectionEnd;
|
||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value
|
||||
.length);
|
||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||
} else {
|
||||
input.value += textToInsert;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -1,3 +1,17 @@
|
||||
<style>
|
||||
.readonly-color {
|
||||
background-color: #e0e0e0;
|
||||
/* Darker background */
|
||||
color: #666;
|
||||
/* Darker text color */
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
@ -73,9 +87,8 @@
|
||||
<label for="policy_no">Policy No <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="policy_no"
|
||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||
name="policy_no" placeholder="Policy Number" >
|
||||
name="policy_no" placeholder="Policy Number">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA ID <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
|
||||
@ -97,6 +110,13 @@
|
||||
name="emp_mail" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_personal_mail">Employee Personal Mail ID</label>
|
||||
<input type="text" class="form-control" id="emp_personal_mail" placeholder="Enter EMP Personal Mail"
|
||||
value="<?= isset($ticket_data['emp_personal_mail']) ? $ticket_data['emp_personal_mail'] : '' ?>"
|
||||
name="emp_personal_mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">Corporate Name <span class="text-danger">*</span></label>
|
||||
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
||||
@ -108,6 +128,20 @@
|
||||
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly required>
|
||||
</div>
|
||||
<input type="hidden" id="empIDHidden" onchange="getClientPolicy()">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Policy <span class="text-danger">*</span></label>
|
||||
<select id="emp_client_policy" name="client_policy_id"
|
||||
class="form-control custom-select" required onchange="setMinDateDOA(this.value)">
|
||||
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
||||
<?php } else { ?>
|
||||
<option value="">Policy</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA <span class="text-danger"></span></label>
|
||||
@ -120,12 +154,12 @@
|
||||
<select class="form-control" id="acm_id" name="acm_id" required>
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
|
||||
}
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -145,12 +179,12 @@
|
||||
<select class="form-control" id="claim_status_id" name="claim_status_id" required>
|
||||
<!-- <option value="0">Select status</option> -->
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -160,12 +194,12 @@
|
||||
<select class="form-control" id="priority" name="priority" required>
|
||||
<!-- <option value="0">Select Priority</option> -->
|
||||
<?php
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -343,16 +377,16 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 non_id" style="display: none;">
|
||||
<label for="non_id_reason">Non ID Reason</label>
|
||||
<label for="non_id_reason">Non ID Reason <span id="non_id_reason_lable_id" class="text-danger"></span></label>
|
||||
<select class="form-control" id="non_id_reason" name="non_id_reason">
|
||||
<option value="">Select Reason</option>
|
||||
<?php
|
||||
if (isset($nonIDReason) && count($nonIDReason)) {
|
||||
foreach ($nonIDReason as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
if (isset($nonIDReason) && count($nonIDReason)) {
|
||||
foreach ($nonIDReason as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['non_id_reason'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -389,12 +423,23 @@
|
||||
|
||||
<script>
|
||||
let GlobelExtraFields = [];
|
||||
var doa;
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#emp_client_policy").select2();
|
||||
|
||||
var policy_id = $("#emp_client_policy").val();
|
||||
if (policy_id != null && policy_id != "") {
|
||||
$("#emp_client_policy").addClass('readonly-select').select2('destroy');
|
||||
}
|
||||
// getClientPolicy();
|
||||
var doa = flatpickr("#doa", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||
}
|
||||
});
|
||||
|
||||
var dod = flatpickr("#dod", {
|
||||
@ -576,12 +621,12 @@
|
||||
|
||||
var selectedClaimStatus = $('#claim_status_id').val();
|
||||
var $thirdClass = $(`.${thirdClass}`);
|
||||
var hasValue = $thirdClass.find('input, textarea, select').filter(function () {
|
||||
var hasValue = $thirdClass.find('input, textarea, select').filter(function() {
|
||||
return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
||||
}).length > 0;
|
||||
|
||||
$thirdClass.each(function () {
|
||||
var id = $(this).find('[id]').first().attr('id');
|
||||
$thirdClass.each(function() {
|
||||
var id = $(this).find('[id]').first().attr('id');
|
||||
var $label = $(this).find('label');
|
||||
var $thisDiv = $(this);
|
||||
var $inputs = $thisDiv.find('input, textarea, select');
|
||||
@ -595,12 +640,12 @@
|
||||
if ($label.length && !$label.find('.text-danger').length) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
console.log("input from if ",$inputs);
|
||||
console.log("input from if ", $inputs);
|
||||
// $inputs.attr('required', true);
|
||||
$('.' + thirdClass).find('input, textarea,select').attr('required', true);
|
||||
} else {
|
||||
$label.find('.text-danger').remove();
|
||||
console.log("input ",$inputs);
|
||||
console.log("input ", $inputs);
|
||||
// $inputs.prop('required', false);
|
||||
$('.' + thirdClass).find('input, textarea,select').attr('required', false);
|
||||
}
|
||||
@ -647,109 +692,325 @@
|
||||
}
|
||||
});
|
||||
|
||||
// function addRequiredFieldSymbol(field_name) {
|
||||
// // Find the field with the given name
|
||||
// var $field = $(`[name="${field_name}"]`);
|
||||
|
||||
// if ($field.length) {
|
||||
// // Find the parent div of this field
|
||||
// var $parentDiv = $field.closest('div');
|
||||
|
||||
// if ($parentDiv.length) {
|
||||
// // Get the classes as an array
|
||||
// var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : [];
|
||||
|
||||
// if (classes.length > 0) {
|
||||
// // Get the last class in the array
|
||||
// var lastClass = classes[classes.length - 1];
|
||||
|
||||
// // Find all divs with this last class
|
||||
// var $allDivsWithClass = $(`.${lastClass}`);
|
||||
|
||||
// // Add asterisk to all labels within these divs
|
||||
// $allDivsWithClass.each(function() {
|
||||
// var $label = $(this).find('label');
|
||||
// if ($label.length && !$label.find('.text-danger').length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// });
|
||||
|
||||
// console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`);
|
||||
// } else {
|
||||
// console.warn(`Parent div for field "${field_name}" has no classes`);
|
||||
// }
|
||||
// } else {
|
||||
// console.warn(`No parent div found for field name="${field_name}"`);
|
||||
// }
|
||||
// } else {
|
||||
// console.warn(`No field found with name="${field_name}"`);
|
||||
// }
|
||||
// }
|
||||
// function addRequiredFieldSymbol(field_name) {
|
||||
// // Find the field with the given name
|
||||
// var $field = $(`[name="${field_name}"]`);
|
||||
|
||||
function addRequiredFieldSymbolByClass(className) {
|
||||
var $divsWithClass = $(`.${className}`);
|
||||
// if ($field.length) {
|
||||
// // Find the parent div of this field
|
||||
// var $parentDiv = $field.closest('div');
|
||||
|
||||
if ($divsWithClass.length) {
|
||||
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
||||
try {
|
||||
extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
|
||||
} catch (error) {
|
||||
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
||||
return;
|
||||
// if ($parentDiv.length) {
|
||||
// // Get the classes as an array
|
||||
// var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : [];
|
||||
|
||||
// if (classes.length > 0) {
|
||||
// // Get the last class in the array
|
||||
// var lastClass = classes[classes.length - 1];
|
||||
|
||||
// // Find all divs with this last class
|
||||
// var $allDivsWithClass = $(`.${lastClass}`);
|
||||
|
||||
// // Add asterisk to all labels within these divs
|
||||
// $allDivsWithClass.each(function() {
|
||||
// var $label = $(this).find('label');
|
||||
// if ($label.length && !$label.find('.text-danger').length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// });
|
||||
|
||||
// console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`);
|
||||
// } else {
|
||||
// console.warn(`Parent div for field "${field_name}" has no classes`);
|
||||
// }
|
||||
// } else {
|
||||
// console.warn(`No parent div found for field name="${field_name}"`);
|
||||
// }
|
||||
// } else {
|
||||
// console.warn(`No field found with name="${field_name}"`);
|
||||
// }
|
||||
// }
|
||||
|
||||
function addRequiredFieldSymbolByClass(className) {
|
||||
var $divsWithClass = $(`.${className}`);
|
||||
|
||||
if ($divsWithClass.length) {
|
||||
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
||||
try {
|
||||
extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
|
||||
} catch (error) {
|
||||
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedClaimStatus = $('#claim_status_id').val();
|
||||
console.log("Selected claim status ID:", selectedClaimStatus);
|
||||
console.log("Extra Field Array:", extrafieldsArray[selectedClaimStatus]);
|
||||
|
||||
// ✅ Check if at least one field inside the class has a value
|
||||
// var hasValue = $divsWithClass.find('input, textarea, select').filter(function () {
|
||||
// return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
||||
// }).length > 0;
|
||||
|
||||
// $divsWithClass.each(function () {
|
||||
// var id = $(this).find('[id]').first().attr('id');
|
||||
// var $label = $(this).find('label');
|
||||
// var $thisDiv = $(this);
|
||||
// var $inputs = $thisDiv.find('input, textarea, select');
|
||||
|
||||
|
||||
// // ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
|
||||
// var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
|
||||
|
||||
// // ✅ Condition 2: If any field in the class has a value, make all required
|
||||
// if (shouldAddRequired || hasValue) {
|
||||
// if ($label.length && !$label.find('.text-danger').length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// console.log("input from if ",$inputs);
|
||||
// $inputs.attr('required', true);
|
||||
// } else {
|
||||
// $label.find('.text-danger').remove();
|
||||
// console.log("input ",$inputs);
|
||||
// $inputs.prop('required', false);
|
||||
// }
|
||||
// });
|
||||
|
||||
console.log(`Processed ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
|
||||
var selectedClaimStatus = $('#claim_status_id').val();
|
||||
console.log("Selected claim status ID:", selectedClaimStatus);
|
||||
console.log("Extra Field Array:", extrafieldsArray[selectedClaimStatus]);
|
||||
|
||||
// ✅ Check if at least one field inside the class has a value
|
||||
// var hasValue = $divsWithClass.find('input, textarea, select').filter(function () {
|
||||
// return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
||||
// }).length > 0;
|
||||
|
||||
// $divsWithClass.each(function () {
|
||||
// var id = $(this).find('[id]').first().attr('id');
|
||||
// var $label = $(this).find('label');
|
||||
// var $thisDiv = $(this);
|
||||
// var $inputs = $thisDiv.find('input, textarea, select');
|
||||
|
||||
|
||||
// // ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
|
||||
// var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
|
||||
|
||||
// // ✅ Condition 2: If any field in the class has a value, make all required
|
||||
// if (shouldAddRequired || hasValue) {
|
||||
// if ($label.length && !$label.find('.text-danger').length) {
|
||||
// $label.append(' <span class="text-danger">*</span>');
|
||||
// }
|
||||
// console.log("input from if ",$inputs);
|
||||
// $inputs.attr('required', true);
|
||||
// } else {
|
||||
// $label.find('.text-danger').remove();
|
||||
// console.log("input ",$inputs);
|
||||
// $inputs.prop('required', false);
|
||||
// }
|
||||
// });
|
||||
|
||||
console.log(`Processed ${$divsWithClass.length} labels with class "${className}"`);
|
||||
} else {
|
||||
console.warn(`No divs found with class="${className}"`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#mode_of_intimation').change(function(){
|
||||
console.log("function called");
|
||||
var mode_of_intimation = $('#mode_of_intimation').val();
|
||||
console.log('mode of ',mode_of_intimation);
|
||||
|
||||
if (mode_of_intimation == 2){
|
||||
$('#pod_no').attr('required', 'required');
|
||||
$('#pod_no_label_1_span').text("*");
|
||||
}else{
|
||||
$('#pod_no').removeAttr('required', false);
|
||||
$('#pod_no_label_1_span').text("");
|
||||
$('#mode_of_intimation').change(function() {
|
||||
console.log("function called");
|
||||
var mode_of_intimation = $('#mode_of_intimation').val();
|
||||
console.log('mode of ', mode_of_intimation);
|
||||
|
||||
if (mode_of_intimation == 2) {
|
||||
$('#pod_no').attr('required', 'required');
|
||||
$('#pod_no_label_1_span').text("*");
|
||||
} else {
|
||||
$('#pod_no').removeAttr('required', false);
|
||||
$('#pod_no_label_1_span').text("");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$("#empIDHidden").change(function() {
|
||||
console.log("change is detected in hidden branch id");
|
||||
getClientPolicy();
|
||||
})
|
||||
|
||||
function getClientPolicy() {
|
||||
console.log("get policy function called");
|
||||
hiddenData = $("#empIDHidden").val();
|
||||
hiddenData = JSON.parse(hiddenData);
|
||||
console.log('employee id ', hiddenData['emp_id']);
|
||||
data = {
|
||||
emp_id: hiddenData['emp_id']
|
||||
}
|
||||
$.ajax({
|
||||
url: '<?= base_url("/ticket/getPoliciesbyEmpID") ?>',
|
||||
type: "POST",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
console.log("data is received2");
|
||||
policyList = res.policy_data;
|
||||
// appendClients(res.client_data);
|
||||
// appendClientsFoerMobileSearch(res.client_data);
|
||||
appendPolicyDropdown(policyList);
|
||||
console.log("after function");
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//append the clients policy data to the modal
|
||||
// function appendPolicyDropdown(data) {
|
||||
// console.log("second function is called : ", data);
|
||||
// let ticket_type = $('#ticket_type_id').val();
|
||||
// hiddenData = $("#empIDHidden").val();
|
||||
// hiddenData = JSON.parse(hiddenData);
|
||||
// let branch_id = hiddenData['branch_id'];
|
||||
// let policy_id = hiddenData['policy_id'];
|
||||
// let searchType = hiddenData['searchType'];
|
||||
// data = data[branch_id];
|
||||
// console.log("branch filtered data ", data);
|
||||
// $('#emp_client_policy').empty();
|
||||
|
||||
// $('#emp_client_policy').append($('<option>', {
|
||||
// value: '',
|
||||
// text: 'Select Client Policy'
|
||||
// }));
|
||||
|
||||
// $.each(data, function(index, item) {
|
||||
// // console.log('inside the loop for this time count : ',item);
|
||||
// console.log("debugging policy type id : ", item.id);
|
||||
// if (ticket_type == 1) {
|
||||
// console.log("inside if condition 1");
|
||||
|
||||
// if (item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 || item
|
||||
// .policy_type_id == 5) {
|
||||
// console.log("inside if condition 2");
|
||||
|
||||
// if (policy_id == item.id) {
|
||||
// console.log("inside if condition 3");
|
||||
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// if (searchType != null && searchType != "") {
|
||||
// $('#emp_client_policy').val(item.id).addClass('readonly-select').select2('destroy');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else if (ticket_type == 2) {
|
||||
|
||||
// if (item.policy_type_id == 1) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// }
|
||||
|
||||
// } else if (ticket_type == 3) {
|
||||
|
||||
// if (item.policy_type_id == 6) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// }
|
||||
|
||||
// } else if (ticket_type == 4) {
|
||||
|
||||
// if (item.policy_type == 7) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.id,
|
||||
// text: item.policy_type + '-' + item.policy_no,
|
||||
// });
|
||||
|
||||
// $('#emp_client_policy').append(option).select2();
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// });
|
||||
// console.log("loop is completed");
|
||||
// setMinDateDOA(policy_id);
|
||||
// }
|
||||
|
||||
function appendPolicyDropdown(data) {
|
||||
hiddenData = $("#empIDHidden").val();
|
||||
hiddenData = JSON.parse(hiddenData);
|
||||
|
||||
console.log("second function is called : ", data);
|
||||
let ticket_type = $('#ticket_type_id').val();
|
||||
$('#emp_client_policy').empty();
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Client Policy'
|
||||
}));
|
||||
|
||||
var policyAppendCount = 0;
|
||||
$.each(data, function(index, item) {
|
||||
// console.log(item);
|
||||
|
||||
if (ticket_type == 1 && item.policy_type_id != 1) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
}));
|
||||
policyAppendCount++;
|
||||
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
||||
// $('#emp_client_policy').select2();
|
||||
$("#emp_client_policy").select2();
|
||||
$('#emp_client_policy').val(hiddenData['policy_id']).addClass('readonly-select').select2('destroy').trigger("change");
|
||||
} else {
|
||||
// $('#emp_client_policy').append($('<option>', {
|
||||
// value: item.client_policy_value,
|
||||
// text: item.client_policy_name
|
||||
// }));
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
console.log('policy append count ',policyAppendCount);
|
||||
if (policyAppendCount == 0){
|
||||
toastr.warning("No Policies found for the Employee","Warning");
|
||||
}
|
||||
}
|
||||
// $('#emp_client_policy').select2();
|
||||
$("#emp_client_policy").on('change', function() {
|
||||
console.log("change function called ");
|
||||
policy_id = $("#emp_client_policy").val();
|
||||
setMinDateDOA(policy_id);
|
||||
})
|
||||
|
||||
function setMinDateDOA(policy_id) {
|
||||
console.log("Function set min date called ");
|
||||
console.log("Existing DOA instance: ", doa);
|
||||
console.log('sent data ',policy_id);
|
||||
$.ajax({
|
||||
url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
||||
method: "POST",
|
||||
data: {
|
||||
policy_id: policy_id
|
||||
},
|
||||
|
||||
success: function(response) {
|
||||
console.log("mindate response ", response);
|
||||
|
||||
if (response.status) {
|
||||
let minDate = new Date(response.minDate);
|
||||
// If doa is not initialized, create the instance
|
||||
if (!doa) {
|
||||
console.log("doa not found, initializing");
|
||||
doa = flatpickr("#doa", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||
},
|
||||
minDate: minDate
|
||||
});
|
||||
var dod = flatpickr("#dod", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
} else {
|
||||
// If already initialized, just set the minDate
|
||||
doa.set("minDate", minDate);
|
||||
}
|
||||
} else {
|
||||
console.error(response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@ -68,6 +68,13 @@
|
||||
name="emp_mail" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_personal_mail">Employee Personal Mail ID</label>
|
||||
<input type="text" class="form-control" id="emp_personal_mail" placeholder="Enter EMP Personal Mail"
|
||||
value="<?= isset($ticket_data['emp_personal_mail']) ? $ticket_data['emp_personal_mail'] : '' ?>"
|
||||
name="emp_personal_mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_no">Policy No <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="policy_no"
|
||||
@ -86,6 +93,23 @@
|
||||
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly required>
|
||||
</div>
|
||||
<input type="hidden" id="empIDHidden" onchange="getClientPolicy()">
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Policy <span class="text-danger">*</span></label>
|
||||
<select id="emp_client_policy" name="client_policy_id"
|
||||
class="form-control custom-select" required onchange="setDateValidation(this.value,true)"
|
||||
<?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?>
|
||||
>
|
||||
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
||||
<?php } else { ?>
|
||||
<option value="">Select Policy</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="acm_id">Account Manager <span class="text-danger">*</span></label>
|
||||
@ -293,14 +317,22 @@
|
||||
<script>
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
var date_of_join;
|
||||
var dob;
|
||||
var date_of_accident;
|
||||
var date_of_death;
|
||||
var date_of_intimat;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var date_of_join = flatpickr("#date_of_join", {
|
||||
$("#emp_client_policy").select2();
|
||||
date_of_join = flatpickr("#date_of_join", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var dob = flatpickr("#dob", {
|
||||
dob = flatpickr("#dob", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
@ -310,17 +342,22 @@
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_accident = flatpickr("#date_of_accident", {
|
||||
date_of_accident = flatpickr("#date_of_accident", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates) {
|
||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||
date_of_death.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||
date_of_intimat.set("minDate",selectedDOA);
|
||||
}
|
||||
});
|
||||
|
||||
date_of_death = flatpickr("#date_of_death", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_death = flatpickr("#date_of_death", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_intimat = flatpickr("#date_of_intimat", {
|
||||
date_of_intimat = flatpickr("#date_of_intimat", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
@ -425,7 +462,7 @@
|
||||
var hasValue = $thirdClass.find('input, textarea, select').filter(function() {
|
||||
return $(this).val().trim() !== ''; // Check if at least one field is not empty
|
||||
}).length > 0;
|
||||
console.log ("has value ",hasValue);
|
||||
console.log("has value ", hasValue);
|
||||
$thirdClass.each(function() {
|
||||
var id = $(this).find('[id]').first().attr('id');
|
||||
var $label = $(this).find('label');
|
||||
@ -435,7 +472,7 @@
|
||||
|
||||
// ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
|
||||
var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
|
||||
console.log ("shouldAddRequired ",shouldAddRequired);
|
||||
console.log("shouldAddRequired ", shouldAddRequired);
|
||||
|
||||
// ✅ Condition 2: If any field in the class has a value, make all required
|
||||
if (shouldAddRequired || hasValue) {
|
||||
@ -546,4 +583,194 @@
|
||||
// console.warn(`No divs found with class="${className}"`);
|
||||
// }
|
||||
// }
|
||||
|
||||
$("#empIDHidden").change(function() {
|
||||
console.log("change is detected in hidden branch id");
|
||||
getClientPolicy();
|
||||
})
|
||||
|
||||
var employeeId = "";
|
||||
|
||||
function getClientPolicy() {
|
||||
console.log("get policy function called");
|
||||
hiddenData = $("#empIDHidden").val();
|
||||
hiddenData = JSON.parse(hiddenData);
|
||||
console.log('employee id ', hiddenData['emp_id']);
|
||||
employeeId = hiddenData['emp_id'];
|
||||
data = {
|
||||
emp_id: hiddenData['emp_id']
|
||||
}
|
||||
$.ajax({
|
||||
url: '<?= base_url("/ticket/getPoliciesbyEmpID") ?>',
|
||||
type: "POST",
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
console.log("data is received2");
|
||||
policyList = res.policy_data;
|
||||
// appendClients(res.client_data);
|
||||
// appendClientsFoerMobileSearch(res.client_data);
|
||||
appendPolicyDropdown(policyList);
|
||||
console.log("after function");
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicyDropdown(data) {
|
||||
|
||||
// var ticket_type = $('#ticket_type').val();
|
||||
hiddenData = $("#empIDHidden").val();
|
||||
hiddenData = JSON.parse(hiddenData);
|
||||
|
||||
console.log("second function is called : ", data);
|
||||
let ticket_type = $('#ticket_type_id').val();
|
||||
$('#emp_client_policy').empty();
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Client Policy'
|
||||
}));
|
||||
|
||||
var policyAppendCount = 0;
|
||||
$.each(data, function(index, item) {
|
||||
// console.log(item);
|
||||
|
||||
if (ticket_type != 1 && item.policy_type_id != 2) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
}));
|
||||
policyAppendCount++;
|
||||
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
||||
// $('#emp_client_policy').select2();
|
||||
$("#emp_client_policy").select2();
|
||||
$('#emp_client_policy').val(hiddenData['policy_id']).addClass('readonly-select').select2('destroy').trigger("change");
|
||||
} else {
|
||||
// $('#emp_client_policy').append($('<option>', {
|
||||
// value: item.client_policy_value,
|
||||
// text: item.client_policy_name
|
||||
// }));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (policyAppendCount == 0) {
|
||||
toastr.warning("No Policies found for the Employee", "Warning");
|
||||
}
|
||||
}
|
||||
// $('#emp_client_policy').select2();
|
||||
$("#emp_client_policy").on('change', function() {
|
||||
console.log("change function called ");
|
||||
policy_id = $("#emp_client_policy").val();
|
||||
// setMinDateDOA(policy_id);
|
||||
setDateValidation(policy_id, true);
|
||||
})
|
||||
|
||||
function setDateValidation(policy_id, memberset = null) {
|
||||
$.ajax({
|
||||
url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
||||
method: "POST",
|
||||
data: {
|
||||
policy_id: policy_id,
|
||||
employeeId: employeeId ?? null
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.status) {
|
||||
if (memberset) {
|
||||
var dobValue = response.empData[0].dob;
|
||||
var doj = response.empData[0].doj;
|
||||
console.log('data received fro controller ', dob, doj);
|
||||
if (dobValue) {
|
||||
$("#dob").val(dobValue);
|
||||
$("#dob").addClass('readonly-select');
|
||||
}
|
||||
if (doj) {
|
||||
$("#date_of_join").val(doj);
|
||||
$("#date_of_join").addClass('readonly-select');
|
||||
}
|
||||
}else{
|
||||
if ($("#dob").hasClass('readonly-select')){
|
||||
$("#dob").removeClass('readonly-select')
|
||||
$("#dob").val("");
|
||||
}
|
||||
if ($("#date_of_join").hasClass('readonly-select')){
|
||||
$("#date_of_join").removeClass('readonly-select')
|
||||
$("#date_of_join").val("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (response.minDate) {
|
||||
// var formatMinDate = response.minDate;
|
||||
var formatMinDate = new Date(response.minDate);
|
||||
date_of_accident.set("minDate", formatMinDate)
|
||||
date_of_death.set("minDate", formatMinDate)
|
||||
date_of_intimat.set("minDate", formatMinDate)
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.error(response.message);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// function setMinDateDOA(policy_id) {
|
||||
// console.log("Function set min date called ");
|
||||
// console.log("Existing DOA instance: ", doa);
|
||||
|
||||
// $.ajax({
|
||||
// url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
||||
// method: "POST",
|
||||
// data: {
|
||||
// policy_id: policy_id
|
||||
// },
|
||||
// success: function(response) {
|
||||
// console.log("mindate response ", response);
|
||||
|
||||
// if (response.status) {
|
||||
// let minDate = new Date(response.minDate);
|
||||
// // If doa is not initialized, create the instance
|
||||
// if (!doa) {
|
||||
// console.log("doa not found, initializing");
|
||||
// doa = flatpickr("#doa", {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false,
|
||||
// onChange: function(selectedDates) {
|
||||
// let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||
// dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||
// },
|
||||
// minDate: minDate
|
||||
// });
|
||||
// var dod = flatpickr("#dod", {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
// } else {
|
||||
// // If already initialized, just set the minDate
|
||||
// doa.set("minDate", minDate);
|
||||
// }
|
||||
// } else {
|
||||
// console.error(response.message);
|
||||
// }
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -47,36 +47,61 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
showPlaceholder: false,
|
||||
toolbarButtonSize: 'small',
|
||||
toolbarAdaptive: false,
|
||||
saveHeightInStorage: true,
|
||||
minHeight: 400,
|
||||
extraButtons: [
|
||||
{
|
||||
name: 'info',
|
||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||
exec: function (editor) {
|
||||
const fileInput = document.getElementById("Question_title_fileInput");
|
||||
fileInput.click();
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
showPlaceholder: false,
|
||||
toolbarButtonSize: 'small',
|
||||
toolbarAdaptive: false,
|
||||
saveHeightInStorage: true,
|
||||
minHeight: 400,
|
||||
extraButtons: [
|
||||
{
|
||||
name: 'info',
|
||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||
exec: function (editor) {
|
||||
const fileInput = document.getElementById("Question_title_fileInput");
|
||||
fileInput.click();
|
||||
},
|
||||
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
showPlaceholder: false,
|
||||
toolbarButtonSize: 'small',
|
||||
toolbarAdaptive: false,
|
||||
saveHeightInStorage: true,
|
||||
minHeight: 400,
|
||||
extraButtons: [
|
||||
{
|
||||
name: 'info',
|
||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||
exec: function (editor) {
|
||||
const fileInput = document.getElementById("Question_title_fileInput");
|
||||
fileInput.click();
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
|
||||
let lastActiveField = null;
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
@ -85,7 +110,7 @@ $("#mail_subject").on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
@ -176,6 +201,7 @@ document.addEventListener('change', function(event) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function reloadTicket_conversation() {
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
th,td {
|
||||
th,
|
||||
td {
|
||||
font-size: smaller !important;
|
||||
}
|
||||
|
||||
@ -28,13 +29,13 @@
|
||||
|
||||
th:nth-child(1),
|
||||
td:nth-child(1) {
|
||||
width: 150px;
|
||||
width: 110px;
|
||||
/* Adjust first column width */
|
||||
}
|
||||
|
||||
th:nth-child(2),
|
||||
td:nth-child(2) {
|
||||
width: 550px;
|
||||
width: 720px;
|
||||
/* Adjust first column width */
|
||||
}
|
||||
|
||||
@ -173,7 +174,7 @@
|
||||
<button class="btn btn-primary" id="saveRFQ">Save RFQ</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="allTableContainer">
|
||||
<div id="tablesContainer"></div>
|
||||
<!-- <div id="excessContainer"></div> -->
|
||||
@ -921,7 +922,7 @@
|
||||
}
|
||||
],
|
||||
"public_liability": [{
|
||||
table_type: "append",
|
||||
table_type: "new",
|
||||
table_name: "Public Liability Coverage",
|
||||
table_id: "public_liability_addOnCoverage",
|
||||
table_editable: true,
|
||||
@ -1897,9 +1898,101 @@
|
||||
element.appendChild(icon);
|
||||
}
|
||||
|
||||
$('#saveRFQ').click( () => saveRFQ());
|
||||
$('#saveRFQ').click(() => saveRFQ());
|
||||
// $("#saveRFQ").click(function (){
|
||||
// console.log("Hello the save req button is clicked");
|
||||
// })
|
||||
|
||||
function saveRFQ(){
|
||||
console.log("save rfq clicked");
|
||||
function saveRFQ() {
|
||||
const rfqData = {
|
||||
table_data: {
|
||||
headers: [],
|
||||
data: []
|
||||
}
|
||||
};
|
||||
|
||||
// Get all tables
|
||||
const tables = document.querySelectorAll('table');
|
||||
if (tables.length === 0) return;
|
||||
|
||||
// Extract headers from the first table
|
||||
const headerRow1 = tables[0].querySelector('thead tr:first-child');
|
||||
const headerRow2 = tables[0].querySelector('thead tr:last-child');
|
||||
const headers = [];
|
||||
|
||||
headerRow1.querySelectorAll('th').forEach((th, index) => {
|
||||
const parentHeader = th.textContent.trim();
|
||||
const subHeaders = [];
|
||||
const subHeaderTh = headerRow2.children[index];
|
||||
if (subHeaderTh) {
|
||||
subHeaders.push(subHeaderTh.textContent.trim());
|
||||
}
|
||||
headers.push({
|
||||
parentHeader,
|
||||
subHeaders
|
||||
});
|
||||
});
|
||||
rfqData.table_data.headers = headers;
|
||||
|
||||
// Process all tables
|
||||
tables.forEach(table => {
|
||||
const rows = table.querySelectorAll('tbody tr');
|
||||
rows.forEach(row => {
|
||||
const cells = row.querySelectorAll('td');
|
||||
const rowData = {
|
||||
SNO: '',
|
||||
items: '',
|
||||
data: []
|
||||
};
|
||||
|
||||
// Extract SNO (first cell)
|
||||
if (cells[0]) {
|
||||
rowData.SNO = cells[0].textContent.replace(/\D/g, '') || '1';
|
||||
}
|
||||
|
||||
// Extract items (row ID)
|
||||
rowData.items = row.id || '';
|
||||
|
||||
// Process each cell
|
||||
cells.forEach((cell, cellIndex) => {
|
||||
const header = headers[cellIndex];
|
||||
if (!header) return;
|
||||
|
||||
const parentHeader = header.parentHeader;
|
||||
const subHeader = header.subHeaders[0] || '-';
|
||||
|
||||
// Get displayed value
|
||||
const value = cell.textContent.trim();
|
||||
|
||||
// Get input value (hidden field or checkbox state)
|
||||
let inputValue = value;
|
||||
const hiddenInput = cell.querySelector('input[type="hidden"]');
|
||||
if (hiddenInput) {
|
||||
inputValue = hiddenInput.value;
|
||||
}
|
||||
|
||||
// Handle Action column checkboxes
|
||||
if (parentHeader === 'Action') {
|
||||
const qcrChecked = cell.querySelector('.qcr-checkbox')?.checked ?? false;
|
||||
const clientChecked = cell.querySelector('.client-checkbox')?.checked ?? false;
|
||||
inputValue = {
|
||||
qcr: qcrChecked ? 1 : 0,
|
||||
stc: clientChecked ? 1 : 0
|
||||
};
|
||||
}
|
||||
|
||||
rowData.data.push({
|
||||
parentth: parentHeader,
|
||||
subth: subHeader,
|
||||
value,
|
||||
input_value: inputValue
|
||||
});
|
||||
});
|
||||
|
||||
rfqData.table_data.data.push(rowData);
|
||||
});
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(rfqData, null, 2));
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user