CHANGE_ADD_DELETE_BUTTON_DOC_NOT_SHARED_ADD_NEW_IN_HISTROY : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-17 16:14:36 +05:30
parent ffaa98cb00
commit ebb6e7840c
7 changed files with 269 additions and 154 deletions

View File

@ -76,6 +76,7 @@ use CodeIgniter\Router\RouteCollection;
$routes->get('client_docs_histroy/(:any)','MasterController::client_docs_histroy/$1'); $routes->get('client_docs_histroy/(:any)','MasterController::client_docs_histroy/$1');
$routes->match(['get','post'],'/change_doc_status','MasterController::change_doc_status'); $routes->match(['get','post'],'/change_doc_status','MasterController::change_doc_status');
$routes->match(['get','post'],'/rememeber_notification','MasterController::rememeber_notification'); $routes->match(['get','post'],'/rememeber_notification','MasterController::rememeber_notification');
$routes->match(['get','post'],'/delete_doc','MasterController::delete_doc');
$routes->match(['get','post'],'/test','MasterController::test'); $routes->match(['get','post'],'/test','MasterController::test');
$routes->post('doc_generate_otp','MasterController::doc_generate_otp'); $routes->post('doc_generate_otp','MasterController::doc_generate_otp');
$routes->post('doc_verify_otp','MasterController::doc_verify_otp'); $routes->post('doc_verify_otp','MasterController::doc_verify_otp');

View File

@ -176,8 +176,9 @@ class BusinessController extends BaseController
$mail_config = $this->request->getPost(); $mail_config = $this->request->getPost();
$r_mail = $this->request->getPost('r_email'); $r_mail = $this->request->getPost('r_email');
$MailHelper = new MailHelper(); $MailHelper = new MailHelper();
print_r($MailHelper->check_mail_config($r_mail, $mail_config));die; $mail_check_status = $MailHelper->check_mail_config($r_mail, $mail_config);
return $mail_check_status;
} catch (\Exception $exception) { } catch (\Exception $exception) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500); return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
} }

View File

