BRANCH_MERGE_SRI

This commit is contained in:
Srinivas-Saravanan 2025-01-28 10:19:13 +05:30
commit 8a87addf4e
12 changed files with 614 additions and 90 deletions

View File

@ -495,7 +495,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
//New Tickets
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
$routes->get('new','TicketController::ticket_form');
$routes->get('new/(:any)','TicketController::ticket_form/$1');
$routes->post('create','TicketController::createTicket');
$routes->get('update','TicketController::updateTicket');
$routes->get('view/(:any)','TicketController::view_ticket/$1');

View File

@ -4047,18 +4047,38 @@ class ClientController extends AdminController
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
$BDSReportController = new BDSReportController();
// $BDSReportController = new BDSReportController();
// $data['data'] = $BDSReportController->getBAPInsurerData();
// return $this->loadLayout('irda_bap_insurer_report_list', $data);
$data['data'] = $BDSReportController->getBAPClientData();
return $this->loadLayout('irda_bap_client_report_list', $data);
// $data['data'] = $BDSReportController->getBAPClientData();
// return $this->loadLayout('irda_bap_client_report_list', $data);
// $data['data'] = $BDSReportController->getClientData(1);
// return $this->loadLayout('irda_client_report_list', $data);
// $BDSReportController->getBAPClientData();
//--------------------------------------------------------------------------------------------------------
// $email_id = 'venkateshraman786@gmail.com';
// $common = ['mail_type'=>'test_mail_cli'];
// $bcc = "vitvelz@gmail.com";
// $data = db_connect()
// ->table('jobs')
// ->where('id', 2264)
// ->get()
// ->getResultArray();
// $data = json_decode($data[0]['payload'], true);
// // dd($data);
// // Send email and get response
// $result = MailHelper::send_email($data[0]);
// echo json_encode($result);
// log_message('error',json_encode($result));
}
// -------------------------------------------------------------------------------------------------------

View File

@ -24,9 +24,12 @@ class TicketController extends BaseController
protected $ticketType;
protected $priorityType;
protected $relationshipType;
protected $ticketMasterModel;
protected $modeOFIntimate;
protected $claimType;
protected $claimStatus;
protected $clientModel;
protected $ticketMasterModel;
protected $ticketHistoryModel;
protected $ticketMailTemplateModel;
protected $ticketMesageModel;
@ -35,6 +38,9 @@ class TicketController extends BaseController
public function __construct()
{
$this->myLogger = \Config\Services::mylogger();
$this->ticketMasterModel = new TicketMasterModel();
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"];
$this->priorityType = [
1 => "Low",
@ -54,6 +60,26 @@ class TicketController extends BaseController
"father-in-law" => "Father-in-Law",
"mother-in-law" => "Mother-in-Law"
];
$this->modeOFIntimate = [
1 => "In Person",
2 => "Courier",
3 => "Online Mode - Email",
4 => "Online Mode - To TPA"
];
$this->claimType = [
1 => [
1 => "Main",
2 => "OPD",
3 => "Pre ReOpen",
4 => "Post ReOpen",
],
2 => [
1 => "TTD",
2 => "PTD",
3 => "PPD",
4 => "Death",
]
];
$this->ticketMasterModel = new TicketMasterModel();
$this->claimStatus = new TicketClaimStatusModel();
$this->clientModel = new ClientModel();
@ -107,11 +133,45 @@ class TicketController extends BaseController
return $data;
}
public function ticket_form()
public function ticket_form($ticket_type)
{
$data['ticket_form'] = 1;
$data['claim_status'] = '';
return $this->loadLayout('ticket_form_gmc', $data);
$data['ticket_type'] = $this->ticketType;
$data['priorityType'] = $this->priorityType;
$data['relationshipType'] = $this->relationshipType;
$data['modeOFIntimate'] = $this->modeOFIntimate;
$data['acms'] = db_connect()->table('user_profiles')
->select('user_profiles.id, user_profiles.first_name')
->where('user_profiles.is_active', 1)
->where('user_profiles.role', 3)
->get()
->getResultArray();
$data['claim_status'] = db_connect()->table('ticket_claim_status')
->select('ticket_claim_status.*')
->where('ticket_claim_status.is_active', 1)
->where('ticket_claim_status.ticket_type', $ticket_type)
->get()
->getResultArray();
if($ticket_type == 1){
$data['modeOFIntimate'] = $this->claimType[1];
return $this->loadLayout('ticket_form_handler', $data);
}else{
$data['modeOFIntimate'] = $this->claimType[2];
if($ticket_type == 2){
$data['ticket_form'] = 'GPA';
}else if($ticket_type = 3){
$data['ticket_form'] == 'EDLI';
}else if($ticket_type = 4){
$data['ticket_form'] = 'GTLI';
}
return $this->loadLayout('ticket_form_handler', $data);
}
}
public function view_ticket($ticket_id)
@ -122,6 +182,33 @@ class TicketController extends BaseController
public function createTicket()
{
$ticket_data = $this->request->getPost();
// print_rr($ticket_data); die;
if(empty($ticket_data['doa'])){
$ticket_data['doa'] = null;
}else{
$ticket_data['doa'] = change_date_format($ticket_data['doa']);
}
if(empty($ticket_data['dod'])){
$ticket_data['dod'] = null;
}else{
$ticket_data['dod'] = change_date_format($ticket_data['dod']);
}
// print_rr($ticket_data); die;
if($ticket_data){
$return_value = $this->ticketMasterModel->insert($ticket_data);
if($return_value){
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully"], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
}
}else{
return $this->respond(['status' => false, 'code' => 404, 'message' => 'claim data not found'], 200);
}
}
public function updateTicket()
@ -135,4 +222,4 @@ class TicketController extends BaseController
}
}
}

