diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f6fb9e0..21f1821 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index c45ef82..443396a 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -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(); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 6d0e6c0..48dcd7f 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -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 ='Preview and Approve Document'; - // $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 . ",
" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.

" . $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 . ",
" . $businessData->business_name . " has requested your approval for a document. Please click the button below to preview and approve.

"; + $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 ='Preview and Approve Document'; - // $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 . ",
" . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve.

" . $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 . ",
" . $businessData->business_name . " has requested your approval for a document. Please click the button below to preview and approve.

"; + $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]); } diff --git a/app/Controllers/TestController.php b/app/Controllers/TestController.php index fcbf12f..031298a 100644 --- a/app/Controllers/TestController.php +++ b/app/Controllers/TestController.php @@ -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; } diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index ae4ebe8..e953628 100644 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -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]; diff --git a/app/Views/business_form.php b/app/Views/business_form.php index 6562d4c..f94a728 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -80,7 +80,7 @@ - +
Test Mail
@@ -93,13 +93,7 @@ /assets/images/submit-spin.svg" width="29px" height="29px" class="ml-2" id="submit-spin" style="display:none; margin-top: 2.1rem !important;">
- -
-
- - -
- +
diff --git a/app/Views/client_branch_list.php b/app/Views/client_branch_list.php index 7cebea3..b58f6b4 100644 --- a/app/Views/client_branch_list.php +++ b/app/Views/client_branch_list.php @@ -35,12 +35,10 @@ Client Branch Name - GST No + GST + Mobile + Email Address - City - State - Pin Code - Mobile No Active Action @@ -49,21 +47,19 @@ - - - - - + - - - - - - - - - + + + + +
+ + , + - + + + Inactive diff --git a/app/Views/client_docs_preview.php b/app/Views/client_docs_preview.php index 05efa92..0769189 100644 --- a/app/Views/client_docs_preview.php +++ b/app/Views/client_docs_preview.php @@ -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) { diff --git a/app/Views/email_templates.php b/app/Views/email_templates.php new file mode 100644 index 0000000..fce95eb --- /dev/null +++ b/app/Views/email_templates.php @@ -0,0 +1,75 @@ + + + + + + +Minton - Responsive Bootstrap 4 Admin Dashboard + + + + + + + + + + +
+
+ + + + + + + +
+ + Verify Document +
+ + + + + + + + + +
+ +
+ + Preview and Approve Document + +
+
+ +
+
+ + diff --git a/app/Views/share_docs.php b/app/Views/share_docs.php index cfade6e..76a454b 100644 --- a/app/Views/share_docs.php +++ b/app/Views/share_docs.php @@ -147,6 +147,11 @@ Reminder + + + Create Link + + Delete @@ -301,6 +306,21 @@
+ @@ -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: '', + 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');