CHANGE_ internal test , mail template , client feedback : GWM

This commit is contained in:
bitbucket 2024-07-18 14:42:14 +05:30
parent 466975dbce
commit 0a14de4d73
10 changed files with 372 additions and 134 deletions

View File

@ -76,6 +76,7 @@ use CodeIgniter\Router\RouteCollection;
$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'],'/rememeber_notification','MasterController::rememeber_notification');
$routes->match(['get','post'],'/createSharedLink','MasterController::createSharedLink');
$routes->match(['get','post'],'/delete_doc','MasterController::delete_doc');
$routes->match(['get','post'],'/test','MasterController::test');
$routes->post('doc_generate_otp','MasterController::doc_generate_otp');

View File

@ -262,7 +262,7 @@ class ClientController extends BaseController
public function client_branch_list()
{
// if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
$data['clientBranchList'] = $this->ClientBranchModel->select('client_branch.*, client.name as client_name, client.mobile_no as client_mobile_no')
$data['clientBranchList'] = $this->ClientBranchModel->select('client_branch.*, client.name as client_name, client.mobile_no as client_mobile_no,client.email as client_email')
->join('client', 'client.client_id = client_branch.client_id', 'left')
->findAll();

View File

@ -529,14 +529,14 @@ class MasterController extends BaseController
}else if($this->session->has('is_client_logged_in')){
$userData = $this->ClientBranchModel->where('id',$this->session->get('is_client_logged_in'))->get()->getRow();
}
// dd();
$doc_id = $this->request->getVar('doc_id');
if(!empty($this->request->getVar('view_from')) && $this->request->getVar('view_from') == 'client'){
$data['docData'] = $this->ClientDocsModel->clientDocPreview($doc_id);
}else{
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
}
// dd($data['docData']);
$data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no ,
client_branch.gst_no , client_branch.mobile_no ,
client_branch.email , client_branch.address ,
@ -546,13 +546,15 @@ class MasterController extends BaseController
->where('client_branch.id',$data['docData']->client_branch_id)
->get()->getRow();
if($data['clientData']->individual == 1){
$data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no ,
client.mobile_no ,
client.email , client.individual')
$clientData = $this->ClientBranchModel->select('client.email , client.mobile_no')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_branch.id',$data['docData']->client_branch_id)
->get()->getRow();
$data['clientData']->email = $clientData->email;
$data['clientData']->mobile_no = $clientData->mobile_no;
}
$data['header_html'] = $data['docData']->header_html;
$data['footer_html'] = $data['docData']->footer_html;
$data['body_html'] = $data['docData']->body_html;
@ -663,76 +665,89 @@ class MasterController extends BaseController
public function change_doc_status()
{
// try {
$client_mail_id = '';
try {
$doc_id = $this->request->getPost('doc_id');
$is_active = $this->request->getPost('is_active');
$data['is_active'] = $is_active;
$MailHelper = new MailHelper();
$notificationHelper = new NotificationHelper();
if($is_active == 1){
$DateAndYears = $this->dateAndYearPlaceholder();
$data['place_holder_object'] = $DateAndYears;
$MailHelper = new MailHelper();
$clientData = $this->ClientDocsModel->select('client.name as client_name, client_branch.email, client_branch.*')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
$client_mail_id = $clientData->email;
if($clientData->individual == 1){
$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', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
}
$documentUrl = base_url();
// helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=> md5((string)$doc_id)], 259200) . '">Preview and Approve Document</a>';
// $businessData = $this->BranchModel->select('branches.* , business.business_name ')
// ->join('business', 'branches.business_id = business.business_id', 'left')
// ->where('branches.branch_id',$this->session->get('logged_in_staff_branch_id'))
// ->get()->getRow();
$businessData = $this->BusinessModel->select('branches.* , business.business_name ,business.smtp_host, business.smtp_user, business.smtp_pass, business.smtp_port, business.email as business_mail')
//get Client Data
$clientData = $this->ClientDocsModel->select('client.name as client_name,
client.email as client_email,
client_branch.email as client_branch_email,
client.mobile_no as client_mobile_no,
client_branch.mobile_no as client_branch_mobile_no,
client.individual as individual,
client_branch.whatsapp as whatsapp,
client_branch.sms as sms,')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
if($clientData->individual == 1){
$client_mail_id = $clientData->client_email;
$client_mobile_no = $clientData->client_mobile_no;
}else{
$client_mail_id = $clientData->client_branch_email;
$client_mobile_no = $clientData->client_branch_mobile_no;
}
//get Business and mail confic data
$businessData = $this->BusinessModel->select('branches.* , business.business_name ,business.smtp_host, business.smtp_user, business.smtp_pass, business.smtp_port, business.email as business_mail')
->join('branches', 'business.business_id = branches.business_id', 'left')
->where('business.business_id',$this->session->get('logged_in_staff_business_id'))
->get()->getRow();
$subject = 'BB-Sign Verify Document';
// print_r($businessData);die;
$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;
$mail_config = [
'protocol' => 'smtp',
'mailType' => 'html',
'SMTPHost' => $businessData->smtp_host,
'SMTPUser' => $businessData->smtp_user,
'SMTPPass' => $businessData->smtp_pass,
'SMTPPort' => $businessData->smtp_port,
'sender_email' => $businessData->business_mail,
'sender_name' => $businessData->business_name
];
$mail_status = $MailHelper->send_url_email($clientData->email , '', $subject, $message, $mail_config);
$notificationHelper = new NotificationHelper();
$number ='91'. $clientData->mobile_no; // Replace with dynamic recipient number
if($clientData->whatsapp == 1){
$whatsApp_message = "Dear " . substr($clientData->client_name, 0, 20) . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ;
// $notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
'protocol' => 'smtp',
'mailType' => 'html',
'SMTPHost' => $businessData->smtp_host,
'SMTPUser' => $businessData->smtp_user,
'SMTPPass' => $businessData->smtp_pass,
'SMTPPort' => $businessData->smtp_port,
'sender_email' => $businessData->business_mail,
'sender_name' => $businessData->business_name
];
// send mail
$subject = 'Verify Document';
$url = generate_signed_url('preview', ['doc_id'=> md5((string)$doc_id)], 259200);
$message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the button below to preview and approve.<br><br>";
$html = view('email_templates',['message'=>$message,'url'=>$url]);
$mail_status = $MailHelper->send_url_email($client_mail_id , '', $subject, $html, $mail_config);
//send whatsapp message
$number ='91'. $client_mobile_no;
if($clientData->whatsapp == 1){
$whatsApp_message = "Dear " . substr($clientData->client_name, 0, 20) . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ;
//$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
}
//create history data for documet sharing
$statusData['client_docs_id'] = $doc_id;
$statusData['is_staff'] = 1;
$statusData['created_by'] = $this->session->get('is_staff_logged_in');
$statusData['status'] = 'Shared';
$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);
}
//create history data for mail sending status
$statusData['note'] = $client_mail_id;
if($mail_status['status'] == 'success'){ $statusData['status'] = 'Mail Success';
}else{ $statusData['status'] = 'Mail Failed'; }
$this->DocsStatusModel->insert($statusData);
}else{
$statusData['client_docs_id'] = $doc_id;
$statusData['is_staff'] = 1;
@ -744,17 +759,17 @@ class MasterController extends BaseController
$updated = $this->ClientDocsModel->update($doc_id, $data);
if ($updated) {
if($is_active == 1){
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => "Document Shared with Email - ". $client_mail_id],200);
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => "Document Shared",'mail_status'=>$mail_status['status'],'mail'=>$client_mail_id ],200);
}else{
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => "Document Reverted "],200);
return $this->response->setJSON(['status' => 'success','code' => 200,'data' => "Document Reverted"],200);
}
} else {
$result = "No Match's";
return $this->response->setJSON(['status' => 'failed','code' => 404,'data' => $result],404);
}
// } catch (\Exception $exception) {
// return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
// }
} catch (\Exception $exception) {
return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
}
}
public function rememeber_notification()
@ -763,29 +778,33 @@ class MasterController extends BaseController
$doc_id = $this->request->getPost('doc_id');
$MailHelper = new MailHelper();
$clientData = $this->ClientDocsModel->select('client.name as client_name, client_branch.email, client_branch.mobile_no, client_branch.whatsapp, client.individual, client_docs.business_id')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
//get Client Data
$clientData = $this->ClientDocsModel->select('client.name as client_name,
client.email as client_email,
client_branch.email as client_branch_email,
client.mobile_no as client_mobile_no,
client_branch.mobile_no as client_branch_mobile_no,
client.individual as individual,
client_branch.whatsapp as whatsapp,
client_branch.sms as sms,
client_docs.business_id')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
if($clientData->individual == 1){
$clientData = $this->ClientDocsModel->select('client.name as client_name, client.email, client.mobile_no, client_branch.whatsapp, client.individual, client_docs.business_id')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
$client_mail_id = $clientData->client_email;
$client_mobile_no = $clientData->client_mobile_no;
}else{
$client_mail_id = $clientData->client_branch_email;
$client_mobile_no = $clientData->client_branch_mobile_no;
}
// helper('url');
$url ='<a href="' . generate_signed_url('preview', ['doc_id'=>md5((string)$doc_id)], 36000) . '">Preview and Approve Document</a>';
// $businessData = $this->BranchModel->select('branches.* , business.business_name ')
// ->join('business', 'branches.business_id = business.business_id', 'left')
// ->where('branches.branch_id',$this->session->get('logged_in_staff_branch_id'))
// ->get()->getRow();
//get Business and mail confic data
$businessData = $this->BusinessModel->select('business.*')
// ->where('business.business_id',$this->session->get('logged_in_staff_business_id'))
->where('business_id', $clientData->business_id)
->get()->getRow();
$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;
$mail_config = [
'protocol' => 'smtp',
'mailType' => 'html',
@ -796,24 +815,37 @@ class MasterController extends BaseController
'sender_email' => $businessData->email,
'sender_name' => $businessData->business_name
];
// print_r($mail_config);die;
// send mail
$subject = 'Verify Document';
$url = generate_signed_url('preview', ['doc_id'=> md5((string)$doc_id)], 259200);
$message = "Dear " . $clientData->client_name . ",<br>" . $businessData->business_name . " has requested your approval for a document. Please click the button below to preview and approve.<br><br>";
$html = view('email_templates',['message'=>$message,'url'=>$url]);
$mail_status = $MailHelper->send_url_email($client_mail_id , '', $subject, $html, $mail_config);
$mail_send = $MailHelper->send_url_email($clientData->email , '', $subject, $message, $mail_config);
if (!$mail_send) {
throw new \Exception('Email sending failed.');
}
$notificationHelper = new NotificationHelper();
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
//send whatsapp message
$number ='91'. $client_mobile_no;
if($clientData->whatsapp == 1){
$whatsApp_message = "Dear " . substr($clientData->client_name, 0, 20) . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ;
//$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
$whatsApp_message = "Dear " . substr($clientData->client_name, 0, 20) . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ;
//$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
}
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
return $this->response->setJSON(['status' => 'success','code' => 200,'mail_status'=>$mail_status['status'],'mail'=>$client_mail_id ],200);
} catch (\Exception $exception) {
return $this->response->setJSON(['status' => 'failed','code' => 500,'data' => $exception],500);
}
}
public function createSharedLink()
{
$doc_id = $this->request->getPost('doc_id');
$link = generate_signed_url('preview', ['doc_id'=> md5((string)$doc_id)], 259200);
return $this->response->setJSON(['status' => 'success','code' => 200,'link'=>$link ],200);
}
public function delete_doc()
{
try {
@ -834,12 +866,32 @@ class MasterController extends BaseController
{
try {
$mobile_no = $this->request->getPost('mobile_no');
$client_data = $this->ClientBranchModel->where('mobile_no', $mobile_no )->first();
if($client_data){
$doc_id = $this->request->getPost('doc_id');
$clientData = $this->ClientDocsModel->select('client.name as client_name,
client.email as client_email,
client_branch.email as client_branch_email,
client.mobile_no as client_mobile_no,
client_branch.mobile_no as client_branch_mobile_no,
client.individual as individual,
client_branch.whatsapp as whatsapp,
client_branch.sms as sms,
client_docs.business_id')
->join('client_branch', 'client_docs.client_branch_id = client_branch.id', 'left')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_docs.id', $doc_id)->get()->getRow();
if($clientData->individual == 1){
$client_mail_id = $clientData->client_email;
$client_mobile_no = $clientData->client_mobile_no;
}else{
$client_mail_id = $clientData->client_branch_email;
$client_mobile_no = $clientData->client_branch_mobile_no;
}
if ($clientData) {
$id = $this->request->getPost('doc_id');
$otp = mt_rand(100000, 999999);
$data = ['otp' => $otp];
$clint_full_data = $this->ClientDocsModel->select('client_docs.* , services.service_name , service_group.group_name , client_branch.name as client_branch_name , client.name as client_name')
$client_full_data = $this->ClientDocsModel->select('client_docs.* , services.service_name , service_group.group_name , client_branch.name as client_branch_name , client.name as client_name')
->join('template', 'template.template_id = client_docs.template_id', 'left')
->join('services', 'services.service_id = template.service_id', 'left')
->join('service_group', 'service_group.service_group_id = template.service_group_id', 'left')
@ -852,11 +904,11 @@ class MasterController extends BaseController
$notificationHelper = new NotificationHelper();
$number = '91'.$mobile_no; // Replace with dynamic recipient number
$message = 'Document Verification OTP : ' . $otp;
if($client_data['whatsapp'] == 1){
if($clientData->whatsapp == 1){
// $notificationHelper->sendWhatsAppMessage($number, $message);
}
if($client_data['sms'] == 1){
$data = $notificationHelper->sendSms($number, $client_data['name'] , $otp, '', 'doc_verify',$clint_full_data);
if($clientData->sms == 1){
$data = $notificationHelper->sendSms($number, $clientData->client_name , $otp, '', 'doc_verify',$client_full_data);
}
return $this->respond(['success' => true]);
}

View File

@ -98,10 +98,12 @@ class TestController extends Controller
->get()->getRow();
if($data['clientData']->individual == 1){
$data['clientData'] = $this->ClientBranchModel->select('client.name ,client.individual, client.pan_no, client.mobile_no , client.email ')
$clientData = $this->ClientBranchModel->select('client.email , client.mobile_no')
->join('client', 'client_branch.client_id = client.client_id', 'left')
->where('client_branch.id',$data['docData']->client_branch_id)
->get()->getRow();
$data['clientData']->email = $clientData->email;
$data['clientData']->mobile_no = $clientData->mobile_no;
}

View File

@ -48,7 +48,7 @@ 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, $html, $mail_config = [])
{
// try {
// Merge default config with provided config
@ -68,7 +68,7 @@ class MailHelper
$email->setFrom($mail_config['sender_email'], $mail_config['sender_name']);
$email->setTo($email_id);
$email->setSubject($subject);
$email->setMessage($message);
$email->setMessage($html);
if ($email->send()) {
return ['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $email_id];

View File

@ -80,7 +80,7 @@
<input type="text" id="port" class="form-control" value="<?= isset($business['smtp_port']) ? $business['smtp_port'] : '' ?>">
</div>
</div>
<?php if(!isset($business['business_id'])){ ?>
<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-group col-md-6">
@ -93,13 +93,7 @@
<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{ ?>
<div class="form-row">
<div class="form-group col-md-6">
<!-- <label for="">Test Config Mail</label> -->
<!-- <input type="mail" class="form-control" id="r_email"> -->
</div>
<?php } ?>
</div>
</form>

View File

@ -35,12 +35,10 @@
<tr>
<th>Client</th>
<th>Branch Name</th>
<th>GST No</th>
<th>GST</th>
<th>Mobile</th>
<th>Email</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Pin Code</th>
<th>Mobile No</th>
<th>Active</th>
<th>Action</th>
</tr>
@ -49,21 +47,19 @@
<?php foreach ($clientBranchList as $value) :?>
<tr>
<td><?= $value['client_name']; ?></td>
<?php if($value['individual'] == 1) { ?>
<td><?= $value['client_name']; ?></td>
<?php }else{ ?>
<td><?= $value['name']; ?></td>
<?php } ?>
<td> <?php if($value['individual'] == 1) { ?><?= 'Individual' ?><?php }else{ ?> <?= $value['name']; ?><?php } ?></td>
<td><?= $value['gst_no']; ?></td>
<td><?= $value['address']; ?></td>
<td><?= $value['city']; ?></td>
<td><?= $value['state']; ?></td>
<td><?= $value['pin_code']; ?></td>
<?php if($value['individual'] == 1) { ?>
<td><?= $value['client_mobile_no']; ?></td>
<?php }else{ ?>
<td><?= $value['mobile_no']; ?></td>
<?php } ?>
<td> <?php if($value['individual'] == 1) { ?><?= $value['client_mobile_no']; ?><?php }else{ ?> <?= $value['mobile_no']; ?><?php } ?></td>
<td><?php if($value['individual'] == 1) { ?><?= $value['client_email']; ?><?php }else{ ?> <?= $value['email']; ?><?php } ?></td>
<td>
<?= $value['address']; ?></br>
<?= $value['city']; ?>
<?php if (!empty($value['state'])): ?>, <?= $value['state']; ?><?php endif; ?>
<?php if (!empty($value['pin_code'])): ?> - <?= $value['pin_code']; ?><?php endif; ?>
</td>
<td>
<?php if ($value['is_active'] == 0): ?>
<span style="color: red;">Inactive</span>

View File

@ -432,10 +432,30 @@
data: formData,
dataType: 'json',
success: function(response) {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, 1000);
console.log(response);
if (response.data) {
window.location.reload();
if (response.hasOwnProperty('mail_status')) {
if (response.mail_status == 'success')
{
toastr.success(response.data, 'Success');
toastr.success('Mail Send To '+response.mail, 'Success');
} else {
toastr.success(response.data, 'Success');
toastr.warning('Failed to send mail to '+response.mail, 'Warning');
}
} else {
toastr.success(response.data, 'Success');
}
setTimeout(function() { window.location.reload(); }, 2000);
}
},
error: function(xhr, status, error) {

View File

@ -0,0 +1,75 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head>
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Minton - Responsive Bootstrap 4 Admin Dashboard</title>
</head>
<body itemscope itemtype="http://schema.org/EmailMessage"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em; background-color: #f6f6f6; margin: 0;"
bgcolor="#f6f6f6">
<table class="body-wrap"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background-color: #f6f6f6; margin: 0;"
bgcolor="#f6f6f6">
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;"
valign="top"></td>
<td class="container" width="600"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto;"
valign="top">
<div class="content"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table class="main" width="100%" cellpadding="0" cellspacing="0"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background-color: #fff; margin: 0; border: 1px solid #e9e9e9;"
bgcolor="#fff">
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class=""
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background-color: #85a7c9; margin: 0; padding: 20px;"
align="center" bgcolor="#85a7c9" valign="top">
<span style="margin-top: 10px;display: block;">Verify Document</span>
</td>
</tr>
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-wrap"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;"
valign="top">
<table width="100%" cellpadding="0" cellspacing="0"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;"
valign="top">
<?= $message; ?>
</td>
</tr>
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;"
valign="top">
<a href=" <?= $url; ?>" class="btn-primary"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; color: #FFF; text-decoration: none; line-height: 2em; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background-color: #f1556c; margin: 0; border-color: #f1556c; border-style: solid; border-width: 8px 16px;">
Preview and Approve Document
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<td style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;"
valign="top"></td>
</tr>
</table>
</body>
</html>

View File

@ -147,6 +147,11 @@
<i class="mdi mdi-email-send" style="margin-right: 16px !important; margin-left: 5px;"></i>Reminder
</a>
<?php } ?>
<?php if($value['is_active'] == 1 && $value['is_approved'] == 0){ ?>
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Create Link" onclick="createSharedLink(this)">
<i class="mdi mdi-link-variant-plus" style="margin-right: 16px !important; margin-left: 5px;"></i>Create Link
</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
@ -301,6 +306,21 @@
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="linkModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<p id="generatedLink" style="display:none;"></p>
Copy the document link by clicking the below button
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="copyLinkButton">Copy Link</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
@ -618,8 +638,24 @@
}, 1000);
console.log(response);
if (response.data) {
toastr.success(response.data, 'Success');
window.location.reload();
if (response.hasOwnProperty('mail_status')) {
if (response.mail_status == 'success')
{
toastr.success(response.data, 'Success');
toastr.success('Mail Send To '+response.mail, 'Success');
} else {
toastr.success(response.data, 'Success');
toastr.warning('Failed to send mail to '+response.mail, 'Warning');
}
} else {
toastr.success(response.data, 'Success');
}
setTimeout(function() { window.location.reload(); }, 2000);
}
},
error: function(xhr, status, error) {
@ -633,7 +669,8 @@
function rememberNotification(params) {
var doc_id = params.getAttribute('data-id');
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var formData = {
doc_id: doc_id,
};
@ -643,10 +680,21 @@
data: formData,
dataType: 'json',
success: function(response) {
console.log(response);
if (response.data) {
window.location.reload();
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, 1000);
if (response.mail_status == 'success')
{
toastr.success('Mail Send To '+response.mail, 'Success');
} else {
toastr.warning('Failed to send mail to '+response.mail, 'Warning');
}
},
error: function(xhr, status, error) {
// Handle error response here
@ -657,6 +705,56 @@
}
function createSharedLink(params){
var doc_id = params.getAttribute('data-id');
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var formData = {
doc_id: doc_id,
};
$.ajax({
type: 'POST',
url: '<?php echo base_url()."createSharedLink"?>',
data: formData,
dataType: 'json',
success: function(response) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, 1000);
if (response.status == 'success')
{
$('#generatedLink').text(response.link);
$('#linkModal').modal('show');
} else {
}
},
error: function(xhr, status, error) {
// Handle error response here
console.error(xhr.responseText);
}
});
}
$(document).on('click', '#copyLinkButton', function() {
const textToCopy = $('#generatedLink').text();
// Use the Clipboard API to copy the text
navigator.clipboard.writeText(textToCopy).then(() => {
// Success callback
console.log('Text copied to clipboard');
}).catch(err => {
// Error callback
console.error('Failed to copy text: ', err);
});
});
function DeleteDoc(params) {
var doc_id = params.getAttribute('data-id');