View File

@ -12,6 +12,7 @@ class TicketMasterModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
<<<<<<< HEAD
protected $allowedFields = ['id', 'ticket_type_id', 'claim_status_id', 'acm_id', 'insurer_id',
'tpa_id', 'client_id', 'priority', 'policy_no', 'emp_code', 'tpa_no', 'emp_name', 'insured_name',
'relationship', 'emp_mobile', 'emp_mail', 'mode_of_intimation', 'claim_type', 'hospital_name',
@ -19,6 +20,47 @@ class TicketMasterModel extends Model
'date_of_join', 'date_of_incep', 'dob', 'date_of_accident', 'date_of_death', 'date_of_intimat',
'si_amt','claim_number,is_active'
];
=======
protected $allowedFields = [
'id',
'ticket_type_id',
'claim_status_id',
'acm_id',
'insurer_id',
'tpa_id',
'client_id',
'priority',
'policy_no',
'emp_code',
'tpa_no',
'emp_name',
'insured_name',
'relationship',
'emp_mobile',
'emp_mail',
'mode_of_intimation',
'claim_type',
'hospital_name',
'doa',
'dod',
'claim_amount',
'pod_no',
'created_by',
'updated_by',
'created_at',
'updated_at',
'date_of_join',
'date_of_incep',
'dob',
'date_of_accident',
'date_of_death',
'date_of_intimat',
'si_amt',
'is_active',
'claim_number'
];
>>>>>>> 3a4f7b1e836fc71f477cb6ad32a635dcae0192d0
// Callbacks
protected $allowCallbacks = true;

View File

@ -755,7 +755,7 @@
dataType: 'json',
success: function(res) {
console.log('client_policy_res', res);
console.log('client_policy_res by btnPolicyEdit', res);
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
@ -944,7 +944,7 @@
}, 1000);
setTimeout(function(){
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
appendCDACNO(res.cd_data, res.data.cd_ac_pk) // append and select the current CD Account Number
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
}, 2000)
@ -1660,7 +1660,7 @@
text: item.cd_ac_no
});
if (select === item.cd_ac_no) {
if (select === item.id) {
//console.log('selected');
option.attr('selected', true);
}
@ -1990,7 +1990,7 @@
}, 1000);
setTimeout(function(){
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
appendCDACNO(res.cd_data, res.data.cd_ac_pk) // append and select the current CD Account Number
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
}, 2000)

View File