@ -571,6 +571,8 @@ class MasterController extends BaseController
$placeHolder = '%'.$key.'%'; $placeHolder = '%'.$key.'%';
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']); $data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
} }
$data['business_list'] = $this->BusinessModel->findAll();
echo view('layout/header', ['Data'=>$userData]); echo view('layout/header', ['Data'=>$userData]);
echo view('client_docs_preview',$data); echo view('client_docs_preview',$data);
echo view('layout/footer'); echo view('layout/footer');
@ -662,6 +664,7 @@ class MasterController extends BaseController
{ {
// try { // try {
$client_mail_id = '';
$doc_id = $this->request->getPost('doc_id'); $doc_id = $this->request->getPost('doc_id');
$is_active = $this->request->getPost('is_active'); $is_active = $this->request->getPost('is_active');
$data['is_active'] = $is_active; $data['is_active'] = $is_active;
@ -675,7 +678,7 @@ class MasterController extends BaseController
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left') ->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left') ->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow(); ->where('client_docs.id', $doc_id)->get()->getRow();
$client_mail_id = $clientData->email;
if($clientData->individual == 1){ if($clientData->individual == 1){
$clientData = $this->ClientDocsModel->select('client.name as client_name, client.*, client_branch.sms, client_branch.whatsapp') $clientData = $this->ClientDocsModel->select('client.name as client_name, client.*, client_branch.sms, client_branch.whatsapp')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left') ->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
@ -699,6 +702,8 @@ class MasterController extends BaseController
$message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.<br><br>" . $url; $message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.<br><br>" . $url;
// print_r($clientData->email);die; // print_r($clientData->email);die;
$mail_config = [ $mail_config = [
'protocol' => 'smtp',
'mailType' => 'html',
'SMTPHost' => $businessData->smtp_host, 'SMTPHost' => $businessData->smtp_host,
'SMTPUser' => $businessData->smtp_user, 'SMTPUser' => $businessData->smtp_user,
'SMTPPass' => $businessData->smtp_pass, 'SMTPPass' => $businessData->smtp_pass,
@ -706,7 +711,7 @@ class MasterController extends BaseController
'sender_email' => $businessData->business_mail, 'sender_email' => $businessData->business_mail,
'sender_name' => $businessData->business_name 'sender_name' => $businessData->business_name
]; ];
$MailHelper->send_url_email($clientData->email , '', $subject, $message, $mail_config); $mail_status = $MailHelper->send_url_email($clientData->email , '', $subject, $message, $mail_config);
$notificationHelper = new NotificationHelper(); $notificationHelper = new NotificationHelper();
$number ='91'. $clientData->mobile_no; // Replace with dynamic recipient number $number ='91'. $clientData->mobile_no; // Replace with dynamic recipient number
if($clientData->whatsapp == 1){ if($clientData->whatsapp == 1){
@ -719,6 +724,15 @@ class MasterController extends BaseController
$statusData['created_by'] = $this->session->get('is_staff_logged_in'); $statusData['created_by'] = $this->session->get('is_staff_logged_in');
$statusData['status'] = 'Shared'; $statusData['status'] = 'Shared';
$this->DocsStatusModel->insert($statusData); $this->DocsStatusModel->insert($statusData);
$statusData['note'] = $clientData->email;
if($mail_status['status'] == 'success'){
$statusData['status'] = 'Mail Success';
$this->DocsStatusModel->insert($statusData);
}else{
$statusData['status'] = 'Mail Failed';
$this->DocsStatusModel->insert($statusData);
}
}else{ }else{
$statusData['client_docs_id'] = $doc_id; $statusData['client_docs_id'] = $doc_id;
$statusData['is_staff'] = 1; $statusData['is_staff'] = 1;
@ -729,7 +743,11 @@ class MasterController extends BaseController
$updated = $this->ClientDocsModel->update($doc_id, $data); $updated = $this->ClientDocsModel->update($doc_id, $data);
if ($updated) { if ($updated) {
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => true],200); if($is_active == 1){
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => "Document Shared with Email - ". $client_mail_id],200);
}else{
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => "Document Reverted "],200);
}
} else { } else {
$result = "No Match's"; $result = "No Match's";
return $this->response->setJSON(['status' => 'failed','code' => 404,'data' => $result],404); return $this->response->setJSON(['status' => 'failed','code' => 404,'data' => $result],404);
@ -765,11 +783,12 @@ class MasterController extends BaseController
// ->where('business.business_id',$this->session->get('logged_in_staff_business_id')) // ->where('business.business_id',$this->session->get('logged_in_staff_business_id'))
->where('business_id', $clientData->business_id) ->where('business_id', $clientData->business_id)
->get()->getRow(); ->get()->getRow();
// print_r($businessData);die;
$subject = 'BB-Sign Verify Document'; $subject = 'BB-Sign Verify Document';
$message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.<br><br>" . $url; $message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.<br><br>" . $url;
$mail_config = [ $mail_config = [
'protocol' => 'smtp',
'mailType' => 'html',
'SMTPHost' => $businessData->smtp_host, 'SMTPHost' => $businessData->smtp_host,
'SMTPUser' => $businessData->smtp_user, 'SMTPUser' => $businessData->smtp_user,
'SMTPPass' => $businessData->smtp_pass, 'SMTPPass' => $businessData->smtp_pass,
@ -795,6 +814,22 @@ class MasterController extends BaseController
} }
} }
public function delete_doc()
{
try {
$doc_id = $this->request->getPost('doc_id');
$delete_doc = $this->ClientDocsModel->where('id', $doc_id)->delete();
$delete_history = $this->DocsStatusModel->where('client_docs_id', $doc_id)->delete();
return $this->respond(['success' => true, 'data' => 'Doc Deleted SuccessFully']);
} catch (\Exception $exception) {
return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
}
}
public function doc_generate_otp() public function doc_generate_otp()
{ {
try { try {

View File

@ -15,14 +15,14 @@ class MailHelper
try { try {
$email = \Config\Services::email(); $email = \Config\Services::email();
$email->initialize([ // $email->initialize([
'protocol' => $config['protocol'], // 'protocol' => $config['protocol'],
'SMTPHost' => $config['SMTPHost'], // 'SMTPHost' => $config['SMTPHost'],
'SMTPUser' => $config['SMTPUser'], // 'SMTPUser' => $config['SMTPUser'],
'SMTPPass' => $config['SMTPPass'], // 'SMTPPass' => $config['SMTPPass'],
'SMTPPort' => $config['SMTPPort'], // 'SMTPPort' => $config['SMTPPort'],
// 'mailType' => $config['mailType'] // // 'mailType' => $config['mailType']
]); // ]);
// $email->setFrom($config['sender_email'], $config['sender_name']);/ // $email->setFrom($config['sender_email'], $config['sender_name']);/
$email->setMailType('html'); $email->setMailType('html');
@ -50,36 +50,22 @@ class MailHelper
public static function send_url_email($email_id, $branch_email, $subject, $message, $mail_config = []) public static function send_url_email($email_id, $branch_email, $subject, $message, $mail_config = [])
{ {
// print_r("helllo");die;
// try { // try {
$default_config = [
'protocol' => 'smtp',
'SMTPHost' => 'mail.venbait.in',
'SMTPUser' => 'bbone@venbait.in',
'SMTPPass' => 'xk!L(N_-R#};',
'SMTPPort' => 465,
'mailType' => 'html',
'sender_email' => 'bbone@venbait.in',
'sender_name' => 'BB-Sign'
];
// Merge default config with provided config // Merge default config with provided config
$config = array_merge($default_config, $mail_config);
$email = \Config\Services::email(); $email = \Config\Services::email();
$email->initialize([ $email->initialize([
'protocol' => $config['protocol'], 'protocol' => $mail_config['protocol'],
'SMTPHost' => $config['SMTPHost'], 'SMTPHost' => $mail_config['SMTPHost'],
'SMTPUser' => $config['SMTPUser'], 'SMTPUser' => $mail_config['SMTPUser'],
'SMTPPass' => $config['SMTPPass'], 'SMTPPass' => $mail_config['SMTPPass'],
'SMTPPort' => (int)$config['SMTPPort'], 'SMTPPort' => (int)$mail_config['SMTPPort'],
'mailType' => $config['mailType'] 'mailType' => $mail_config['mailType']
]); ]);
$email->setFrom($config['sender_email'], $config['sender_name']); $email->setFrom($mail_config['sender_email'], $mail_config['sender_name']);
$email->setTo($email_id); $email->setTo($email_id);
$email->setSubject($subject); $email->setSubject($subject);
$email->setMessage($message); $email->setMessage($message);
@ -99,31 +85,24 @@ class MailHelper
public static function check_mail_config($r_email, $mail_config = []) public static function check_mail_config($r_email, $mail_config = [])
{ {
$default_config = [ if (empty($mail_config['protocol']) || empty($mail_config['SMTPHost']) ||
'protocol' => 'smtp', empty($mail_config['SMTPUser']) || empty($mail_config['SMTPPass']) ||
'SMTPHost' => 'mail.venbait.in', empty($mail_config['SMTPPort']) || empty($mail_config['mailType']) ||
'SMTPUser' => 'bbone@venbait.in', empty($mail_config['sender_email']) ) {
'SMTPPass' => 'xk!L(N_-R#};', return json_encode(['status' => 'failed', 'code' => 400, 'message' => 'Incomplete Mail Configuration', 'data' => $r_email]);
'SMTPPort' => 465, }
'mailType' => 'html',
'sender_email' => 'bbone@venbait.in',
'sender_name' => 'BB-Sign'
];
// Merge default config with provided config
$config = array_merge($default_config, $mail_config);
$email = \Config\Services::email(); $email = \Config\Services::email();
$email->initialize([ $email->initialize([
'protocol' => $config['protocol'], 'protocol' => $mail_config['protocol'],
'SMTPHost' => $config['SMTPHost'], 'SMTPHost' => $mail_config['SMTPHost'],
'SMTPUser' => $config['SMTPUser'], 'SMTPUser' => $mail_config['SMTPUser'],
'SMTPPass' => $config['SMTPPass'], 'SMTPPass' => $mail_config['SMTPPass'],
'SMTPPort' => (int)$config['SMTPPort'], 'SMTPPort' => (int)$mail_config['SMTPPort'],
'mailType' => $config['mailType'] 'mailType' => $mail_config['mailType']
]); ]);
$email->setFrom($config['sender_email'], "Sender Name"); $email->setFrom($mail_config['sender_email'], '');
$email->setTo($r_email); $email->setTo($r_email);
$email->setSubject("Test Mail Configuration"); $email->setSubject("Test Mail Configuration");
$email->setMessage("Test Mail Configuration"); $email->setMessage("Test Mail Configuration");
@ -132,10 +111,11 @@ class MailHelper
return json_encode(['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $r_email]); return json_encode(['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $r_email]);
} else { } else {
log_message('error', 'Email sending failed: ' . $email->printDebugger(['headers'])); log_message('error', 'Email sending failed: ' . $email->printDebugger(['headers']));
return ['status' => 'failed', 'code' => 404, 'message' => 'Email Sent Failed...', 'data' => $r_email]; return json_encode(['status' => 'failed', 'code' => 404, 'message' => 'Email Sent Failed...', 'data' => $r_email]);
} }
} }
} }
?> ?>

View File

@ -57,9 +57,12 @@
<h5 class="mb-3 text-uppercase bg-light p-2 client_notification_area"><i class="fas fa-envelope mr-1"></i> Mail Settings</h5> <h5 class="mb-3 text-uppercase bg-light p-2 client_notification_area"><i class="fas fa-envelope mr-1"></i> Mail Settings</h5>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="subject-input">Email</label> <label for="subject-input">Sender Email</label>
<input type="mail" id="email" class="form-control" value="<?= isset($business['email']) ? $business['email'] : '' ?>"> <input type="mail" id="email" class="form-control" value="<?= isset($business['email']) ? $business['email'] : '' ?>">
</div> </div>
<div class="form-group col-md-6">
</div>
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="subject-input">User Name</label> <label for="subject-input">User Name</label>
<input type="text" id="user_name" class="form-control" value="<?= isset($business['smtp_user']) ? $business['smtp_user'] : '' ?>"> <input type="text" id="user_name" class="form-control" value="<?= isset($business['smtp_user']) ? $business['smtp_user'] : '' ?>">
@ -78,12 +81,18 @@
</div> </div>
</div> </div>
<?php if(!isset($business['business_id'])){ ?> <?php if(!isset($business['business_id'])){ ?>
<h5 class="mb-3 text-uppercase bg-light p-2 client_notification_area"><i class="fas fa-bell mr-1"></i>Test Mail</h5> <h5 class="mb-3 text-uppercase bg-light p-2 client_notification_area"><i class="fas fa-envelope-open-text mr-1"></i>Test Mail</h5>
<div class="form-row" id="test_mail_config_div"> <div class="form-row" id="test_mail_config_div">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="">Test Config Mail</label> <label for="">Enter Your Mail-Id</label>
<input type="mail" class="form-control" id="r_email"> <input type="mail" class="form-control" id="r_email">
</div> </div>
<div class="form-group col-md-6">
<label for=""></label>
<button class="btn btn-primary" id="test-email-btn" type="button" style="margin-top: 29px;">Test Email</button>
<img src="<?= base_url()."public"; ?>/assets/images/submit-spin.svg" width="29px" height="29px" class="ml-2" id="submit-spin" style="display:none; margin-top: 2.1rem !important;"></img>
</div>
<?php }else{ ?> <?php }else{ ?>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
@ -97,11 +106,10 @@
<input type="hidden" id="business_id" name="business_id" value="<?= isset($business['business_id']) ? $business['business_id'] : '' ?>"> <input type="hidden" id="business_id" name="business_id" value="<?= isset($business['business_id']) ? $business['business_id'] : '' ?>">
<input type="hidden" id="header_html" value='<?= isset($business['business_id']) ? $business['header_html'] : '' ?>'> <input type="hidden" id="header_html" value='<?= isset($business['business_id']) ? $business['header_html'] : '' ?>'>
<input type="hidden" id="footer_html" value='<?= isset($business['business_id']) ? $business['footer_html'] : '' ?>'> <input type="hidden" id="footer_html" value='<?= isset($business['business_id']) ? $business['footer_html'] : '' ?>'>
<?php if(isset($business['business_id'])){?> <?php if(isset($business['business_id']) > 0){ ?>
<button type="submit" id="savedata" class="btn btn-primary">Submit</button> <button type="submit" id="savedata" class="btn btn-primary" style="float: right;">Submit</button>
<?php }else{ ?> <?php }else{ ?>
<button class="btn btn-primary" id="test-email-btn" type="button">Test Email</button> <button type="submit" id="savedata" class="btn btn-primary" style="float: right;" disabled>Submit</button>
<button type="submit" id="savedata" class="btn btn-primary" style="display:none;">Submit</button>
<?php } ?> <?php } ?>
</div> </div>
@ -168,13 +176,18 @@ $(document).ready(function() {
$("#test-email-btn").on("click", function() $("#test-email-btn").on("click", function()
{ {
$('#submit-spin').show();
$(this).hide();
formData ={ formData ={
sender_email : $('#email').val(), sender_email : $('#email').val(),
r_email : $('#r_email').val(), r_email : $('#r_email').val(),
smtp_host : $('#host').val(), SMTPHost : $('#host').val(),
smtp_user : $('#user_name').val(), SMTPUser : $('#user_name').val(),
smtp_pass : $('#password').val(), SMTPPass : $('#password').val(),
smtp_port : $('#port').val(), SMTPPort : $('#port').val(),
mailType : 'html',
protocol : 'smtp',
}; };
// console.log(formData); // console.log(formData);
$.ajax({ $.ajax({
@ -183,16 +196,16 @@ $(document).ready(function() {
data: formData, data: formData,
json: true, json: true,
success: function(response) { success: function(response) {
console.log(response);
console.log(JSON.parse(response));
if(JSON.parse(response).status == 'success'){ if(JSON.parse(response).status == 'success'){
$('#savedata').css('display',''); $('#savedata').prop('disabled', false);
$('#test-email-btn').css('display','none'); toastr.success('Mail Send successfully ', 'Success');
toastr.success('Data saved successfully ', 'Success');
// window.location.href = '<?= base_url()."business_list"; ?>'; // window.location.href = '<?= base_url()."business_list"; ?>';
}else{ }else{
toastr.warning('Something went wrong', 'Warning'); $('#savedata').prop('disabled', true);
toastr.warning('Please Check Mail Configuration', 'Warning');
} }
}, },
@ -201,10 +214,44 @@ $(document).ready(function() {
console.error(xhr.responseText); console.error(xhr.responseText);
} }
}); });
setTimeout(() => {
$('#submit-spin').hide();
$(this).show();
}, 2000);
}) })
$("#savedata").on("click", function() $("#savedata").on("click", function()
{ {
var isValid = true;
var firstEmptyField = null;
// Find all elements with 'required' attribute
$('form [required]').each(function() {
var field = $(this);
// Check if the field is empty
if (field.val().trim() === '') {
isValid = false;
if (!firstEmptyField) {
firstEmptyField = field;
}
// Highlight the empty field
field.addClass('error');
} else {
// Remove error class if the field is not empty
field.removeClass('error');
}
});
if (!isValid) {
// Focus on the first empty field and show an error message
toastr.warning('Please fill in all required fields.', 'Warning');
firstEmptyField.focus();
return; // Prevent the AJAX call
}
var headerContent = $('#summernote-header').summernote('code'); var headerContent = $('#summernote-header').summernote('code');
var footerContent = $('#summernote-footer').summernote('code'); var footerContent = $('#summernote-footer').summernote('code');

View File

@ -173,9 +173,21 @@
</style> </style>
</head> </head>
<script>
$(window).on('load', function() {
// setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
// }, 500);
});
</script>
<body class="loading" data-layout-mode="horizontal" data-layout='{"mode": "light", "width": "fluid", "menuPosition": "fixed", "topbar": {"color": "dark"}, "showRightSidebarOnPageLoad": true}'> <body class="loading" data-layout-mode="horizontal" data-layout='{"mode": "light", "width": "fluid", "menuPosition": "fixed", "topbar": {"color": "dark"}, "showRightSidebarOnPageLoad": true}'>
<!-- <div class="loader-mask">
<div class="loader">
<img src="<?= base_url() . "public" ?>/assets/images/submit-spin.svg" height="40" width="40" alt="Loading...">
</div>
</div> -->
<!-- Begin page --> <!-- Begin page -->
<div id="wrapper"> <div id="wrapper">

View File

@ -133,7 +133,7 @@
</a> </a>
<?php } ?> <?php } ?>
<a id="doc_history_button" data-id="<?php echo $value['id']; ?>" class="dropdown-item" data-toggle="modal" data-target="#bike_make_login-modal" data-title="Share"> <a id="doc_history_button" data-id="<?php echo $value['id']; ?>" class="dropdown-item" data-toggle="modal" data-target="#bike_make_login-modal" data-title="History">
<i class="mdi mdi-history" style="margin-right: 16px !important;"></i>History <i class="mdi mdi-history" style="margin-right: 16px !important;"></i>History
</a> </a>
@ -146,7 +146,11 @@
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Remember" onclick="rememberNotification(this)"> <a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Remember" onclick="rememberNotification(this)">
<i class="mdi mdi-email-send" style="margin-right: 16px !important; margin-left: 5px;"></i>Reminder <i class="mdi mdi-email-send" style="margin-right: 16px !important; margin-left: 5px;"></i>Reminder
</a> </a>
<?php } ?>
<?php if($value['is_active'] == 0 ) { ?>
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" title="Delete" onclick="DeleteDoc(this)">
<i class="mdi mdi-delete" style="margin-right: 16px !important; margin-left: 5px;"></i>Delete
</a>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
@ -593,6 +597,8 @@
if(status == 1){ if(status == 1){
var is_active= 0; var is_active= 0;
}else{ }else{
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var is_active= 1; var is_active= 1;
} }
@ -606,8 +612,13 @@
data: formData, data: formData,
dataType: 'json', dataType: 'json',
success: function(response) { success: function(response) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, 1000);
console.log(response); console.log(response);
if (response.data) { if (response.data) {
toastr.success(response.data, 'Success');
window.location.reload(); window.location.reload();
} }
}, },
@ -646,6 +657,31 @@
} }
function DeleteDoc(params) {
var doc_id = params.getAttribute('data-id');
var formData = {
doc_id: doc_id,
};
$.ajax({
type: 'POST',
url: '<?php echo base_url()."delete_doc"?>',
data: formData,
dataType: 'json',
success: function(response) {
console.log(response);
if (response.data) {
window.location.reload();
}
},
error: function(xhr, status, error) {
// Handle error response here
console.error(xhr.responseText);
}
});
}
</script> </script>
@ -680,6 +716,9 @@
}else if(item.status == "Rejected"){ }else if(item.status == "Rejected"){
reason_or_ip = ' - Reason('; reason_or_ip = ' - Reason(';
reason_or_ip_end = ')'; reason_or_ip_end = ')';
}else if(item.status == "Mail Success" || item.status == "Mail Failed"){
reason_or_ip = ' - Email-Id(';
reason_or_ip_end = ')';
}else{ }else{
reason_or_ip = ''; reason_or_ip = '';
reason_or_ip_end = ''; reason_or_ip_end = '';