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

This commit is contained in:
vadivelJ96 2025-09-05 18:31:22 +05:30
commit d34f3290e4
38 changed files with 4251 additions and 504 deletions

View File

@ -73,6 +73,9 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->get("deactive/(:hash)", "UserController::deactive/$1");
$routes->get("rolesandteams", "UserController::getRolesAndTeams");
$routes->get("getUserActivityHistory", "UserController::getUserActivityHistory");
$routes->match(['get','post','put'], 'partner', 'UserController::partner');
$routes->match(['get','post','put'], 'partnerIncentive', 'UserController::partnerIncentive');
$routes->get("download-incentive-file/(:any)", "UserController::downloadIncentivesFile/$1");
});
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
@ -364,7 +367,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
$routes->get('getCDAmount', 'ClientController::getCDAmount');
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
// $routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
$routes->get('getTheEmpDataForClaimSearchByMobile', 'ClientController::getTheEmpDataForClaimSearchByMobile');
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
@ -624,6 +628,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->post('upload_url',"TicketController::upload_url");
$routes->post('getUrlDataByTicketId',"TicketController::getUrlDataByTicketId");
$routes->get('remove_url',"TicketController::remove_url");
$routes->get('fetchVehiclePolicy/(:any)','TicketController::fetchVehiclePolicy/$1');
});
$routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){
@ -674,6 +680,9 @@ $routes->get("ticketHistoryList", "ThzController::ticketHistoryList");
$routes->group('test', function($routes) {
$routes->post('api/saveForm', 'TestingController::saveForm');
$routes->get('insurerRFQRemainder', 'LeadsController::remainderForQcr');
$routes->get('ecard/generate-pdf', 'TestingController::generatePDF');
$routes->get('view-pdf', 'TestingController::viewPDF');
$routes->get('generate-pdf-view', 'TestingController::generatePDFWithView');
});
$routes->cli('cli/testcli', 'TestingController::testcli');

View File

@ -2423,6 +2423,7 @@ class ClientController extends AdminController
// echo "<pre>";
// print_r($this->request->getPost());die;
$this->myLogger->logme('error', "post data : " . json_encode($this->request->getPost() ?? []));
$this->myLogger->logme('error', 'Terms CREATE function called');
/*** Client Policy Table Primary Key(ID) ***/
@ -2624,7 +2625,7 @@ class ClientController extends AdminController
}
$data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
$this->myLogger->logme('error', "contructed post data : " . json_encode($data ?? []));
// print_r($data);die;
$jsonData = json_encode($data);
@ -5404,7 +5405,8 @@ class ClientController extends AdminController
employees.mobile AS emp_mobile,
employees.email_corporate AS emp_email,
employees.relationship AS emp_relationship,
employee_polices.uhid AS policy_no
employee_polices.uhid AS policy_no,
employee_polices.client_policy_id
")
->join('clients', 'client_policy.client_id = clients.id', 'left')
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
@ -5417,9 +5419,15 @@ class ClientController extends AdminController
->where('employees.is_active', 1)
->where('employees.relationship', "Self")
->where('employee_polices.is_active', 1)
->whereIn('employees.emp_status', ['active'])
->whereIn('employee_polices.status', ['active'])
->where('employees.is_active', 1)
->where('client_policy.id', $param)
->groupBy('employees.emp_code')
->get()
->getResultArray();
// print_r(db_connect()->getLastQuery()); die;
$dataForClientAndInsurer = $this->clientPolicyModel
->select("
@ -5461,20 +5469,39 @@ class ClientController extends AdminController
'memberData' => $memberData
], 404);
}
}
public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null, $ticket_type_id = null)
{
}
// public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null, $ticket_type_id = null)
public function getTheEmpDataForClaimSearchByMobile()
{
$request = $this->request;
// Get parameters from GET request
$param = $request->getGet('param');
$type = $request->getGet('type') ?? 'mobile';
$client_policy_id = $request->getGet('client_policy_id');
$client_id = $request->getGet('client_id');
$ticket_type_id = $request->getGet('ticket_type_id');
// Validate required parameter
if (empty($param)) {
return $this->response->setJSON([
'status' => false,
'message' => 'Parameter is required'
])->setStatusCode(400);
}
$field_name = 'employees.' . $type;
$policy_type_id = [];
if($ticket_type_id == 1){
if ($ticket_type_id == 1) {
$policy_type_id = [2, 3, 4, 5];
}else if($ticket_type_id == 2){
} else if ($ticket_type_id == 2) {
$policy_type_id = [1];
}else if($ticket_type_id == 3){
} else if ($ticket_type_id == 3) {
$policy_type_id = [6];
}else if($ticket_type_id == 4){
} else if ($ticket_type_id == 4) {
$policy_type_id = [7];
}
@ -5512,24 +5539,24 @@ class ClientController extends AdminController
->where('employee_polices.status', "active")
->where($field_name, $param);
if (!empty($client_id)) {
$query->where('employees.client_id', $client_id);
}
if (!empty($client_id)) {
$query->where('employees.client_id', $client_id);
}
if (!empty($client_policy_id)) {
$query->where('employee_polices.client_policy_id', $client_policy_id);
}
if (!empty($client_policy_id)) {
$query->where('employee_polices.client_policy_id', $client_policy_id);
}
if($policy_type_id != null){
$query->whereIn('client_policy.policy_type_id', $policy_type_id);
}
$query->groupBy('employees.id')
->orderBy('employees.id', 'DESC');
$data = $query->get()->getRowArray();
if ($policy_type_id != null) {
$query->whereIn('client_policy.policy_type_id', $policy_type_id);
}
// print_r(db_connect()->getLastQuery()); die;
$query->groupBy('employees.id')
->orderBy('employees.id', 'DESC');
$data = $query->get()->getRowArray();
// print_r(db_connect()->getLastQuery()); die;
$memberData = [];
$dataForClientAndInsurer = [];
@ -5540,15 +5567,15 @@ class ClientController extends AdminController
// ->where('user_profiles.role', 3)
// ->get()
// ->getResultArray();
if(!empty($data) && count($data) > 0){
if (!empty($data) && count($data) > 0) {
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $client_policy_id, $client_id);
$acms_datas = $this->employeeModel->getAcmUsingClientID($data['client_id']);
// if(!empty($acms_datas)){
// $acms = $acms_datas;
// }
}else{
} else {
$acms_datas = "";
}

View File

@ -4947,7 +4947,7 @@ class LeadsController extends BaseController
// Start table with clean styling
$html .= "<h3 style='color: #333; font-weight: 500; margin-bottom: 15px;'>{$category}</h3>";
$html .= "<table style='width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;color:black;'>";
$html .= "<table data-custom-table-css='table' style='width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>";
// Table header with light background
$html .= "<tr>";

View File

@ -5,6 +5,8 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
use Dompdf\Dompdf;
use Dompdf\Options;
class TestingController extends BaseController
{
@ -36,4 +38,180 @@ class TestingController extends BaseController
log_message('error', 'test message for log_message_function');
echo "hi 3";
}
public function generatePDF()
{
// Sample data - replace with your actual data source
$data = [
'NAME' => 'John Doe',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => 'POL123456789',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ABC Insurance Co.',
'TPA_NAME' => 'XYZ TPA Ltd.',
'FRONT_CARD' => base_url('assets/images/front-card.jpg'), // Your card images
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
// Load the HTML template
$html = $this->loadTemplate($data);
// Configure DomPDF options
$options = new Options();
$options->set('isRemoteEnabled', true); // Enable loading of remote images
$options->set('isHtml5ParserEnabled', true);
$options->set('isPhpEnabled', true);
$options->set('debugPng', false);
$options->set('debugKeepTemp', false);
$options->set('debugCss', false);
$options->set('debugLayout', false);
$options->set('debugLayoutLines', false);
$options->set('debugLayoutBlocks', false);
$options->set('debugLayoutInline', false);
$options->set('debugLayoutPaddingBox', false);
// Initialize DomPDF
$dompdf = new Dompdf($options);
// Load HTML content
$dompdf->loadHtml($html);
// Set paper size and orientation
$dompdf->setPaper('A4', 'landscape'); // or 'portrait'
// Render PDF
$dompdf->render();
// Output PDF to browser
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
$dompdf->stream($filename, ['Attachment' => true]); // Set to false for inline view
}
public function viewPDF()
{
// Same as generatePDF but with inline view
$data = [
'NAME' => 'John Doe',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => 'POL123456789',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ABC Insurance Co.',
'TPA_NAME' => 'XYZ TPA Ltd.',
'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
$html = $this->loadTemplate($data);
$options = new Options();
$options->set('isRemoteEnabled', true);
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
$dompdf->stream($filename, ['Attachment' => false]); // Inline view
}
private function loadTemplate($data)
{
// Load your HTML template
$template = file_get_contents(WRITEPATH . 'e_card_template/common.html');
// Replace placeholders with actual data
foreach ($data as $key => $value) {
$template = str_replace('{' . $key . '}', $value, $template);
}
return $template;
}
// Alternative method using CodeIgniter's view system
public function generatePDFWithView()
{
$data = [
'NAME' => 'John Doe',
'GENDER' => 'Male',
'DOB' => '01/01/1990',
'RELATION' => 'Self',
'POLICY_NO' => 'POL123456789',
'TPA_ID' => 'TPA987654321',
'POLICY_START_DATE' => '01/01/2024',
'POLICY_DATE' => '31/12/2024',
'INSURER_NAME' => 'ABC Insurance Co.',
'TPA_NAME' => 'XYZ TPA Ltd.',
'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
// Load view with data
$html = view('ecard_template', $data);
$options = new Options();
$options->set('isRemoteEnabled', true);
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
$dompdf->stream($filename, ['Attachment' => true]);
}
public function generatePDFById($id)
{
// Get data from database
$ecardData = [];
if (!$ecardData) {
throw new \CodeIgniter\Exceptions\PageNotFoundException('E-card not found');
}
$data = [
'NAME' => $ecardData['name'],
'GENDER' => $ecardData['gender'],
'DOB' => $ecardData['dob'],
'RELATION' => $ecardData['relation'],
'POLICY_NO' => $ecardData['policy_no'],
'TPA_ID' => $ecardData['tpa_id'],
'POLICY_START_DATE' => $ecardData['policy_start_date'],
'POLICY_DATE' => $ecardData['policy_end_date'],
'INSURER_NAME' => $ecardData['insurer_name'],
'TPA_NAME' => $ecardData['tpa_name'],
'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
];
$html = view('ecard_template', $data);
$options = new Options();
$options->set('isRemoteEnabled', true);
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf($options);
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$filename = 'ecard_' . $ecardData['policy_no'] . '_' . date('Y-m-d') . '.pdf';
$dompdf->stream($filename, ['Attachment' => true]);
}
}

View File

@ -22,6 +22,8 @@ use App\Models\EmployeeModel;
use App\Models\TPAModel;
use App\Models\ClaimFilesModel;
use App\Models\ClaimDumpFileModel;
use App\Models\VehicleModel;
use App\Models\PartnerPolicyModel;
use DOMDocument;
use Psr\Log\LoggerInterface;
@ -62,6 +64,8 @@ class TicketController extends BaseController
protected $TPAModel;
protected $claimFilesModel;
protected $claimDumpFileModel;
protected $vehicleModel;
protected $partnerPolicyModel;
public function __construct()
{
@ -71,7 +75,7 @@ class TicketController extends BaseController
$this->ticketMasterModel = new TicketMasterModel();
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"];
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI", 8 => "Motor"];
$this->priorityType = [
1 => "Low",
2 => "Medium",
@ -348,6 +352,8 @@ class TicketController extends BaseController
$this->TPAModel = new TPAModel();
$this->claimFilesModel = new ClaimFilesModel();
$this->claimDumpFileModel = new ClaimDumpFileModel();
$this->vehicleModel = new VehicleModel();
$this->partnerPolicyModel = new PartnerPolicyModel();
}
public function ticketList()
@ -684,6 +690,9 @@ class TicketController extends BaseController
case 4:
$data['ticket_form'] = 'GTLI';
break;
case 8:
$data['ticket_form'] = 'Motor';
break;
}
// Fetch ACM Users
@ -719,11 +728,78 @@ class TicketController extends BaseController
$data['claim_type'] = $this->claimType[2];
}
$data['client_for_motor'] = $this->clientModel->select('id,client_name')->where('client_type', 2)->where('is_active', 1)->findAll();
$this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type");
return $data;
}
public function fetchVehiclePolicy($id)
{
$method = $this->request->getMethod();
try {
if (!$id) {
throw new \Exception('Invalid ID', 400);
}
if ($method === 'get') {
$data['vehicle_list'] = $this->vehicleModel
->where('is_active', 1)
->where('owner', $id)
->findAll();
$data['partner_policy_list'] = $this->partnerPolicyModel
->where('is_active', 1)
->findAll();
$client = $this->clientModel
->where('is_active', 1)
->where('id', $id)
->first();
$data['email'] = !empty($client) ? $client['email'] : null;
$data['phone'] = !empty($client) ? $client['phone'] : null;
if (empty($data['vehicle_list']) && empty($data['partner_policy_list'])) {
throw new \Exception('No Records found', 404);
}
return $this->response
->setJSON(['status' => 'success', 'data' => $data])
->setStatusCode(200);
}
throw new \Exception('Invalid request method', 405);
} catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = [
'title' => get_class($e),
'type' => get_class($e),
'code' => $code,
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine()
];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([
'status' => 'error',
'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => ($isDbError ? 'database - ' : 'application - ') . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
//transform the claim status
public function transFormClaimStatus($claimStatusId, $ticket_type)
{

View File

@ -18,6 +18,8 @@ use App\Models\UserTeamsModel;
use App\Helpers\BookStackUserHelper;
use App\Models\AuthHistoryModel;
use App\Models\UserActivityHistoryModel;
use App\Models\PartnerStaffModel;
use App\Models\PartnerManagerIncentiveFileModel;
class UserController extends AdminController
@ -32,6 +34,8 @@ class UserController extends AdminController
protected $bookStack;
protected $authHistoryModel;
protected $userActivityHistoryModel;
protected $partnerStaffModel;
protected $partnerManagerIncentiveFileModel;
public function __construct()
{
@ -45,6 +49,8 @@ class UserController extends AdminController
$this->bookStack = new BookStackUserHelper();
$this->authHistoryModel = new AuthHistoryModel();
$this->userActivityHistoryModel = new UserActivityHistoryModel();
$this->partnerStaffModel = new PartnerStaffModel();
$this->partnerManagerIncentiveFileModel = new PartnerManagerIncentiveFileModel();
}
public function list()
@ -563,4 +569,211 @@ class UserController extends AdminController
}
}
public function partner()
{
$method = $this->request->getMethod(); // get, post
try{
// Listing
if ($method === 'get') {
$types = $this->partnerStaffModel->findAll();
if (empty($types)) {
return $this->response->setJSON(['status' => 'error','message' => 'No Staff found'])->setStatusCode(404);
}
return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200);
}
// add/update
if ($method === 'post') {
$data = $this->request->getPost();
if (!empty($data['id'])) {
$text = "update";
$result = $this->partnerStaffModel->update($data['id'], $data);
$updateID = $data['id'];
} else {
$text = "create";
$data['role_id'] = 1;
$data['created_by'] = get_session_userid();
$insertID = $this->partnerStaffModel->insert($data);
$result = true;
}
$id = isset($insertID) && !empty($insertID) ? $insertID : ($updateID ?? null);
return $this->response->setJSON([
'status' => $id ? 'success' : 'error',
'message' => $id ? "Staff {$text}d successfully" : "Unable to {$text} staff. Please try again.",
'id' => $id
])->setStatusCode($id ? 200 : 400);
}
// delete
if ($method === 'put') {
$data = $this->request->getRawInput();
$id = $data['id'] ?? null;
if (!$id) {
return $this->response->setJSON(['status' => 'error', 'message' => 'ID is required'])->setStatusCode(400);
}
$staff = $this->partnerStaffModel->find($id);
if (!$staff) {
return $this->response->setJSON(['status' => 'error','message' => 'Staff not found'])->setStatusCode(404);
}
if ($staff['is_active'] == 1) {
$result = $this->partnerStaffModel->update($id, ['is_active' => 0]);
$message = "Staff deleted successfully";
} else {
return $this->response->setJSON(['status' => 'error','message' => 'Staff already deleted'])->setStatusCode(400);
}
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? $message : "Unable to delete staff. Please try again.",
'id' => $id
])->setStatusCode($result ? 200 : 400);
}
return $this->response->setJSON([ 'status' => 'error', 'message' => 'Invalid request method' ])->setStatusCode(405);
}
catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
public function partnerIncentive()
{
$method = $this->request->getMethod(); // get, post
try{
// Listing
if ($method === 'get') {
$manager_id = $this->request->getGet('manager_id');
$files = $this->partnerManagerIncentiveFileModel->where('manager_id', $manager_id)->findAll();
if (empty($files)) {
return $this->response->setJSON(['status' => 'error','message' => 'No Records found'])->setStatusCode(404);
}
return $this->response->setJSON(['status' => 'success','data' => $files])->setStatusCode(200);
}
// add/update
if ($method === 'post') {
$file = $this->request->getFile('incentive_file_name');
$month = $this->request->getPost('incentive_month');
$managerId = $this->request->getPost('manager_id');
$fileId = $this->request->getPost('id');
if ($file && $file->isValid() && !$file->hasMoved()) {
$fileName = $file->getName();
$path = WRITEPATH.'uploads/incentives';
$file->move($path, $fileName);
$data = [
'manager_id' => $managerId,
'incentive_month' => date('Y-m-d', strtotime($month)),
'incentive_file_name' => $fileName,
'created_by' => get_session_userid()
];
if ($fileId) {
$text = "update";
$this->partnerManagerIncentiveFileModel->update($fileId, $data);
$updateID = $data['id'];
} else {
$text = "create";
$insertID = $this->partnerManagerIncentiveFileModel->insert($data);
$result = true;
}
$id = isset($insertID) && !empty($insertID) ? $insertID : ($updateID ?? null);
return $this->response->setJSON([
'status' => $id ? 'success' : 'error',
'message' => $id ? "File {$text}d successfully" : "Unable to {$text} file. Please try again.",
'id' => $id
])->setStatusCode($id ? 200 : 400);
}
return $this->response->setJSON([
'status' => 'error',
'message' => "Unable to Upload file. Please try again.",
'id' => ''
])->setStatusCode(400);
}
// delete
if ($method === 'put') {
$data = $this->request->getRawInput();
$id = $data['id'] ?? null;
if (!$id) {
return $this->response->setJSON(['status' => 'error', 'message' => 'ID is required'])->setStatusCode(400);
}
$files = $this->partnerManagerIncentiveFileModel->find($id);
if (!$files) {
return $this->response->setJSON(['status' => 'error','message' => 'No Records found'])->setStatusCode(404);
}
if ($files['is_active'] == 1) {
$result = $this->partnerManagerIncentiveFileModel->update($id, ['is_active' => 0]);
$message = "Files deleted successfully";
} else {
return $this->response->setJSON(['status' => 'error','message' => 'files already deleted'])->setStatusCode(400);
}
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? $message : "Unable to delete staff. Please try again.",
'id' => $id
])->setStatusCode($result ? 200 : 400);
}
return $this->response->setJSON([ 'status' => 'error', 'message' => 'Invalid request method' ])->setStatusCode(405);
}
catch (\Throwable $e) {
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
$isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException
|| $e instanceof \mysqli_sql_exception
|| $e instanceof \PDOException;
$context = ['title' => get_class($e),'type' => get_class($e),'code' => $code,'message' => $e->getMessage(),'file' => $e->getFile(),'line' => $e->getLine()];
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
])->setStatusCode($code);
}
}
public function downloadIncentivesFile($file_name)
{
$file_name = basename($file_name);
$filePath = WRITEPATH . 'uploads/incentives/' . $file_name;
try {
if (file_exists($filePath)) {
return $this->response->download($filePath, null);
} else {
$data['message'] = 'File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
$errorMessage = $e->getMessage();
$this->myLogger->logme('error', $errorMessage);
// You can return an error response here
echo $errorMessage;
}
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerManagerIncentiveFileModel extends Model
{
protected $table = 'partner_manager_incentive_file';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array'; // or 'object'
protected $useSoftDeletes = false;
protected $allowedFields = [
'manager_id',
'incentive_month',
'incentive_file_name',
'is_active',
'created_by',
'created_on',
'updated_by',
'updated_on'
];
// Timestamps
protected $useTimestamps = true;
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
protected $dateFormat = 'datetime'; // can be 'date' or 'int'
// Validation Rules (optional, can add more)
// protected $validationRules = [
// 'manager_id' => 'required|integer',
// 'incentive_month' => 'required|valid_date',
// 'incentive_file_name'=> 'required|string|max_length[150]',
// ];
// protected $validationMessages = [
// 'manager_id' => [
// 'required' => 'Manager ID is required',
// 'integer' => 'Manager ID must be a number',
// ],
// 'incentive_month' => [
// 'required' => 'Incentive Month is required',
// 'valid_date' => 'Incentive Month must be a valid date (Y-m-d)',
// ],
// 'incentive_file_name' => [
// 'required' => 'File name is required',
// 'max_length' => 'File name cannot exceed 150 characters',
// ],
// ];
// protected $skipValidation = false;
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerPolicyModel extends Model
{
protected $table = 'partner_policy';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
// Allowed fields (make sure to include only updatable/insertable ones)
protected $allowedFields = [
'quotation_id',
'insured_name',
'rc_no',
'premium_amount',
'policy_number',
'payment_mode',
'policy_pdf_file_name',
'policy_payment_receipt_file_name',
'is_active',
'issued_date',
'start_date',
'end_date',
'manager_id',
'client_id',
'client_policy_id',
'vehicle_id',
'policy_transaction_id',
'pt_oc_share_details_id',
'created_by',
'updated_by'
];
// Optional settings
protected $useTimestamps = true; // enables auto timestamp
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
protected $dateFormat = 'datetime';
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PartnerStaffModel extends Model
{
protected $table = 'partner_staff'; // table name
protected $primaryKey = 'id'; // primary key
protected $useAutoIncrement = true;
// return results as array
protected $returnType = 'array';
protected $useSoftDeletes = false;
// allowed fields for insert/update
protected $allowedFields = ['name','email','mobile','emp_id','role_id','email_otp','is_active','created_by','updated_by','manager_id'];
// automatic timestamps
protected $useTimestamps = true;
protected $createdField = 'created_on';
protected $updatedField = 'updated_on';
protected $dateFormat = 'datetime';
// validation rules
// protected $validationRules = [
// 'name' => 'required|min_length[2]|max_length[150]',
// 'email' => 'permit_empty|valid_email|max_length[150]',
// 'mobile' => 'permit_empty|regex_match[/^[0-9]{10,20}$/]',
// ];
// protected $validationMessages = [
// 'name' => [
// 'required' => 'Name is required',
// 'min_length' => 'Name must have at least 2 characters',
// 'max_length' => 'Name cannot exceed 150 characters'
// ],
// 'email' => [
// 'valid_email' => 'Please provide a valid email address',
// 'max_length' => 'Email cannot exceed 150 characters'
// ],
// 'mobile' => [
// 'regex_match' => 'Mobile number must be 1020 digits only'
// ]
// ];
// protected $skipValidation = false;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
<!-- modal content -->
<div id="con-close-modal" class="modal fade app-font-family" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-dialog-centered modal-lg" <?= !isset($CD_Master_Data) ? 'style="max-width: 35% !important; margin:5px auto!important;"' : '' ?>>
@ -78,8 +79,8 @@
</div>
<div id="cdButtonWrapper" class="form-group text-right m-b-0">
<button class="btn app-btn-outline-secondary app-btn-border-radius mr-2 " type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="resetCdMasterFormModal()">Cancel</button>
<button class="btn app-btn-secondary app-btn-border-radius waves-effect waves-light" id="cd_master_btn_Submit">Submit</button>
<button class="btn app-btn-outline-secondary mr-2 " type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="resetCdMasterFormModal()">Cancel</button>
<button class="btn btn-primary waves-effect waves-light" id="cd_master_btn_Submit">Submit</button>
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
</div>
</form>

View File

@ -55,10 +55,10 @@ table.dataTable thead th {
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">CD Master List</h4>
<h4 style="position: relative;">CD Master</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
<!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"

View File

@ -1,4 +1,5 @@
<style>
.switch {
position: relative;
display: inline-block;
@ -37,11 +38,11 @@
}
input:checked + .slider {
background-color: #2196F3;
background-color: #00999E;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
box-shadow: 0 0 1px #00999E;
}
input:checked + .slider:before {
@ -60,105 +61,130 @@ input:checked + .slider:before {
}
</style>
<div class="tab-pane fade active show" id="general-q-tab">
<!---- new ----->
<div class="row">
<div class="col-12">
<div class="card-body">
<form role="form" class="parsley-examples" method="post" id="insurer_general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>" />
<input type="hidden" name="insurer_id" id="insurer_id" />
<div class="form-group">
<div class="custom-form">
<form role="form" class="parsley-examples" method="post" id="insurer_general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>" />
<input type="hidden" name="insurer_id" id="insurer_id" />
<div class="form-row">
<div class="form-group col-md-4">
<label for="insurer_name">Insurer Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="insurer_name" placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
</div>
<!-- Insurer Name -->
<div class="form-group row">
<label for="insurer_name" class="col-md-4 col-form-label">Insurer Name<span class="text-danger">*</span></label>
<div class="col-md-5">
<input type="text" class="form-control" id="insurer_name" placeholder="Enter Insurer Name"
value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
</div>
</div>
<!-- Short Name -->
<div class="form-group row">
<label for="short_name" class="col-md-4 col-form-label">Insurer Short Name<span class="text-danger">*</span></label>
<div class="col-md-5">
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name"
value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required minlength="3" maxlength="8">
</div>
</div>
<!-- Insurer Type -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Insurer Type</label>
<div class="col-md-6 d-flex align-items-center">
<input type="radio" id="type_pvt" name="type" value="pvt"
<?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
<label for="type_pvt" class="mr-3 ml-2 mt-1 ">PVT</label>
<input type="radio" id="type_psu" name="type" value="psu"
<?= isset($insurer['type']) && $insurer['type'] == 'psu' ? 'checked' : '' ?>>
<label for="type_psu" class="mr-3 ml-2 mt-1 ">PSU</label>
</div>
</div>
<!-- Insurer Category -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Insurer Category</label>
<div class="col-md-6 d-flex align-items-center">
<input type="radio" id="cat_life" name="category" value="life"
<?= isset($insurer['category']) && $insurer['category'] == 'life' ? 'checked' : '' ?>>
<label for="cat_life" class="mr-3 ml-2 mt-1 ">Life</label>
<input type="radio" id="cat_general" name="category" value="general"
<?= isset($insurer['category']) && $insurer['category'] == 'general' ? 'checked' : '' ?>>
<label for="cat_general" class="mr-3 ml-2 mt-1 ">General (Non Life)</label>
</div>
</div>
<!-- Add one day (Addition) -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Add one day to date of coverage when Addition/Dependent addition</label>
<div class="col-md-6 d-flex align-items-center">
<label class="switch">
<input id="addition_add_day" type="checkbox" name="addition_add_day"
<?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
</div>
</div>
<!-- Add one day (Deletion) -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Add one day to date of Deletion</label>
<div class="col-md-6 d-flex align-items-center">
<label class="switch">
<input id="deletion_add_day" type="checkbox" name="deletion_add_day"
<?= (isset($insurer['deletion_add_day']) && $insurer['deletion_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
</div>
</div>
<!-- Multievent Export -->
<div class="form-group row">
<label class="col-md-4 col-form-label">Multievent Export</label>
<div class="col-md-6 d-flex align-items-center">
<label class="switch mb-0">
<input id="is_multi_event" type="checkbox" name="is_multi_event"
<?= (isset($insurer['is_multi_event']) && $insurer['is_multi_event'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
</div>
</div>
<!-- Logo -->
<div class="form-group row">
<label for="insurer_logo" class="col-md-4 col-form-label">Insurer Logo</label>
<div class="col-md-5">
<div class="input-icon">
<input type="file" class="form-control" id="insurer_logo" name="insurer_logo"
accept="image/jpeg, image/jpg, image/png" onchange="PreviewImage();">
<i class="mdi mdi-upload additional-icon"></i>
</div>
</div>
<div class="col-md-3">
<img src="<?= isset($insurer['insurer_logo']) && !empty($insurer['insurer_logo']) ? base_url() . "public/uploads/logo/" . $insurer['insurer_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>"
width="100" height="100" id="uploadPreview"
class="avatar img-circle img-thumbnail" alt="avatar" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<label for="short_name">Insurer Short Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name" value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required minlength="3" maxlength="8">
</div>
<div class="form-group col-md-4">
<label class="switch" style="position: absolute;top: 32px;left: 17px;">
<input id="addition_add_day" type="checkbox" name="addition_add_day" <?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when <br> Addition/Dependent addition</label>
</div>
<div class="form-group col-md-2">
<label class="switch" style="position: absolute;top: 32px;left: 17px;">
<input id="deletion_add_day" type="checkbox" name="deletion_add_day" <?= (isset($insurer['deletion_add_day']) && $insurer['deletion_add_day'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="deletion_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of Deletion </label>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<label for="html">Insurer Type</label><br>
<div style="margin-top: 10px;">
<input type="radio" id="html" name="type" value="pvt" <?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
<label for="html">PVT</label>&nbsp;
<input type="radio" id="css" name="type" value="psu" <?= isset($insurer['type']) && $insurer['type'] == 'psu' ? 'checked' : '' ?>>
<label for="css">PSU</label>
</div>
</div>
<div class="form-group col-md-2">
<label class="switch" style="position: absolute;top: 34px;left: 17px;">
<input id="is_multi_event" type="checkbox" name="is_multi_event" <?= (isset($insurer['is_multi_event']) && $insurer['is_multi_event'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="deletion_add_day" style="position: relative;top: 30px;left: 82px;">Multievent Export</label>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4" style="position: relative;right: 0px;">
<label for="html">Insurer Category</label><br>
<div style="margin-top: 10px;">
<input type="radio" id="html" name="category" value="life" <?= isset($insurer['category']) && $insurer['category'] == 'life' ? 'checked' : '' ?>>
<label for="html">Life</label>&nbsp;
<input type="radio" id="css" name="category" value="general" <?= isset($insurer['category']) && $insurer['category'] == 'general' ? 'checked' : '' ?>>
<label for="css" style="position: absolute;left: 70px;">General(Non Life)</label>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="short_name">Insurer Logo<span class="text-danger"></span></label>
<input type="file" class="form-control" onchange="PreviewImage();" id="insurer_logo" name="insurer_logo" accept="image/jpeg, image/jpg, image/png">
</div>
<div class="form-group col-md-4 float-right" style="position: relative;left: 90px;top: 30px;">
<img src="<?= isset($insurer['insurer_logo']) && !empty($insurer['insurer_logo']) ? base_url() . "public/uploads/logo/" . $insurer['insurer_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar" />
</div>
</div>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
</div>
</form>
<!-- Buttons -->
<div class="form-group row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
</div>
</div>
</form>
</div>
</div>
</div> <!-- end col-->
</div>
<!---- ends ------>
</div>
<!-- end -->

View File

@ -1,13 +1,46 @@
<div class="tab-pane fade" id="branch-tab">
<style>
.modal-subtitle {
font-weight: 500;
font-style: normal;
font-size: 18px;
line-height: 100%;
letter-spacing: 0%;
text-align: center;
margin-top: 5px;
color: #6c757d;
}
</style>
<!-- Optional CSS -->
<style>
/* Make modal really XL and scrollable */
#branchModal .modal-dialog.modal-xl {
max-width: 90%;
height: 90vh;
}
#branchModal .modal-content {
height: 100%;
overflow: hidden;
}
#branchModal .modal-body {
overflow-y: auto;
max-height: 80vh;
}
</style>
<div class="tab-pane fade" id="branch-tab" style="padding-left: 25px;">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
<div class="row float-right" style="padding-bottom: 10px;position: relative;">
<a href="#" id="btnBranchAdd" class="btn app-btn-primary mr-2"><span class="mdi mdi-plus" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</a>
</div>
<div class="table-responsive" id="branch_table" >
<table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0">
<table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0" id="branch-datatable">
<thead class="">
<tr>
<th>Branch Name</th>
<th>Branch Code</th>
@ -19,7 +52,7 @@
</table>
</div>
<div class="row" id="add_branch">
<!-- <div class="row" id="add_branch">
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
@ -132,10 +165,141 @@
</form>
</div>
</div>
</div> <!-- end col-->
</div> !-- end col-- -->
</div>
<!-- end -->
<!-- Modal -->
<div class="modal fade" id="branchModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" style="max-width: 1140px !important;">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header flex-column">
<div class="d-flex w-100 justify-content-between align-items-center">
<h4 class="modal-title mb-0" id="modalLabel">New Branch</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
</div>
<!-- Modal Body -->
<div class="modal-body" style="overflow-y:auto; max-height:80vh;">
<form id="insurer_branch_form" class="parsley-examples" method="post" enctype="multipart/form-data">
<div class="row">
<!-- Left Section: Branch Details -->
<div class="col-md-8 d-flex flex-column" style="max-height: calc(80vh - 50px);">
<!-- Branch Name & Code -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_name">Branch Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" name="branch_name" required>
</div>
<div class="form-group col-md-6">
<label for="branch_code">Branch Code <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" name="branch_code" required>
</div>
</div>
<!-- Address Lines -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="address1">Address Line 1 <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="address1" name="address1" required>
</div>
<div class="form-group col-md-6">
<label for="address2">Address Line 2</label>
<input type="text" class="form-control" id="address2" name="address2">
</div>
</div>
<!-- State & District -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="state">State <span class="text-danger">*</span></label>
<select class="form-control" id="state" name="state" required>
<option value="">Select State</option>
<?php foreach($state as $value) { ?>
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-6">
<label for="district">District <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="district" name="district" required>
</div>
</div>
<!-- City & Pincode -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_city">City <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city" name="city" required>
</div>
<div class="form-group col-md-6">
<label for="pincode">Pincode <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="pincode" name="pincode" required>
</div>
</div>
<!-- Submit / Cancel -->
<div class="form-row">
<!-- <div class="form-group col-md-12 mt-2"> -->
<div style="margin-top: 85px;">
<button type="submit" class="btn btn-primary mr-2" id="btnSubmit">Submit</button>
<button type="button" class="btn app-btn-outline-secondary btnBack" id="btnBack" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<!-- </div> -->
</div>
</div>
<!-- Right Section: Contact Details -->
<div class="col-md-4" style="background:#f8f9fa; max-height: calc(80vh - 50px); overflow-y:auto; border-radius:8px; padding:10px;">
<!-- First Contact -->
<div id="contact_1_wrapper" class="bg-white p-2 mb-2 rounded contact-block">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="modal-subtitle mb-0">Contact 1</h6>
<div class="d-flex align-items-center">
<i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="contact_1_remove"></i>
</div>
</div>
<!-- Contact Form Fields -->
<input type="hidden" name="primarykey[]" id="contact_id_1" value=""/>
<div class="form-group mb-2">
<label for="name">Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
</div>
<div class="form-group mb-2">
<label for="designation">Designation <span class="text-danger">*</span></label>
<input type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
</div>
<div class="form-group mb-2">
<label for="email">Email <span class="text-danger">*</span></label>
<input type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" required>
</div>
<div class="form-group mb-2">
<label for="mobile">Mobile <span class="text-danger">*</span></label>
<input type="tel" class="form-control" placeholder="Enter Contact Mobile" pattern="[0-9]{10}" name="mobile[]" id="mobile" required>
</div>
</div>
<!-- Container for dynamically added contacts -->
<div id="container"></div>
<div>
<button type="button" class="btn btn-primary btn-sm ac me-3" style="width: 100%;" onclick="appendContactHtml()" id="add"><i class="mdi mdi-plus"></i> Add Contact</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
@ -146,8 +310,10 @@
$(document).ready(function () {
insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.hide();
$('#add_branch').hide();
// $('#add_branch').hide();
$('.btnBack').hide();
if(insurer_Branch_PrimaryKey !== ''){
@ -169,6 +335,10 @@
$('#insurer_branch_list').append(branchTable);
}
$('#branch-datatable').DataTable({
paging: true ,
searching: true
});
});
@ -177,10 +347,12 @@
$("#insurer_branch_form")[0].reset();
contactCount = 1
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.show();
// $('#add_branch').show();
// $('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
// $('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
@ -220,10 +392,12 @@
$("#insurer_branch_form")[0].reset();
contactCount = 1
$('#add_branch').hide();
$('#branch_table').show();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.hide();
// $('#add_branch').hide();
// $('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
// $('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
@ -279,10 +453,13 @@
});
$('#insurer_branch_list').append(insurerBranchTableInsert);
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.hide();
// $('#add_branch').hide();
// $('#branch_table').show();
// $('.btnBack').hide();
// $('#btnBranchAdd').show();
},
error: function (xhr, status, error) {
@ -324,10 +501,13 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
$('#add_branch').show();
$('#branch_table').hide();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.show();
// $('#add_branch').show();
// $('#branch_table').show();
$('.btnBack').show();
$('#btnBranchAdd').hide();
// $('#btnBranchAdd').hide();
console.log("res.levelcontact[0].id"+res.levelcontact[0].id);
$('#branch_name').val(res.insurerbranch.branch_name);
$('#branch_code').val(res.insurerbranch.branch_code);
$('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true);
@ -368,95 +548,187 @@
// function appendContactHtml(contact = false, reset = false) {
// console.log('appendContactHtml function called ')
// contactCount++;
// var container = document.getElementById('container');
// var uniqueId = Date.now().toString();
// var html = `
// <div id="${uniqueId}" class="bg-white p-2 mb-2 rounded">
// <div class="d-flex justify-content-between align-items-center mb-2">
// <h6 class="modal-subtitle mb-0">Contact ${contactCount}</h6>
// <div class="d-flex align-items-center">
// <i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="${uniqueId}_remove"></i>
// </div>
// </div>
// <br>
// <div class="form-row">
// <input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
// <div class="form-group col-md-12">
// <label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
// <input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
// <input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
// </div>
// </div>
// </div>
// `;
// if(reset == false){
// container.insertAdjacentHTML('beforeend', html);
// storeButtonId(uniqueId + '_add');
// if (contactCount >= 3) {
// hideStoredAddButtons();
// }
// }
// }
// function removeContact(button) {
// var uniqueId = button.id.split("_")[0];
// var contactSection = document.getElementById(uniqueId);
// if (contactSection) {
// contactSection.parentNode.removeChild(contactSection);
// contactCount --;
// if (contactCount < 3) {
// var addButton = document.querySelector('.ac');
// if (addButton) {
// addButton.style.display = 'block';
// }
// }
// }
// }
// function storeButtonId(id) {
// var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
// buttonIds.push(id);
// localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
// }
// function hideStoredAddButtons() {
// var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
// storedIds.forEach(function(id) {
// var addButton = document.getElementById(id);
// var first_addButton = document.querySelector('.ac')
// if (addButton) {
// addButton.style.display = 'none';
// first_addButton.style.display = 'none';
// }
// });
// }
function renumberContacts() {
var contacts = document.querySelectorAll('.contact-block');
contacts.forEach(function(contact, index) {
let title = contact.querySelector('.modal-subtitle');
if (title) {
title.textContent = "Contact " + (index + 1); // auto numbering
}
});
contactCount = contacts.length; // keep global in sync
}
function appendContactHtml(contact = false, reset = false) {
console.log('appendContactHtml function called ');
console.log('appendContactHtml function called ')
contactCount++;
var container = document.getElementById('container');
var uniqueId = Date.now().toString();
var container = document.getElementById('container');
var uniqueId = Date.now().toString();
var html = `
<div id="${uniqueId}">
<hr>
<h6 class="header-title">Contact ${contactCount}</h6>
<br>
<div class="form-row">
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
<div class="form-group col-md-6">
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
</div>
</div>
<div class="form-group" style="display: flex;">
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
var html = `
<div id="${uniqueId}" class="bg-white p-2 mb-2 rounded contact-block">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="modal-subtitle mb-0"></h6>
<div class="d-flex align-items-center">
<i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="${uniqueId}_remove"></i>
</div>
</div>
<div class="form-row">
<input type="hidden" name="primarykey[]" value="${contact ? contact.id : ''}"/>
<div class="form-group col-md-12">
<label>Name<span class="text-danger">*</span></label>
<input value="${contact ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" required>
</div>
</div>
`;
if(reset == false){
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
if (contactCount >= 3) {
hideStoredAddButtons();
}
}
<div class="form-row">
<div class="form-group col-md-12">
<label>Email<span class="text-danger">*</span></label>
<input value="${contact ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Mobile<span class="text-danger">*</span></label>
<input value="${contact ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" pattern="[0-9]{10}" name="mobile[]" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Designation<span class="text-danger">*</span></label>
<input value="${contact ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" required>
</div>
</div>
</div>
`;
if(!reset){
container.insertAdjacentHTML('beforeend', html);
renumberContacts(); // ✅ fix numbering
toggleAddButton();
}
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount --;
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
if (addButton) {
addButton.style.display = 'block';
}
}
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
renumberContacts(); // ✅ renumber after removal
toggleAddButton();
}
}
function storeButtonId(id) {
function toggleAddButton() {
var totalContacts = document.querySelectorAll('.contact-block, #contact_1_wrapper').length;
var addButton = document.querySelector('.ac');
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
buttonIds.push(id);
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
if (totalContacts >= 3) {
addButton.style.display = 'none';
} else {
addButton.style.display = 'block';
}
}
function hideStoredAddButtons() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
storedIds.forEach(function(id) {
var addButton = document.getElementById(id);
var first_addButton = document.querySelector('.ac')
if (addButton) {
addButton.style.display = 'none';
first_addButton.style.display = 'none';
}
});
}
function showNextAddButton() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false;

View File

@ -45,37 +45,40 @@
}
</style>
<div class="tab-pane fade" id="template-tab">
<div class="tab-pane fade" id="template-tab" style="padding-left: 25px;">
<input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>">
<input type="hidden" id="insurer_id" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>">
<div class="row">
<div class="form-group col-md-4">
<div class="custom-form">
<label for="email">Existing Insurer Export<span class="text-danger">*</span></label>
<select class="form-control" id="insurer" name="insurer" required>
<option value="">Select Insurer</option>
</select>
</div>
</div>
<div class="form-group col-md-6" style="position: relative;top: 28px;">
<label for="email"><span class="text-danger"></span></label>
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="checkInsurerTemplete(this)">Copy</a>
<a href="#" class="btn app-btn-secondary mr-2" onclick="checkInsurerTemplete(this)">Copy</a>
</div>
<div class="form-group col-md-2" style="position: relative;top: 28px;left: 80px;">
<label for="email"><span class="text-danger"></span></label>
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="addNewJsonExportTemplate(this)">Add New</a>
<div class="form-group col-md-2" style="position: relative;top: 28px;">
<div class="float-right">
<label for="email"><span class="text-danger"></span></label>
<a href="#" class="btn app-btn-primary " onclick="addNewJsonExportTemplate(this)"><i class="mdi mdi-plus"></i> Add </a>
</div>
</div>
</div>
<hr>
<div class="table-responsive" id="branch_table" >
<table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0">
<table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0" id="insurer_datatable">
<thead class="">
<tr>
<th>S.NO</th>
<th>Policy Type</th>
@ -164,7 +167,7 @@
</div>
<hr>
<hr class="mb-0">
<!-- <div class="form-row dynamic-form-row">
<div class="form-group col-md-5">
@ -191,7 +194,7 @@
</div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
</div>
</form>
</div>
@ -255,7 +258,15 @@
$(document).ready(function(){
$('#insurer').select2();
// $('#event').select2();
featchInsurerList()
featchInsurerList();
setTimeout(() => {
$('#insurer_datatable').DataTable({
paging: true ,
searching: true
});
}, 2000);
})
$('#templateForm').submit(function(event) {
@ -471,7 +482,12 @@
const newRow = document.createElement('div');
newRow.className = 'form-row dynamic-form-row';
newRow.innerHTML = `
<div class="mt-3 p-3" style="width: 100%; background: #F7F7F7;
border-radius: 30px !important;
display: flex;
gap: 10px;
opacity: 1;
">
<div class="form-group col-md-3">
<label for="db_column_name">DataBase Column Name<span class="text-danger"></span></label>
<select class="form-control db-column-name-select dbColumn" name="db_column_name[]" onchange="checkForDuplicates(this); handleDbColumnChange(this)" ${data !== null && data !== undefined && data !== '' && data.default_value != "" && data.default_value != null ? 'disabled' : ''}>
@ -494,10 +510,11 @@
<input id="default_value" value="${data != null && data != undefined && data != '' && data.default_value != "" && data.default_value != null ? data.default_value : ''}" class="form-control" type="text" name="default_value[]" placeholder="Excel Default value">
</div>
<div class="form-group col-md-2" style="position: relative;top: 28px;">
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
<div class="form-group col-md-2" style="position: relative;left: 28px;">
<a class="btn app-btn-secondary waves-effect waves-light mr-1" onclick="addHTMLInput(this)"><i class="mdi mdi-plus text-white" style="cursor:pointer; font-size:15px !important;"></i></a>
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)"><i class="mdi mdi-trash-can text-white" style="cursor:pointer; font-size:15px !important;"></i></a>
</div>
</div>
`;
container.appendChild(newRow);
if (data != null && data.db_column_name != undefined) {

View File

@ -43,10 +43,10 @@
<div class="row" id="insurer_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Insurer List</h4>
<h4 style="position: relative;">Insurers</h4>
</div>
</div>
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"

View File

@ -1,8 +1,8 @@
<div class="row" id="insurer_add">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="card-body maincard">
<!-- <div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Insurer</h4>
</div>
@ -11,12 +11,19 @@
<i class="mdi mdi-arrow-left" style="font-size: 17px;"></i>
</a>
</div>
</div> -->
<div class="row" style="padding-bottom: 10px;padding-left: 5px;">
<h4 class="d-flex align-items-center" style="gap: 8px;">
<span onclick="history.back()" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</span>
<span class="title-text ">Insurer</span>
</h4>
</div>
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active">
class="nav-link px-3 py-2 active-tab active">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">General</span>
</a>

View File

@ -18,7 +18,7 @@
</table>
</div>
<div class="row" id="add_branch">
<!-- <div class="row" id="add_branch">
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
@ -52,19 +52,68 @@
</form>
</div>
</div>
</div> <!-- end col-->
</div> end col -->
</div>
<!-- end -->
<div class="modal fade" id="kycdocsModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header flex-column">
<div class="d-flex w-100 justify-content-between align-items-center">
<h4 class="modal-title mb-0" id="modalLabel">KYC Docs</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<!-- Modal Body -->
<div class="modal-body" style="overflow-y:auto; max-height:80vh;">
<form role="form" class="parsley-examples" method="post" id="kyc_docs_form" enctype="multipart/form-data">
<!-- CSRF + hidden inputs -->
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="kyc_Docs_PrimaryKey" />
<input type="hidden" name="kyc_type_id" id="kyc_type_id" value="<?= isset($kyc['id']) ? $kyc['id'] : '' ?>"/>
<!-- Form fields -->
<div class="form-row">
<div class="form-group col-md-12">
<label for="file_name">KYC Docs File Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="file_name" name="file_name" placeholder="Enter File Name" required>
</div>
</div>
<!-- Form Actions -->
<div class="form-group text-right mb-0">
<button type="button" class="btn app-btn-outline-secondary waves-effect btnBack" id="btnBack" data-dismiss="modal">
Cancel
</button>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
var kyc_Docs_PrimaryKey = $('#kyc_General_PrimaryKey').val();
var kyc_docs_form_action = '';
$('#add_branch').hide();
$('.btnBack').hide();
var myModal = new bootstrap.Modal(document.getElementById('kycdocsModal'));
myModal.hide();
// $('#add_branch').hide();
// $('.btnBack').hide();
loadKYCDocsList();
@ -72,11 +121,12 @@ $(document).ready(function () {
$('#btnBranchAdd').click(function(){
kyc_docs_form_action = '<?= base_url("master/kyc/kycdocs/createpost"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
var myModal = new bootstrap.Modal(document.getElementById('kycdocsModal'));
myModal.show();
// $('#add_branch').show();
// $('#branch_table').hide();
// $('.btnBack').show();
// $('#btnBranchAdd').hide();
$('#file_name').val('');
$('#state').val('');
@ -100,11 +150,12 @@ $(document).ready(function () {
})
$('.btnBack').click(function(){
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var myModal = new bootstrap.Modal(document.getElementById('kycdocsModal'));
myModal.hide();
// $('#add_branch').hide();
// $('#branch_table').show();
// $('.btnBack').hide();
// $('#btnBranchAdd').show();
$('#file_name').val('');
$('#state').val('');
@ -189,10 +240,12 @@ $(document).ready(function () {
`;
});
$('#kyc_docs_list').append(insurerBranchTableInsert);
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var myModal = new bootstrap.Modal(document.getElementById('kycdocsModal'));
myModal.hide();
// $('#add_branch').hide();
// $('#branch_table').show();
// $('.btnBack').hide();
// $('#btnBranchAdd').show();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
@ -223,10 +276,12 @@ $(document).ready(function () {
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
console.log("right.........");
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
var myModal = new bootstrap.Modal(document.getElementById('kycdocsModal'));
myModal.show();
// $('#add_branch').show();
// $('#branch_table').hide();
// $('.btnBack').show();
// $('#btnBranchAdd').hide();
$('#file_name').val(res.policies.file_name);
$('#kyc_Docs_PrimaryKey').val(res.policies.id);
@ -314,7 +369,7 @@ $(document).ready(function () {
setTimeout(() => {
$('#table-kyc-docs').DataTable({
paging: true ,
searching: false
searching: true
});
}, 2000);
});

View File

@ -1,7 +1,8 @@
<div class="tab-pane fade active show" id="general-q-tab">
<div class="row">
<div class="col-12">
<div class="card-body">
<div class="card-body subcard">
<div class="custom-form">
<form role="form" class="parsley-examples" method="post" id="kyc_general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="kyc_General_PrimaryKey" value="<?= isset($kyc['id']) ? $kyc['id'] : '' ?>"/>
@ -16,16 +17,17 @@
</div>
</div>
<hr>
<br>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack"
id="btnBack">Cancel</button>
</div>
</form>
</div>
</div>
</div> <!-- end col-->
</div>

View File

@ -43,10 +43,10 @@
<div class="row" id="kyc_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">KYC List</h4>
<h4 style="position: relative;">KYC</h4>
</div>
</div>
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"

View File

@ -33,19 +33,27 @@ body {
<div class="row" id="insurer_add">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<div class="row" style="padding-bottom: 10px;">
<h4 class="d-flex align-items-center" style="gap: 8px;">
<span onclick="history.back()" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</span>
<span class="title-text ">KYC Entity Type</span>
</h4>
</div>
<!-- <div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">KYC Entity Type</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/kyc/list"); ?>" ><i class="mdi mdi-arrow-left" style="font-size: 17px;"></i> </a>
</div>
</div>
</div> -->
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active">
class="nav-link px-3 py-2 active-tab active">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">General</span>
</a>

View File

@ -523,8 +523,6 @@ a.app-text-success:hover, a.app-text-success:focus {
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
.app-btn-border-radius{ border-radius: 10px !important; }
.app-badge-primary {
color: #ffffff;
background-color: #00999E; }
@ -1160,7 +1158,101 @@ a.app-badge-secondary:focus, a.app-badge-secondary.focus {
}
</style>
<style>
.custom-form .parsley-examples {
background-color: transparent !important;
padding: 0 !important;
border: none !important;
box-shadow: none !important;
}
.custom-form .form-control {
background-color: #F5FFFF !important;
border: none !important;
/* color: #000; keep text readable */
box-shadow: 0px 1px 1px 0px #00000040;
}
.custom-form .form-control:focus {
background-color: #F5FFFF !important;
box-shadow: none;
}
.custom-form .select2-container--default .select2-selection--multiple {
background-color: #F5FFFF !important;
border: none !important;
}
.custom-form .select2-container .select2-selection--single {
background-color: #F5FFFF !important;
border: 1px solid #ccc !important;
height: 38px !important;
box-shadow: none !important;
}
.custom-form .select2-container--default .select2-selection--multiple {
background-color: #F5FFFF !important;
border: 1px solid #ccc !important;
min-height: 38px !important;
border-radius: 5px; /* optional */
}
.maincard{
margin-top:0 !important;
padding-top: 0 !important;
}
.subcard{
padding-top: 0px;
padding-left: 5px;
}
.btn-custom {
font-weight: 500;
font-style: normal;
font-size: 12px;
line-height: 1;
letter-spacing: 0;
text-align: center;
}
</style>
<style>
/* Common wrapper (works for text/file inputs) */
.input-icon {
position: relative;
display: block;
width: 100%;
}
/* All form controls inside */
.input-icon .form-control {
width: 100%;
box-sizing: border-box;
padding-right: 40px; /* always keep space for icon */
cursor: pointer;
}
/* Hide default file button */
.input-icon .form-control[type="file"]::file-selector-button {
display: none;
}
.input-icon input[type="file"].form-control {
padding-right: 40px; /* space for the icon */
cursor: pointer;
}
/* Common icon class */
.input-icon .additional-icon {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
font-size: 18px;
color: #555;
pointer-events: none;
}
input[type="radio"] {
accent-color: #40B2B6; /* sets the checked color */
}
</style>
</head>

View File

@ -775,8 +775,34 @@
console.log('autoSaveOtherTerms function called');
var formData = new FormData($('#otherPolicyTerms')[0]);
console.log("formData", formData);
// var formData = new FormData($('#otherPolicyTerms')[0]);
// console.log("formData", formData);
var form = $('#otherPolicyTerms')[0];
if (!form) {
console.error("Form #otherPolicyTerms not found");
return;
}
// Check if form has any data before proceeding
var formData = new FormData(form);
var hasData = false;
for (let [key, value] of formData.entries()) {
console.log("Key:", key, "Value:", value);
if(key == "sum_insureds"){
if (value && value.toString().trim() !== '') {
hasData = true;
break;
}
}
}
if (!hasData) {
console.warn("Form data is empty, skipping auto-save");
return;
}
var policy_form_action = '<?= base_url("client/terms/other_terms") ?>';
console.log("policy_form_action", policy_form_action);
@ -809,9 +835,9 @@
// Append the JSON string to the FormData object
formData.append('policy_terms', jsonString);
formData.forEach((value, key) => {
console.log(key + ': ' + value);
});
// formData.forEach((value, key) => {
// console.log(key + ': ' + value);
// });
$.ajax({
data: formData,

View File

@ -1924,6 +1924,34 @@
console.log("autoSaveGmcTerms function called");
// Add form validation before proceeding
var form = $('#policyJsonForm')[0];
if (!form) {
console.error("Form #policyJsonForm not found");
return;
}
// Check if form has any data before proceeding
var formData = new FormData(form);
var hasData = false;
console.log("form entries : ", formData.entries());
for (let [key, value] of formData.entries()) {
console.log("Key:", key, "Value:", value);
if(key == "sum_insured"){
if (value && value.toString().trim() !== '') {
hasData = true;
break;
}
}
}
if (!hasData) {
console.warn("Form data is empty, skipping auto-save");
return;
}
var specialConditions = [];
$(".removeDom").each(function() {
@ -1938,19 +1966,15 @@
});
}
});
console.log("specialConditions", specialConditions);
var formData = new FormData($('#policyJsonForm')[0]);
console.log("formData", formData);
// var formData = new FormData($('#policyJsonForm')[0]);
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
console.log("policy_form_action", policy_form_action);
formData.append("special_condition_display_value", JSON.stringify(specialConditions));
// console.log('formData', formData);
formData.forEach((value, key) => {
// console.log(key + ':', value);
});
$.ajax({
data: formData,

View File

@ -566,45 +566,77 @@
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
if (key.includes("gpa_special_condition_label") || key.includes(
"gpa_special_condition_input")) {
// if (key.includes("gpa_special_condition_label") || key.includes("gpa_special_condition_input")) {
// if (key.includes("gpa_special_condition_label")) {
// for (let index = 0; index <
// gpaJsonObjectForSpecialCondition[key].length; index++) {
// specialConditionForGPA();
// }
// }
// let elements = document.getElementsByName(`${key}[]`);
// if (elements) {
// elements.forEach((element, index) => {
// if (gpaJsonObjectForSpecialCondition[key][
// index
// ] == undefined) {
// element.value = " ";
// } else {
// element.value =
// gpaJsonObjectForSpecialCondition[key][
// index
// ];
// if (key.includes("gpa_special_condition_label")) {
// let checkbox = $(element).closest('.form-group').find('input[name="gpa_special_condition_display[]"]');
// console.log("First element:", element);
// if (checkbox.length) {
// console.log("Checkbox found:", checkbox);
// // Correct way to set the 'id' attribute
// let formattedValue = gpaJsonObjectForSpecialCondition[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
// console.log('formattedValue', formattedValue);
// checkbox.attr('id', formattedValue + '_display');
// console.log("Updated Checkbox:", checkbox);
// } else {
// console.log("Checkbox not found for:", element);
// }
// }
// }
// });
// }
// }
if (key.includes("gpa_special_condition_label") || key.includes("gpa_special_condition_input")) {
if (key.includes("gpa_special_condition_label")) {
for (let index = 0; index <
gpaJsonObjectForSpecialCondition[key].length; index++) {
specialConditionForGPA();
let count = gpaJsonObjectForSpecialCondition[key]?.length || 0;
for (let i = 0; i < count; i++) {
specialConditionForGPA(); // Called once per label entry
}
}
let elements = document.getElementsByName(`${key}[]`);
if (elements) {
elements.forEach((element, index) => {
if (elements && elements.length) {
Array.from(elements).forEach((element, index) => {
let value = gpaJsonObjectForSpecialCondition[key]?.[index] || "";
if (gpaJsonObjectForSpecialCondition[key][
index
] == undefined) {
element.value = " ";
} else {
element.value =
gpaJsonObjectForSpecialCondition[key][
index
];
element.value = value;
if (key.includes("gpa_special_condition_label")) {
let checkbox = $(element).closest('.form-group').find('input[name="gpa_special_condition_display[]"]');
console.log("First element:", element);
if (key.includes("gpa_special_condition_label")) {
let checkbox = $(element).closest('.form-group')
.find('input[name="gpa_special_condition_display[]"]');
if (checkbox.length) {
console.log("Checkbox found:", checkbox);
// Correct way to set the 'id' attribute
let formattedValue = gpaJsonObjectForSpecialCondition[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
console.log('formattedValue', formattedValue);
checkbox.attr('id', formattedValue + '_display');
console.log("Updated Checkbox:", checkbox);
} else {
console.log("Checkbox not found for:", element);
}
if (checkbox.length) {
let formattedValue = value.replace(/[\s\-\/,&]+/g, '').toLowerCase();
checkbox.attr('id', formattedValue + '_display');
}
}
});
@ -1000,6 +1032,32 @@
console.log('autoSaveGpaTerms function called');
var form = $('#policyGPATerms')[0];
if (!form) {
console.error("Form #policyGPATerms not found");
return;
}
// Check if form has any data before proceeding
var formData = new FormData(form);
var hasData = false;
for (let [key, value] of formData.entries()) {
console.log("Key:", key, "Value:", value);
if(key == "sumInsured2"){
if (value && value.toString().trim() !== '') {
hasData = true;
break;
}
}
}
if (!hasData) {
console.warn("Form data is empty, skipping auto-save");
return;
}
var specialConditions = [];
$(".removeDom").each(function () {
@ -1012,12 +1070,9 @@
specialConditions.push({ [label]: input });
}
});
console.log("gpa_specialConditions", specialConditions);
var formData = new FormData($('#policyGPATerms')[0]);
console.log("formData", formData);
// var formData = new FormData($('#policyGPATerms')[0]);
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
console.log("policy_form_action", policy_form_action);

View File

@ -1,7 +1,8 @@
<div class="tab-pane fade active show" id="general-q-tab">
<div class="row">
<div class="col-12">
<div class="card-body">
<div class="card-body subcard">
<div class="custom-form">
<form role="form" class="parsley-examples" method="post" id="policytype_general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="policytype_General_PrimaryKey" value="<?= isset($policytype['id']) ? $policytype['id'] : '' ?>"/>
@ -70,16 +71,18 @@
</div>
<hr>
<!-- <hr> -->
<br>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack"
id="btnBack">Cancel</button>
</div>
</form>
</div>
</div>
</div> <!-- end col-->
</div>

View File

@ -69,7 +69,7 @@
<div class="row" id="policy_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<!-- <div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Policy Type List</h4>
@ -78,6 +78,11 @@
<a href="<?= base_url("master/policy/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
</div>
</div> -->
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Policy</h4>
</div>
</div>
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light">

View File

@ -30,23 +30,32 @@ body {
</style>
<div class="row" id="policy_add">
<div id="policy_add">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="card-body maincard">
<!-- <div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Policy Type</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/policy/list"); ?>"><i class="mdi mdi-arrow-left" style="font-size: 17px;"></i> </a>
</div>
</div> -->
<div class="row" style="padding-bottom: 10px;">
<h4 class="d-flex align-items-center" style="gap: 8px;">
<span onclick="history.back()" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</span>
<span class="title-text ">Policy Type</span>
</h4>
</div>
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active">
class="nav-link px-3 py-2 active-tab active">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">General</span>
</a>
</li>

View File

@ -1,11 +1,5 @@
<style>
.maincard{
margin-top:0 !important;
padding-top: 0 !important;
}
.col-12 {
max-width: 98% !important;
@ -38,21 +32,6 @@ table.dataTable td.wrap {
word-break: break-word;
}
.btn-custom {
font-weight: 500;
font-style: normal;
font-size: 12px;
line-height: 1;
letter-spacing: 0;
text-align: center;
}
</style>
@ -287,8 +266,8 @@ table.dataTable td.wrap {
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn app-btn-primary app-btn-border-radius mr-2 " onclick="resetTicket()">Reset</button>
<button type="submit" class="btn app-btn-secondary app-btn-border-radius" onclick="submitTicket(event)">Save</button>
<button type="button" class="btn app-btn-primary mr-2 " onclick="resetTicket()">Reset</button>
<button type="submit" class="btn app-btn-secondary " onclick="submitTicket(event)">Save</button>
</div>
</form>
</div>
@ -320,7 +299,7 @@ table.dataTable td.wrap {
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-custom app-btn-secondary app-btn-border-radius " onclick="updateAssignTo()">Save</button>
<button type="button" class="btn-custom app-btn-secondary " onclick="updateAssignTo()">Save</button>
</div>
</div>
</div>
@ -400,9 +379,9 @@ table.dataTable td.wrap {
var form = document.getElementById("ticketForm"); // your form ID
var formData = new FormData(form);
var btn = document.querySelector("button[onclick='submitTicket()']");
btn.disabled = true;
btn.innerText = "Saving...";
var btn = event.target;
btn.disabled = true;
btn.innerText = "Saving...";
$.ajax({
url: "<?= base_url('ticketSave') ?>",
@ -616,7 +595,7 @@ $(document).ready(function() {
buttons: [
{
text: '<i class="mdi mdi-plus" ></i><span class=" btn-custom"> Create New Ticket </span>',
className: 'btn app-btn-primary app-btn-border-radius mr-2',
className: 'btn app-btn-primary mr-2',
action: function(e, dt, node, config) {
openTicket();
}
@ -624,7 +603,7 @@ $(document).ready(function() {
{
extend: 'collection',
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
className: 'btn app-btn-secondary app-btn-border-radius',
className: 'btn app-btn-secondary ',
buttons: [
{
extend: 'csv',

View File

@ -69,11 +69,6 @@
transform: scale(1.5);
}
.maincard{
margin-top:0 !important;
padding-top: 0 !important;
}
.conversation-card,
.conversation-card .card-header,
.conversation-card .card-body {
@ -391,7 +386,7 @@ hr{
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn app-btn-secondary app-btn-border-radius" onclick="submitTicket()">Save</button>
<button type="button" class="btn app-btn-secondary " onclick="submitTicket()">Save</button>
</div>
</form>
</div>
@ -538,10 +533,17 @@ hr{
var form = document.getElementById("ticketForm");
var id = form.querySelector("[name='thz_id']").value;
var formData = new FormData(form);
form.classList.remove('was-validated');
var btn = document.querySelector("button[onclick='submitTicket()']");
btn.disabled = true;
btn.innerText = "Saving...";
var ticketType = document.getElementById('ticket_type').value.trim();
if (ticketType === "") {
toastr.warning('Please fill all required fields.', 'Warning');
form.classList.add('was-validated');
return;
}
$.ajax({
url: "<?= base_url('ticketSave') ?>",

View File

@ -46,6 +46,8 @@
if (!isset($view_ticket_page)) {
if ($selected_ticket_type == 1) {
include('ticket_form_gmc.php');
} else if ($selected_ticket_type == 8) {
include('ticket_form_motor.php');
} else {
include('ticket_form_gpa.php');
}
@ -601,8 +603,11 @@
param = $(input).val();
client_id = $('#emp_client_data_list').val()
}
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
client_policy_id + '/' + client_id + '/'+ selected_ticket_type_id;
// let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
// client_policy_id + '/' + client_id + '/'+ selected_ticket_type_id;
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile') ?>';
// Data to send in the AJAX request
let requestData = {

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
<option value="2">Claim-GPA</option>
<option value="3">EDLI</option>
<option value="4">GTLI</option>
<option value="8">Motor</option>
</select>
</div>
</div>

View File

@ -1,7 +1,65 @@
<style>
.image-preview {
border: 1px solid #00999E;
border-radius: 12px;
width: 70px;
height: 70px;
display: flex;
align-items: center;
justify-content: center;
/* margin-right: 15px; */
}
.image-preview img {
width: 50px;
height: 50px;
object-fit: contain;
}
.upload-btn {
background-color: #00999E;
color: #fff;
border: none;
border-radius: 25px;
padding: 6px 20px;
margin-right: 10px;
cursor: pointer;
font-size: 14px;
}
/* .delete-btn {
background-color: #e5f7f6;
color: #00999E;
border: none;
border-radius: 25px;
padding: 6px 20px;
cursor: pointer;
font-size: 14px;
} */
.helper-text {
font-size: 12px;
color: #666;
margin-top: 8px;
/* wrapping fixes */
word-wrap: break-word; /* old browsers */
overflow-wrap: break-word; /* modern browsers */
white-space: normal; /* allow wrapping */
max-width: 285px; /* adjust to your design width */
}
.hidden-input {
display: none;
}
</style>
<div class="tab-pane fade active show" id="general-q-tab">
<div class="row">
<div class="col-12">
<div class="card-body">
<div class="card-body subcard">
<div class="custom-form">
<form role="form" class="parsley-examples" method="post" id="tpa_general_form" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="tpa_General_PrimaryKey" value="<?= isset($tpa['id']) ? $tpa['id'] : '' ?>" />
@ -22,7 +80,7 @@
</div>
</div>
<hr>
<br>
<div class="form-row">
<div class="form-group col-md-12">
@ -37,7 +95,7 @@
</div>
</div>
<div class="form-row">
<!-- <div class="form-row">
<div class="form-group col-md-4">
<label for="tpa_logo">TPA Logo<span class="text-danger"></span></label>
<input type="file" class="form-control" onchange="PreviewImage();" id="tpa_logo" name="tpa_logo" accept="image/jpeg, image/jpg, image/png">
@ -50,9 +108,9 @@
<label for="tpa_back_card_image">Back card Image<span class="text-danger"></span></label>
<input type="file" class="form-control" onchange="PreviewImage3();" id="bc" name="bc" accept="image/jpeg, image/jpg, image/png">
</div>
</div>
</div> -->
<div class="form-row">
<!-- <div class="form-row">
<div class="form-group col-md-4">
<label for="tpa_logo_preview">TPA Logo Preview<span class="text-danger"></span></label>
<img src="<?= isset($tpa['tpa_logo']) && !empty($tpa['tpa_logo']) ? base_url() . "public/uploads/logo/" . $tpa['tpa_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar" />
@ -65,15 +123,118 @@
<label for="tpa_back_card_preview">Back card Preview<span class="text-danger"></span></label>
<img src="<?= isset($tpa['back_card']) && !empty($tpa['back_card']) ? base_url() . "public/uploads/template_bg/" . $tpa['back_card'] : base_url() . "public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview3" class="avatar img-circle img-thumbnail" alt="avatar" />
</div>
</div>
</div> -->
<div class="form-row">
<!-- TPA Logo -->
<div class="form-group col-md-4">
<label for="tpa_logo">TPA Logo</label>
<div class="row align-items-center">
<!-- Left column: Image -->
<div class="col-auto">
<div class="image-preview">
<img src="<?= isset($tpa['tpa_logo']) && !empty($tpa['tpa_logo']) ? base_url() . "public/uploads/logo/" . $tpa['tpa_logo'] : base_url() . "public/assets/images/avatar_2x.png" ?>"
id="uploadPreview0"
class="avatar img-circle img-thumbnail"
alt="TPA Logo" />
</div>
</div>
<!-- Right column: Buttons + text -->
<div class="col">
<div class="d-flex">
<button type="button" class="upload-btn" onclick="document.getElementById('tpa_logo').click();">Upload</button>
<!-- <button type="button" class="delete-btn" onclick="removeImage0();">Delete</button> -->
</div>
<div class="helper-text" id="fileNameText0">
<?= isset($tpa['tpa_logo']) && !empty($tpa['tpa_logo']) ? $tpa['tpa_logo'] : '( Upload Your TPA Logo )' ?>
</div>
</div>
</div>
<!-- Hidden File Input -->
<input type="file" class="hidden-input"
id="tpa_logo" name="tpa_logo"
accept="image/jpeg, image/jpg, image/png"
onchange="PreviewImage0(event);" />
</div>
<!-- TPA Logo Ends -->
<!-- Front Image -->
<div class="form-group col-md-4">
<label for="tpa_logo">Front card Image</label>
<div class="row align-items-center">
<!-- Left column: Image -->
<div class="col-auto">
<div class="image-preview">
<img src="<?= isset($tpa['front_card']) && !empty($tpa['front_card']) ? base_url() . "public/uploads/template_bg/" . $tpa['front_card'] : base_url() . "public/assets/images/avatar_2x.png" ?>"
id="uploadPreview1"
class="avatar img-circle img-thumbnail"
alt="avatar" />
</div>
</div>
<!-- Right column: Buttons + text -->
<div class="col">
<div class="d-flex">
<button type="button" class="upload-btn" onclick="document.getElementById('fc').click();">Upload</button>
<!-- <button type="button" class="delete-btn" onclick="removeImage1();">Delete</button> -->
</div>
<div class="helper-text" id="fileNameText1">
<?= isset($tpa['front_card']) && !empty($tpa['front_card']) ? $tpa['front_card'] : '( Upload Your Front card Image )' ?>
</div>
</div>
</div>
<!-- Hidden File Input -->
<input type="file" class="hidden-input"
id="fc" name="fc"
accept="image/jpeg, image/jpg, image/png"
onchange="PreviewImage1(event);" />
</div>
<!-- Front Image Ends -->
<!-- Back Image -->
<div class="form-group col-md-4">
<label for="tpa_logo">Back card Image</label>
<div class="row align-items-center">
<!-- Left column: Image -->
<div class="col-auto">
<div class="image-preview">
<img src="<?= isset($tpa['back_card']) && !empty($tpa['back_card']) ? base_url() . "public/uploads/template_bg/" . $tpa['back_card'] : base_url() . "public/assets/images/avatar_2x.png" ?>"
id="uploadPreview4"
class="avatar img-circle img-thumbnail"
alt="avatar" />
</div>
</div>
<!-- Right column: Buttons + text -->
<div class="col">
<div class="d-flex">
<button type="button" class="upload-btn" onclick="document.getElementById('bc').click();">Upload</button>
<!-- <button type="button" class="delete-btn" onclick="removeImage4();">Delete</button> -->
</div>
<div class="helper-text" id="fileNameText4">
<?= isset($tpa['back_card']) && !empty($tpa['back_card']) ? $tpa['back_card'] : '( Upload Your Back card Image )' ?>
</div>
</div>
</div>
<!-- Hidden File Input -->
<input type="file" class="hidden-input"
id="bc" name="bc"
accept="image/jpeg, image/jpg, image/png"
onchange="PreviewImage4(event);" />
</div>
<!-- Back Image Ends -->
</div>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<button type="submit" class="btn app-btn-secondary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
</div>
</form>
</div>
</div>
</div> <!-- end col-->
</div>
@ -213,7 +374,6 @@
};
};
function PreviewImage2() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("fc").files[0]);
@ -232,6 +392,75 @@
};
};
function PreviewImage0(event) {
const input = event.target;
const file = input.files[0];
if (file) {
// Show preview
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('uploadPreview0').src = e.target.result;
};
reader.readAsDataURL(file);
// Show file name
document.getElementById('fileNameText0').innerText = file.name;
}
}
function removeImage0() {
// Reset preview to default
document.getElementById('uploadPreview0').src = "<?= base_url() . 'public/assets/images/avatar_2x.png' ?>";
document.getElementById('fileNameText0').innerText = '( Upload Your TPA Logo )';
document.getElementById('tpa_logo').value = ""; // clear file input
}
function PreviewImage1(event) {
const input = event.target;
const file = input.files[0];
if (file) {
// Show preview
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('uploadPreview1').src = e.target.result;
};
reader.readAsDataURL(file);
// Show file name
document.getElementById('fileNameText1').innerText = file.name;
}
}
function removeImage1() {
// Reset preview to default
document.getElementById('uploadPreview1').src = "<?= base_url() . 'public/assets/images/avatar_2x.png' ?>";
document.getElementById('fileNameText1').innerText = '( Upload Your Front card Image )';
document.getElementById('fc').value = ""; // clear file input
}
function PreviewImage4(event) {
const input = event.target;
const file = input.files[0];
if (file) {
// Show preview
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('uploadPreview4').src = e.target.result;
};
reader.readAsDataURL(file);
// Show file name
document.getElementById('fileNameText4').innerText = file.name;
}
}
function removeImage4() {
// Reset preview to default
document.getElementById('uploadPreview4').src = "<?= base_url() . 'public/assets/images/avatar_2x.png' ?>";
document.getElementById('fileNameText4').innerText = '( Upload Your Back card Image )';
document.getElementById('bc').value = ""; // clear file input
}
$('#preview').click(function() {
var ecardContent = $('#ecard_content').val();
$('#Preview_data').html(ecardContent);

View File

@ -1,13 +1,45 @@
<style>
.modal-subtitle {
font-weight: 500;
font-style: normal;
font-size: 18px;
line-height: 100%;
letter-spacing: 0%;
text-align: center;
margin-top: 5px;
color: #6c757d;
}
</style>
<!-- Optional CSS -->
<style>
/* Make modal really XL and scrollable */
#branchModal .modal-dialog.modal-xl {
max-width: 90%;
height: 90vh;
}
#branchModal .modal-content {
height: 100%;
overflow: hidden;
}
#branchModal .modal-body {
overflow-y: auto;
max-height: 80vh;
}
</style>
<div class="tab-pane fade" id="branch-tab">
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="mdi mdi-plus-box-outline" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
<div class="row float-right" style="padding-bottom: 10px;position: relative;">
<a href="#" id="btnBranchAdd" class="btn app-btn-primary mr-2"><span class="mdi mdi-plus" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</a>
</div>
<div class="table-responsive" id="branch_table" >
<table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0">
<table data-custom-table-css="table" class="table table-borderless table-nowrap mb-0" id="tpa-branch-datatable">
<thead class="">
<tr>
<th>Branch Name</th>
<th>Branch Code</th>
@ -19,7 +51,7 @@
</table>
</div>
<div class="row" id="add_branch">
<!-- <div class="row" id="add_branch">
<div class="col-12">
<div class="card-body">
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
@ -130,9 +162,139 @@
</form>
</div>
</div>
</div> <!-- end col-->
</div> !-- end col-- -->
</div>
<!-- end -->
<!-- Modal -->
<div class="modal fade" id="branchModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" style="max-width: 1140px !important;">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header flex-column">
<div class="d-flex w-100 justify-content-between align-items-center">
<h4 class="modal-title mb-0" id="modalLabel">New Branch</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
</div>
<!-- Modal Body -->
<div class="modal-body" style="overflow-y:auto; max-height:80vh;">
<form id="insurer_branch_form" class="parsley-examples" method="post" enctype="multipart/form-data">
<div class="row">
<!-- Left Section: Branch Details -->
<div class="col-md-8 d-flex flex-column" style="max-height: calc(80vh - 50px);">
<!-- Branch Name & Code -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_name">Branch Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_name" name="branch_name" required>
</div>
<div class="form-group col-md-6">
<label for="branch_code">Branch Code <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_code" name="branch_code" required>
</div>
</div>
<!-- Address Lines -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="address1">Address Line 1 <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="address1" name="address1" required>
</div>
<div class="form-group col-md-6">
<label for="address2">Address Line 2</label>
<input type="text" class="form-control" id="address2" name="address2">
</div>
</div>
<!-- State & District -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="state">State <span class="text-danger">*</span></label>
<select class="form-control" id="state" name="state" required>
<option value="">Select State</option>
<?php foreach($state as $value) { ?>
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-6">
<label for="district">District <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="district" name="district" required>
</div>
</div>
<!-- City & Pincode -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="branch_city">City <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city" name="city" required>
</div>
<div class="form-group col-md-6">
<label for="pincode">Pincode <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="pincode" name="pincode" required>
</div>
</div>
<!-- Submit / Cancel -->
<div class="form-row">
<!-- <div class="form-group col-md-12 mt-2"> -->
<div class="mt-2">
<button type="submit" class="btn app-btn-secondary mr-2" id="btnSubmit">Submit</button>
<button type="button" class="btn app-btn-outline-secondary btnBack" id="btnBack" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<!-- </div> -->
</div>
</div>
<!-- Right Section: Contact Details -->
<div class="col-md-4" style="background:#f8f9fa; max-height: calc(80vh - 50px); overflow-y:auto; border-radius:8px; padding:10px;">
<!-- First Contact -->
<div id="contact_1_wrapper" class="bg-white p-2 mb-2 rounded contact-block">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="modal-subtitle mb-0">Contact 1</h6>
<div class="d-flex align-items-center">
<i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="contact_1_remove"></i>
</div>
</div>
<!-- Contact Form Fields -->
<input type="hidden" name="primarykey[]" id="contact_id_1" value=""/>
<div class="form-group mb-2">
<label for="name">Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
</div>
<div class="form-group mb-2">
<label for="designation">Designation <span class="text-danger">*</span></label>
<input type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
</div>
<div class="form-group mb-2">
<label for="email">Email <span class="text-danger">*</span></label>
<input type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" required>
</div>
<div class="form-group mb-2">
<label for="mobile">Mobile <span class="text-danger">*</span></label>
<input type="tel" class="form-control" placeholder="Enter Contact Mobile" pattern="[0-9]{10}" name="mobile[]" id="mobile" required>
</div>
</div>
<!-- Container for dynamically added contacts -->
<div id="container"></div>
<div>
<button type="button" class="btn btn-primary btn-sm ac me-3" style="width: 100%;" onclick="appendContactHtml()" id="add"><i class="mdi mdi-plus"></i> Add Contact</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
@ -140,23 +302,29 @@ var contactCount = 1;
$(document).ready(function () {
$('#tpa-branch-datatable').DataTable({
paging: true ,
searching: true
});
var tpa_Branch_PrimaryKey = $('#tpa_id_branch').val();
var tpa_branch_form_action = '';
$('#add_branch').hide();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.hide();
// $('#add_branch').hide();
$('.btnBack').hide();
loadBranchList();
$('#btnBranchAdd').click(function(){
tpa_branch_form_action = '<?= base_url("master/tpa/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.show();
// $('#add_branch').show();
// $('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
// $('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
@ -196,10 +364,12 @@ $(document).ready(function () {
$('.btnBack').click(function(){
$('#add_branch').hide();
$('#branch_table').show();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.hide();
// $('#add_branch').hide();
// $('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
// $('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
@ -257,24 +427,34 @@ $(document).ready(function () {
console.log(res);
$('#tpa_branch_list tr').remove();
var tpaBranchTableInsert = ''
$.each(res.data, function(index, item) {
if (data.length === 0) {
tpaBranchTableInsert += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeTPABranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
<td colspan="3" class="text-center app-text-black">No data available in table</td>
</tr>
`;
});
`;
} else {
$.each(res.data, function(index, item) {
tpaBranchTableInsert += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeTPABranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
</tr>
`;
});
}
$('#tpa_branch_list').append(tpaBranchTableInsert);
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.hide();
// $('#add_branch').hide();
// $('#branch_table').show();
// $('.btnBack').hide();
// $('#btnBranchAdd').show();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
@ -307,10 +487,12 @@ $(document).ready(function () {
}, 1000);
console.log("tpa.............");
console.log(res)
$('#add_branch').show();
$('#branch_table').hide();
var myModal = new bootstrap.Modal(document.getElementById('branchModal'));
myModal.show();
// $('#add_branch').show();
// $('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
// $('#btnBranchAdd').hide();
$('#branch_name').val(res.tpabranch.branch_name);
$('#branch_code').val(res.tpabranch.branch_code);
$('#state option[value="' + res.tpabranch.state + '"]').prop('selected', true);
@ -367,18 +549,26 @@ $(document).ready(function () {
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
var branchTable = '';
$.each(response.tpa_branch, function(index, item) {
if (data.length === 0) {
branchTable += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeTPABranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
<td colspan="3" class="text-center app-text-black ">No data available in table</td>
</tr>
`;
});
`;
} else {
$.each(response.tpa_branch, function(index, item) {
branchTable += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td>
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeTPABranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
</td>
</tr>
`;
});
}
$('#tpa_branch_list').html(branchTable);
},
error: function(xhr, status, error) {
@ -399,75 +589,163 @@ $(document).ready(function () {
function appendContactHtml(contact = false, reset = false) {
// function appendContactHtml(contact = false, reset = false) {
console.log('appendContactHtml function called ')
contactCount++;
// console.log('appendContactHtml function called ')
// contactCount++;
// var container = document.getElementById('container');
// var uniqueId = Date.now().toString();
// var html = `
// <div id="${uniqueId}">
// <hr>
// <h6 class="header-title">Contact ${contactCount}</h6>
// <br>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
// <input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
// </div>
// </div>
// <div class="form-row">
// <div class="form-group col-md-12">
// <label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
// <input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
// </div>
// </div>
// <div class="form-group" style="display: flex;">
// <button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
// </div>
// </div>
// `;
// if(reset == false){
// console.log(reset)
// container.insertAdjacentHTML('beforeend', html);
// storeButtonId(uniqueId + '_add');
// if (contactCount >= 3) {
// hideStoredAddButtons();
// }
// }
// }
function renumberContacts() {
var contacts = document.querySelectorAll('.contact-block');
contacts.forEach(function(contact, index) {
let title = contact.querySelector('.modal-subtitle');
if (title) {
title.textContent = "Contact " + (index + 1); // auto numbering
}
});
contactCount = contacts.length; // keep global in sync
}
function appendContactHtml(contact = false, reset = false) {
console.log('appendContactHtml function called ');
var container = document.getElementById('container');
var uniqueId = Date.now().toString();
var html = `
<div id="${uniqueId}">
<hr>
<h6 class="header-title">Contact ${contactCount}</h6>
<br>
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
</div>
</div>
<div class="form-group" style="display: flex;">
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
<div id="${uniqueId}" class="bg-white p-2 mb-2 rounded contact-block">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="modal-subtitle mb-0"></h6>
<div class="d-flex align-items-center">
<i class="mdi mdi-trash-can text-danger" style="cursor:pointer; font-size:24px !important;" onclick="removeContact(this)" id="${uniqueId}_remove"></i>
</div>
</div>
<div class="form-row">
<input type="hidden" name="primarykey[]" value="${contact ? contact.id : ''}"/>
<div class="form-group col-md-12">
<label>Name<span class="text-danger">*</span></label>
<input value="${contact ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Email<span class="text-danger">*</span></label>
<input value="${contact ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Mobile<span class="text-danger">*</span></label>
<input value="${contact ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" pattern="[0-9]{10}" name="mobile[]" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Designation<span class="text-danger">*</span></label>
<input value="${contact ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" required>
</div>
</div>
</div>
`;
if(reset == false){
console.log(reset)
if(!reset){
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
if (contactCount >= 3) {
hideStoredAddButtons();
}
renumberContacts(); // ✅ fix numbering
toggleAddButton();
}
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount --;
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
if (addButton) {
addButton.style.display = 'block';
}
}
renumberContacts(); // ✅ renumber after removal
toggleAddButton();
}
}
function toggleAddButton() {
var totalContacts = document.querySelectorAll('.contact-block, #contact_1_wrapper').length;
var addButton = document.querySelector('.ac');
if (totalContacts >= 3) {
addButton.style.display = 'none';
} else {
addButton.style.display = 'block';
}
}
// function removeContact(button) {
// var uniqueId = button.id.split("_")[0];
// var contactSection = document.getElementById(uniqueId);
// if (contactSection) {
// contactSection.parentNode.removeChild(contactSection);
// contactCount --;
// if (contactCount < 3) {
// var addButton = document.querySelector('.ac');
// if (addButton) {
// addButton.style.display = 'block';
// }
// }
// }
// }
function storeButtonId(id) {
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];

View File

@ -43,10 +43,10 @@
<div class="row" id="tpa_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">TPA List</h4>
<h4 style="position: relative;">TPA</h4>
</div>
</div>
<table data-custom-table-css="table" class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"

View File

@ -35,17 +35,24 @@ body {
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="d-flex align-items-center" style="gap: 8px;">
<span onclick="history.back()" style="cursor: pointer;">
<i class="mdi mdi-chevron-left" style="font-size: 43px;"></i>
</span>
<span class="title-text ">TPA</span>
</h4>
<!-- <div class="col-6" style="align-self: center;">
<h4 style="position: relative;">TPA</h4>
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/tpa/list"); ?>"><i class="mdi mdi-arrow-left" style="font-size: 17px;"></i> </a>
</div>
</div> -->
</div>
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active">
class="nav-link px-3 py-2 active-tab active">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">General</span>
</a>

View File

@ -65,10 +65,10 @@ table.dataTable tbody td {
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card-body maincard">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Vehicle Master List</h4>
<h4 style="position: relative;">Vehicle Master</h4>
</div>
</div>
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
@ -218,8 +218,8 @@ table.dataTable tbody td {
</div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
<button class="btn app-btn-outline-secondary app-btn-border-radius mr-2 close" type="button" id="close_btn" data-dismiss="modal" aria-label="Close" aria-hidden="true">Cancel</button>
<button type="submit" id="btnSubmit" class="btn app-btn-secondary app-btn-border-radius waves-effect waves-light" id="cd_master_btn_Submit">Submit</button>
<button class="btn app-btn-outline-secondary mr-2 colse" type="button" id="close_btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" id="btnSubmit" class="btn app-btn-secondary waves-effect waves-light" id="cd_master_btn_Submit">Submit</button>
</div>
</form>
</div>