@ -2,6 +2,9 @@
</div> <!-- content -->
<?php include(__DIR__ . '/../ticket_type_modal.php'); ?>
<!-- Footer Start -->
<footer class="footer">
<div class="container-fluid">
@ -927,4 +930,5 @@ function confirmActionSweertAlert(message = "Are you sure?", confirmText = "Yes,
</body>
</html>
</html>

View File

@ -650,7 +650,7 @@
<div class="collapse" id="sidebarDashboardsTicket">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/ticket/new') ?>">New claim</a>
<a href="#" onclick="openTicketTypeAskModal()">New claim</a>
</li>
<li>
<a href="<?= base_url('/ticket/list') ?>">Claim List</a>

View File

@ -1,15 +1,24 @@
<div class="row">
<div class="col-12">
<div class="<?= isset($ticket_form) ? "card" : "" ?>">
<div class="<?= isset($ticket_form) ? "card" : "" ?>" style="margin-right: 23px;">
<div class="card-body">
<?php if(isset($ticket_form)){ ?>
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 id="page_title" style="position: relative;">Claim GMC </h4>
<!-- Header Section -->
<div class="row mb-3">
<div class="col-6 d-flex align-items-center">
<h4 class="mb-0">Claim GMC</h4>
</div>
<div class="col-6 text-right">
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
</a>
</div>
</div>
<?php } ?>
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc"enctype="multipart/form-data">
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" enctype="multipart/form-data">
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
<div class="form-group">
<div class="form-row">
@ -20,7 +29,7 @@
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
echo "<option value=" . $value['id'] . ">" . $value['claim_status'] . "</option>";
}
}
?>
@ -32,9 +41,9 @@
<select class="form-control" id="priority" name="priority">
<option value="0">Select Priority</option>
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
if (isset($priorityType) && count($priorityType)) {
foreach ($priorityType as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
@ -46,9 +55,9 @@
<select class="form-control" id="acm_id" name="acm_id">
<option value="0">Select Account Manager</option>
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
if (isset($acms) && count($acms)) {
foreach ($acms as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['first_name'] . "</option>";
}
}
?>
@ -59,53 +68,31 @@
<label for="policy_no">Policy No<span class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
name="policy_no">
name="policy_no" placeholder="Policy Number" readonly>
</div>
<div class="form-group col-md-3">
<label for="acm_id">Insurer<span class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id">
<option value="0">Select insurer</option>
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
}
}
?>
</select>
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
<input type=hidden id="insurer_id" name="insurer_id">
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" readonly>
</div>
<div class="form-group col-md-3">
<label for="acm_id">TPA<span class="text-danger"></span></label>
<select class="form-control" id="tpa_id" name="tpa_id">
<option value="0">Select TPA</option>
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
}
}
?>
</select>
<label for="tpa_id">TPA<span class="text-danger"></span></label>
<input type=hidden id="tpa_id" name="tpa_id">
<input type=text class="form-control" id="tpa_name" placeholder="TPA" readonly>
</div>
<div class="form-group col-md-3">
<label for="client_name">Corporate Name<span class="text-danger"></span></label>
<select class="form-control" id="client_id" name="client_id">
<option value="0">Select Corporate</option>
<?php
if (isset($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['client_name'] . "</option>";
}
}
?>
</select>
<input type="hidden" id="client_id" name="client_id">
<input type="text" class="form-control" id="client_name" placeholder="Client" readonly>
</div>
<div class="form-group col-md-3">
<label for="emp_code">Employee ID<span class="text-danger"></span></label>
<label for="emp_code">Employee ID &nbsp; <i class="fa fa-search text-danger"
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span
class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
name="emp_code">
@ -120,6 +107,7 @@
<div class="form-group col-md-3">
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
<input type=hidden id="emp_id" name="emp_id">
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
name="emp_name">
@ -127,16 +115,8 @@
<div class="form-group col-md-3">
<label for="insured_name"> Insured Name <span class="text-danger"></span></label>
<select class="form-control" id="insured_name" name="insured_name">
<option value="0">Select Insured Name</option>
<?php
if (isset($ticket_type) && count($ticket_type)) {
foreach ($ticket_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
<input type=hidden id="insured_emp_id" name="insured_emp_id">
<input class="form-control" id="insured_name" name="insured_name">
</div>
<div class="form-group col-md-3">
@ -144,8 +124,8 @@
<select class="form-control" id="relationship" name="relationship">
<option value="0">Select Relationship</option>
<?php
if (isset($ticket_type) && count($ticket_type)) {
foreach ($ticket_type as $key => $value) {
if (isset($relationshipType) && count($relationshipType)) {
foreach ($relationshipType as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
@ -173,8 +153,8 @@
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation">
<option value="0">Select Mode</option>
<?php
if (isset($ticket_type) && count($ticket_type)) {
foreach ($ticket_type as $key => $value) {
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
foreach ($modeOFIntimate as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
@ -187,8 +167,8 @@
<select class="form-control" id="claim_type" name="claim_type">
<option value="0">Select claim Type</option>
<?php
if (isset($ticket_type) && count($ticket_type)) {
foreach ($ticket_type as $key => $value) {
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
foreach ($modeOFIntimate as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
@ -235,12 +215,27 @@
</div>
</div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
<a href="#" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit" onclick="claimFormSubmit('ticket_form_gmc')">Submit</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var doa = flatpickr("#doa", {
dateFormat: "d/m/Y",
allowInput: false
});
var dod = flatpickr("#dod", {
dateFormat: "d/m/Y",
allowInput: false
});
})
</script>

View File

@ -1,11 +1,25 @@
<style>
.readonly-select {
pointer-events: none;
background-color: #e0e0e0;
color: #666;
}
</style>
<div class="row">
<div class="col-12">
<div class="<?= isset($ticket_form) ? "card" : "" ?>">
<div class="<?= isset($ticket_form) ? "card" : "" ?>" style="margin-right: 23px;">
<div class="card-body">
<?php if(isset($ticket_form)){ ?>
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 id="page_title" style="position: relative;">Claim GPA </h4>
<!-- Header Section -->
<div class="row mb-3">
<div class="col-6 d-flex align-items-center">
<h4 class="mb-0">Claim <?= $ticket_form ?></h4>
</div>
<div class="col-6 text-right">
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
</a>
</div>
</div>
<?php } ?>
@ -77,6 +91,21 @@
name="policy_no">
</div>
<div class="form-group col-md-3">
<label for="ticket_type_id"> Policy Type <span class="text-danger"></span></label>
<select class="form-control readonly-select" id="ticket_type_id" name="ticket_type_id" readonly>
<?php
if (isset($ticket_type) && count($ticket_type)) {
foreach ($ticket_type as $key => $value) {
if($key != 1){
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="ticket_type"> Claim Type <span class="text-danger"></span></label>
<select class="form-control" id="ticket_type" name="ticket_type">

View File

@ -0,0 +1,304 @@
<style>
.accordion {
margin-bottom: 1rem;
}
.accordion h4 {
font-weight: bold;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #438e96;
color: #fff;
border-radius: 10px;
font-size: 17px;
padding-left: 13px;
padding-top: 3px;
padding-bottom: 3px;
padding-right: 12px;
}
.accordion-content {
display: none;
padding: 10px;
background-color: #bfe0e2;
margin-top: 5px;
border-radius: 7px;
margin: 5px;
}
.accordion-content.show {
display: block;
}
.arrow {
transition: transform 0.2s;
}
.arrow.rotate {
transform: rotate(90deg);
}
</style>
<?php
if ($ticket_form == 1) {
include('ticket_form_gmc.php');
} else {
include('ticket_form_gpa.php');
}
?>
<div class="modal fade" id="empDetailsModal" tabindex="-1" role="dialog" aria-labelledby="empDetailsModalLabel"
aria-hidden="true" aria-modal="true" data-backdrop="static">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="empDetailsModalLabel">Fetch Employee Data</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="accordion">
<!-- Search by Mobile Number -->
<div>
<h4 onclick="toggleAccordion('mobileAccordion')">
Search by Mobile Number
<span class="arrow" id="mobileArrow"></span>
</h4>
<div class="accordion-content" id="mobileAccordion">
<div id="mobileSearch" class="search-method">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label>Employee Mobile Number</label>
<input class="form-control" type="text" id="mobile_number"
name="mobile_numbers" onkeypress="return onlyNumbers(event)">
</div>
<div class="text-danger" id="error_dis"></div>
</div>
<div class="col-md-4">
<div class="form-group" style="margin-top: 9px;">
<br>
<button class="btn btn-primary"
onclick="searchMobileNumber($('#mobile_number').val())">Search</button>
</div>
</div>
</div>
</div>
<div id="emp_member_policy_div" style="display:none;">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Employee</label>
<select name="employee_by_number" id="employee_by_number"
class="form-control SelExample" onchange="get_member_by_employee(this)">
<option value="0">Select Employee</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Member List</label>
<select name="member_by_number" id="member_by_number"
class="form-control SelExample"
onchange="get_emp_policy(this), setMemberDetails(this)">
<option value="0">Select Member</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Policy</label>
<select id="policy_by_number" name="policy_by_number"
class="form-control custom-select">
<option value="">Select Policy</option>
</select>
<input type="text" id="policy_name" name="policy_name" hidden>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Search by Client, Branch, and Policy -->
<div class="mt-4">
<h4 onclick="toggleAccordion('clientBranchAccordion')">
Search by Client, Branch, and Policy
<span class="arrow" id="clientBranchArrow"></span>
</h4>
<div class="accordion-content" id="clientBranchAccordion">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Client</label>
<select id="emp_client_data_list" name="client"
class="form-control custom-select" onchange="get_branch_list(this)">
<option value="">Select Client</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Branch</label>
<select id="branch" name="branch" class="form-control custom-select"
onchange="get_policies_list(this)">
<option value="">Select Branch</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Policy</label>
<select id="policy_client_branch" name="policy_client_branch"
class="form-control custom-select" onchange="get_employee_list(this)">
<option value="">Select Policy</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Employee</label>
<select name="employee" id="employee" class="form-control SelExample"
onchange="check_policy_gpa_gmc(this)">
<option value="0">Select Employee</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Insured List</label>
<select name="member" id="member" class="form-control SelExample"
onchange="member_change_client_branch(this), setMemberDetails(this)">
<option value="0">Select Member</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Submit</button>
</div> -->
</div>
</div>
</div>
<script>
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
$(document).ready(function() {
getClientAndBranchAndPolicy()
})
function toggleAccordion(id) {
const content = document.getElementById(id);
const arrow = document.querySelector(`#${id === 'mobileAccordion' ? 'mobileArrow' : 'clientBranchArrow'}`);
// Toggle the display of the accordion content
if (content.classList.contains('show')) {
content.classList.remove('show');
arrow.classList.remove('rotate');
} else {
content.classList.add('show');
arrow.classList.add('rotate');
}
}
function openFetchEmpDataodal() {
var myModal = new bootstrap.Modal(document.getElementById('empDetailsModal'));
myModal.show();
}
function getClientAndBranchAndPolicy() {
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
appendClients(res.client_data);
} else {
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
function appendClients(data) {
$('#emp_client_data_list').empty();
$('#emp_client_data_list').append($('<option>', {
value: '',
text: 'Select Client'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
'data-name': item.client_name,
});
$('#emp_client_data_list').append(option);
});
}
function claimFormSubmit($form_id) {
console.log('claimFormSubmit function called')
console.log('$form_id ', $form_id)
let url = '<?= base_url('/ticket/create') ?>';
console.log('url ', url)
// Data to send in the AJAX request
var formData = new FormData($('#'+$form_id)[0]);
console.log('formData ', formData)
// Send AJAX request
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
console.log('Form submitted response:', response);
if (response.status == true) {
toastr.success(response.message, 'SUCCESS');
} else {
toastr.error(response.message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while form submiting.', 'ERROR');
});
}
</script>

View File

@ -106,7 +106,7 @@ $(document).ready(function() {
text: 'New Claim',
className: 'buttons-html5 addbtnStyle',
action: function(e, dt, node, config) {
newClaim()
openTicketTypeAskModal()
}
}
],
@ -129,8 +129,4 @@ function viewTicket(ticket_id){
window.location.href = url
}
function newClaim(){
let url = '<?= base_url('ticket/new'); ?>'
window.location.href = url
}
</script>

View File

@ -0,0 +1,47 @@
<div class="modal fade" id="New_Ticket_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myCenterModalLabel"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col-md-12">
<label for="ticket_type"> Policy Type <span class="text-danger"></span></label>
<select class="form-control" id="openTicketTypeAskModal">
<option value="1">Claim-GMC</option>
<option value="2">Claim-GPA</option>
<option value="3">EDLI</option>
<option value="4">GTLI</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="submitToRedirectTicketNewUrl(this)">submit</button>
</div>
</div>
</div>
</div>
<script>
function openTicketTypeAskModal(){
var myModal = new bootstrap.Modal(document.getElementById('New_Ticket_modal'));
myModal.show();
}
function submitToRedirectTicketNewUrl(){
console.log('function called')
let ticket_type = $('#openTicketTypeAskModal').val()
console.log('ticket_type ', ticket_type)
let url = '<?=base_url('/ticket/new/')?>' + ticket_type
console.log('url ', url)
window.location.href = url;
}
</script>