Compare commits
10 Commits
ffaa98cb00
...
9e68ef8f83
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e68ef8f83 | ||
|
|
24c4d964eb | ||
|
|
d49338397f | ||
|
|
2ba925f1c6 | ||
|
|
3b8783eff3 | ||
|
|
b452f4e885 | ||
|
|
0a14de4d73 | ||
|
|
466975dbce | ||
|
|
ebb6e7840c | ||
|
|
90bea122ea |
3
.env
3
.env
@ -73,8 +73,7 @@ database.default.port = 3306
|
||||
|
||||
|
||||
|
||||
WAAI_INSTANCE = '66712908EB75A'
|
||||
WAAI_TOKEN = '667128c844c48'
|
||||
whatsAppToken = 'EAARGyzEtu2kBO1mK3ILZAvZCd8D3QNpHo2uU5SWZBXbZC3eNL9hFpZA5WebolazilZA0RfU0zdu6gNZAW1yGCYiXFgZBC1YQfZBErv0QKAYQAT9wMOTy2f0C3m4ZAK8ZCwt3mGlURfa6m2uUCyNK4qEUy2Evx7scd8aanXLFr8MJUbVNJP8BPPSpUJW4A0dZAaci56lrPGnw0hV7jV9ISGmDLNYZD';
|
||||
|
||||
|
||||
API_KEY = 'HgvlULWCIrs'; // Your API key
|
||||
|
||||
@ -76,6 +76,8 @@ 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');
|
||||
$routes->post('doc_verify_otp','MasterController::doc_verify_otp');
|
||||
|
||||
@ -176,8 +176,9 @@ class BusinessController extends BaseController
|
||||
$mail_config = $this->request->getPost();
|
||||
$r_mail = $this->request->getPost('r_email');
|
||||
$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) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||
}
|
||||
|
||||
@ -161,8 +161,7 @@ class ClientController extends BaseController
|
||||
$message = 'Login OTP is: ' . $otp;
|
||||
if($client_branch_data['whatsapp'] == 1){
|
||||
try {
|
||||
$notificationHelper->sendWhatsAppMessage($number, $message);
|
||||
// return $this->respond(['success' => true, 'otp' => $otp]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['Error' => $e->getMessage()]);
|
||||
}
|
||||
@ -262,7 +261,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();
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -571,6 +573,8 @@ class MasterController extends BaseController
|
||||
$placeHolder = '%'.$key.'%';
|
||||
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
||||
}
|
||||
$data['business_list'] = $this->BusinessModel->findAll();
|
||||
|
||||
echo view('layout/header', ['Data'=>$userData]);
|
||||
echo view('client_docs_preview',$data);
|
||||
echo view('layout/footer');
|
||||
@ -661,64 +665,96 @@ class MasterController extends BaseController
|
||||
public function change_doc_status()
|
||||
{
|
||||
|
||||
// try {
|
||||
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();
|
||||
|
||||
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)], 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();
|
||||
$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 = [
|
||||
'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
|
||||
];
|
||||
$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){
|
||||
$result = $notificationHelper->send_whatsapp_message($number, $clientData->client_name , $businessData->business_name , $url);
|
||||
if ($result['status_code'] == 200) {
|
||||
//echo 'Message sent successfully';
|
||||
} else {
|
||||
// echo 'Failed to send message. Status Code: ' . $result['status_code'];
|
||||
// print_r($result['response']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//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);
|
||||
|
||||
|
||||
//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;
|
||||
@ -729,14 +765,18 @@ class MasterController extends BaseController
|
||||
|
||||
$updated = $this->ClientDocsModel->update($doc_id, $data);
|
||||
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",'mail_status'=>$mail_status['status'],'mail'=>$client_mail_id ],200);
|
||||
}else{
|
||||
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()
|
||||
@ -745,31 +785,36 @@ 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();
|
||||
// print_r($businessData);die;
|
||||
$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',
|
||||
'SMTPHost' => $businessData->smtp_host,
|
||||
'SMTPUser' => $businessData->smtp_user,
|
||||
'SMTPPass' => $businessData->smtp_pass,
|
||||
@ -777,34 +822,82 @@ 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);
|
||||
|
||||
}
|
||||
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 {
|
||||
$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()
|
||||
{
|
||||
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')
|
||||
@ -817,11 +910,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){
|
||||
// $notificationHelper->sendWhatsAppMessage($number, $message);
|
||||
if($clientData->whatsapp == 1){
|
||||
|
||||
}
|
||||
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]);
|
||||
}
|
||||
@ -922,4 +1015,15 @@ class MasterController extends BaseController
|
||||
return $this->fail('Invalid request method', 405);
|
||||
}
|
||||
}
|
||||
|
||||
public function test(){
|
||||
$notificationHelper = new NotificationHelper();
|
||||
$result = $notificationHelper->send_whatsapp_message('919884002190','','','');
|
||||
if ($result['status_code'] == 200) {
|
||||
echo 'Message sent successfully';
|
||||
} else {
|
||||
echo 'Failed to send message. Status Code: ' . $result['status_code'];
|
||||
print_r($result['response']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -15,14 +15,14 @@ class MailHelper
|
||||
try {
|
||||
$email = \Config\Services::email();
|
||||
|
||||
$email->initialize([
|
||||
'protocol' => $config['protocol'],
|
||||
'SMTPHost' => $config['SMTPHost'],
|
||||
'SMTPUser' => $config['SMTPUser'],
|
||||
'SMTPPass' => $config['SMTPPass'],
|
||||
'SMTPPort' => $config['SMTPPort'],
|
||||
// 'mailType' => $config['mailType']
|
||||
]);
|
||||
// $email->initialize([
|
||||
// 'protocol' => $config['protocol'],
|
||||
// 'SMTPHost' => $config['SMTPHost'],
|
||||
// 'SMTPUser' => $config['SMTPUser'],
|
||||
// 'SMTPPass' => $config['SMTPPass'],
|
||||
// 'SMTPPort' => $config['SMTPPort'],
|
||||
// // 'mailType' => $config['mailType']
|
||||
// ]);
|
||||
|
||||
// $email->setFrom($config['sender_email'], $config['sender_name']);/
|
||||
$email->setMailType('html');
|
||||
@ -48,41 +48,27 @@ 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 = [])
|
||||
{
|
||||
// print_r("helllo");die;
|
||||
|
||||
// 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
|
||||
$config = array_merge($default_config, $mail_config);
|
||||
|
||||
$email = \Config\Services::email();
|
||||
|
||||
|
||||
$email->initialize([
|
||||
'protocol' => $config['protocol'],
|
||||
'SMTPHost' => $config['SMTPHost'],
|
||||
'SMTPUser' => $config['SMTPUser'],
|
||||
'SMTPPass' => $config['SMTPPass'],
|
||||
'SMTPPort' => (int)$config['SMTPPort'],
|
||||
'mailType' => $config['mailType']
|
||||
'protocol' => $mail_config['protocol'],
|
||||
'SMTPHost' => $mail_config['SMTPHost'],
|
||||
'SMTPUser' => $mail_config['SMTPUser'],
|
||||
'SMTPPass' => $mail_config['SMTPPass'],
|
||||
'SMTPPort' => (int)$mail_config['SMTPPort'],
|
||||
'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->setSubject($subject);
|
||||
$email->setMessage($message);
|
||||
$email->setMessage($html);
|
||||
|
||||
if ($email->send()) {
|
||||
return ['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $email_id];
|
||||
@ -99,42 +85,36 @@ class MailHelper
|
||||
|
||||
public static function check_mail_config($r_email, $mail_config = [])
|
||||
{
|
||||
$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'
|
||||
];
|
||||
if (empty($mail_config['protocol']) || empty($mail_config['SMTPHost']) ||
|
||||
empty($mail_config['SMTPUser']) || empty($mail_config['SMTPPass']) ||
|
||||
empty($mail_config['SMTPPort']) || empty($mail_config['mailType']) ||
|
||||
empty($mail_config['sender_email']) ) {
|
||||
return json_encode(['status' => 'failed', 'code' => 400, 'message' => 'Incomplete Mail Configuration', 'data' => $r_email]);
|
||||
}
|
||||
|
||||
// Merge default config with provided config
|
||||
$config = array_merge($default_config, $mail_config);
|
||||
$email = \Config\Services::email();
|
||||
|
||||
$email->initialize([
|
||||
'protocol' => $config['protocol'],
|
||||
'SMTPHost' => $config['SMTPHost'],
|
||||
'SMTPUser' => $config['SMTPUser'],
|
||||
'SMTPPass' => $config['SMTPPass'],
|
||||
'SMTPPort' => (int)$config['SMTPPort'],
|
||||
'mailType' => $config['mailType']
|
||||
'protocol' => $mail_config['protocol'],
|
||||
'SMTPHost' => $mail_config['SMTPHost'],
|
||||
'SMTPUser' => $mail_config['SMTPUser'],
|
||||
'SMTPPass' => $mail_config['SMTPPass'],
|
||||
'SMTPPort' => (int)$mail_config['SMTPPort'],
|
||||
'mailType' => $mail_config['mailType']
|
||||
]);
|
||||
|
||||
$email->setFrom($config['sender_email'], "Sender Name");
|
||||
|
||||
$email->setFrom($mail_config['sender_email'], '');
|
||||
$email->setTo($r_email);
|
||||
$email->setSubject("Test Mail Configuration");
|
||||
$email->setMessage("Test Mail Configuration");
|
||||
|
||||
|
||||
if ($email->send()) {
|
||||
return json_encode(['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $r_email]);
|
||||
} else {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
namespace App\Helpers;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
use CodeIgniter\HTTP\ClientInterface;
|
||||
class NotificationHelper
|
||||
{
|
||||
protected $email;
|
||||
@ -18,70 +18,7 @@ class NotificationHelper
|
||||
}
|
||||
|
||||
|
||||
public function sendWhatsAppMessage($number, $message, $client_login_url = '')
|
||||
{
|
||||
// Extract plain text message
|
||||
$plainTextMessage = strip_tags($message);
|
||||
|
||||
// Extract URL from message
|
||||
preg_match('/<a\s+(?:[^>]*?\s+)?href="([^"]*)"/i', $client_login_url, $match);
|
||||
$client_login_url = isset($match[1]) ? $match[1] : '';
|
||||
// Prepare the data to send
|
||||
$instance_id = $_ENV['WAAI_INSTANCE'];
|
||||
$access_token = $_ENV['WAAI_TOKEN'];
|
||||
$url = 'https://waai.in/api/send';
|
||||
|
||||
// Prepare the text for WhatsApp
|
||||
if($client_login_url){
|
||||
$whatsappMessage = $plainTextMessage . "\n\nClick here - " . $client_login_url;
|
||||
}else{
|
||||
$whatsappMessage = $plainTextMessage ;
|
||||
}
|
||||
// Prepare JSON payload
|
||||
$postdata = json_encode([
|
||||
'number' => $number,
|
||||
'type' => 'text',
|
||||
'message' => $whatsappMessage,
|
||||
'instance_id' => $instance_id,
|
||||
'access_token' => $access_token
|
||||
]);
|
||||
|
||||
// Initialize cURL session
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($postdata)
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
|
||||
// Execute cURL session
|
||||
$response = curl_exec($ch);
|
||||
|
||||
// Check for cURL errors
|
||||
if ($response === false) {
|
||||
$this->logger->error('Failed to communicate with WhatsApp API: ' . curl_error($ch));
|
||||
curl_close($ch);
|
||||
throw new \Exception('Failed to communicate with WhatsApp API');
|
||||
}
|
||||
|
||||
// Get HTTP response code
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
// Check HTTP response code for success
|
||||
if ($httpCode !== 200) {
|
||||
$this->logger->error('Failed to send WhatsApp message. HTTP Code: ' . $httpCode);
|
||||
throw new \Exception('Failed to send WhatsApp message. HTTP Code: ' . $httpCode);
|
||||
}
|
||||
|
||||
// Log success or handle further
|
||||
$this->logger->info('WhatsApp message sent successfully to ' . $number);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function sendSms($number, $name= '', $otp='', $url ='', $message_type_name, $client_full_data='')
|
||||
{
|
||||
@ -119,6 +56,76 @@ class NotificationHelper
|
||||
return json_encode(['response' => $output]);
|
||||
}
|
||||
|
||||
|
||||
public function send_whatsapp_message($to, $client_name , $business_name , $doc_url)
|
||||
{
|
||||
$url = 'https://graph.facebook.com/v20.0/355752820961010/messages';
|
||||
$headers = [
|
||||
'Authorization: Bearer '.$_ENV['whatsAppToken'],
|
||||
'Content-Type: application/json'
|
||||
];
|
||||
|
||||
$templateName = 'bbsigndoc';
|
||||
$languageCode = 'en';
|
||||
$parsedUrl = parse_url($doc_url, PHP_URL_QUERY);
|
||||
|
||||
$data = [
|
||||
'messaging_product' => 'whatsapp',
|
||||
'to' => $to,
|
||||
'type' => 'template',
|
||||
'template' => [
|
||||
'name' => $templateName,
|
||||
'language' => [
|
||||
'code' => $languageCode
|
||||
],
|
||||
'components' => [
|
||||
[
|
||||
'type' => 'body',
|
||||
'parameters' => [
|
||||
[
|
||||
'type' => 'text',
|
||||
'text' => $client_name
|
||||
],
|
||||
[
|
||||
'type' => 'text',
|
||||
'text' => $business_name
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'button',
|
||||
'sub_type' => 'url',
|
||||
'index' => 0,
|
||||
'parameters' => [
|
||||
|
||||
[
|
||||
'type' => 'text',
|
||||
'text' => $parsedUrl
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
return [
|
||||
'status_code' => $statusCode,
|
||||
'response' => json_decode($response, true)
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
use Config\Services;
|
||||
|
||||
if (!function_exists('generate_signed_url')) {
|
||||
function generate_signed_url($route, $params = [], $expiresIn = 3600)
|
||||
function generate_signed_url($route, $params = [], $expiresIn = 259200)
|
||||
{
|
||||
$secretKey = 'your-secret-key'; // Change this to your secret key
|
||||
$expiresAt = time() + $expiresIn;
|
||||
|
||||
@ -32,13 +32,10 @@
|
||||
|
||||
<table id="business_branch_table" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Branch Name</th>
|
||||
<tr>
|
||||
<th>Branch Name</th>
|
||||
<th>GST</th>
|
||||
<th>Address</th>
|
||||
<th>City</th>
|
||||
<th>State</th>
|
||||
<th>PIN Code</th>
|
||||
<th>Contact</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
@ -52,10 +49,12 @@
|
||||
<tr>
|
||||
<td><?= $value['branch_name']; ?></td>
|
||||
<td><?= $value['gstno']; ?></td>
|
||||
<td><?= $value['address']; ?></td>
|
||||
<td><?= $value['city']; ?></td>
|
||||
<td><?= $value['state']; ?></td>
|
||||
<td><?= $value['pin_code']; ?></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><?= $value['contact']; ?></td>
|
||||
<td>
|
||||
<?php if ($value['isactive'] == 0): ?>
|
||||
|
||||
@ -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>
|
||||
<div class="form-row">
|
||||
<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'] : '' ?>">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="subject-input">User Name</label>
|
||||
<input type="text" id="user_name" class="form-control" value="<?= isset($business['smtp_user']) ? $business['smtp_user'] : '' ?>">
|
||||
@ -77,33 +80,32 @@
|
||||
<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-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-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">
|
||||
</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 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>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<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="footer_html" value='<?= isset($business['business_id']) ? $business['footer_html'] : '' ?>'>
|
||||
<?php if(isset($business['business_id'])){?>
|
||||
<button type="submit" id="savedata" class="btn btn-primary">Submit</button>
|
||||
<?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="display:none;">Submit</button>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(isset($business['business_id']) > 0){ ?>
|
||||
<button type="submit" id="savedata" class="btn btn-primary" style="float: right;">Submit</button>
|
||||
<?php }else{ ?>
|
||||
<button type="submit" id="savedata" class="btn btn-primary" style="float: right;" disabled>Submit</button>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div>
|
||||
@ -119,62 +121,67 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#summernote-header').summernote({
|
||||
height: 150, // set the height of the editor
|
||||
toolbar: [
|
||||
$(document).ready(function() {
|
||||
$('#summernote-header').summernote({
|
||||
height: 150, // set the height of the editor
|
||||
toolbar: [
|
||||
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear' ]],
|
||||
['fontname', ['fontname']],
|
||||
['fontsize', ['fontsize']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
||||
['table', ['table']],
|
||||
['insert', [ 'picture']],
|
||||
['view', ['fullscreen', 'codeview', 'help']],
|
||||
['mybutton', ['customButton','Years']] // Custom button group
|
||||
],
|
||||
});
|
||||
|
||||
$('#summernote-footer').summernote({
|
||||
height: 150, // set the height of the editor
|
||||
toolbar: [
|
||||
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear' ]],
|
||||
['fontname', ['fontname']],
|
||||
['fontsize', ['fontsize']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
||||
['table', ['table']],
|
||||
['insert', [ 'picture']],
|
||||
['view', ['fullscreen', 'codeview', 'help']],
|
||||
['mybutton', ['customButton','Years']] // Custom button group
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
setTimeout(() =>
|
||||
{
|
||||
$('#summernote-header').summernote('code', $('#header_html').val());
|
||||
$('#summernote-footer').summernote('code', $('#footer_html').val());
|
||||
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear' ]],
|
||||
['fontname', ['fontname']],
|
||||
['fontsize', ['fontsize']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
||||
['table', ['table']],
|
||||
['insert', [ 'picture']],
|
||||
['view', ['fullscreen', 'codeview', 'help']],
|
||||
['mybutton', ['customButton','Years']] // Custom button group
|
||||
],
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#summernote-footer').summernote({
|
||||
height: 150, // set the height of the editor
|
||||
toolbar: [
|
||||
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear' ]],
|
||||
['fontname', ['fontname']],
|
||||
['fontsize', ['fontsize']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
||||
['table', ['table']],
|
||||
['insert', [ 'picture']],
|
||||
['view', ['fullscreen', 'codeview', 'help']],
|
||||
['mybutton', ['customButton','Years']] // Custom button group
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
setTimeout(() =>
|
||||
{
|
||||
$('#summernote-header').summernote('code', $('#header_html').val());
|
||||
$('#summernote-footer').summernote('code', $('#footer_html').val());
|
||||
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("#test-email-btn").on("click", function()
|
||||
{
|
||||
$('#submit-spin').show();
|
||||
$(this).hide();
|
||||
|
||||
formData ={
|
||||
sender_email : $('#email').val(),
|
||||
r_email : $('#r_email').val(),
|
||||
smtp_host : $('#host').val(),
|
||||
smtp_user : $('#user_name').val(),
|
||||
smtp_pass : $('#password').val(),
|
||||
smtp_port : $('#port').val(),
|
||||
SMTPHost : $('#host').val(),
|
||||
SMTPUser : $('#user_name').val(),
|
||||
SMTPPass : $('#password').val(),
|
||||
SMTPPort : $('#port').val(),
|
||||
mailType : 'html',
|
||||
protocol : 'smtp',
|
||||
};
|
||||
// console.log(formData);
|
||||
$.ajax({
|
||||
@ -183,17 +190,17 @@ $(document).ready(function() {
|
||||
data: formData,
|
||||
json: true,
|
||||
success: function(response) {
|
||||
|
||||
console.log(JSON.parse(response));
|
||||
if(JSON.parse(response).status == 'success'){
|
||||
$('#savedata').css('display','');
|
||||
$('#test-email-btn').css('display','none');
|
||||
toastr.success('Data saved successfully ', 'Success');
|
||||
// window.location.href = '<?= base_url()."business_list"; ?>';
|
||||
|
||||
}else{
|
||||
toastr.warning('Something went wrong', 'Warning');
|
||||
}
|
||||
console.log(response);
|
||||
|
||||
if(JSON.parse(response).status == 'success'){
|
||||
$('#savedata').prop('disabled', false);
|
||||
toastr.success('Mail Sent successfully ', 'Success');
|
||||
// window.location.href = '<?= base_url()."business_list"; ?>';
|
||||
|
||||
}else{
|
||||
$('#savedata').prop('disabled', true);
|
||||
toastr.warning('Mail sending failed. Please check your mail configuration.', 'Warning');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -201,24 +208,58 @@ $(document).ready(function() {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
$('#submit-spin').hide();
|
||||
$(this).show();
|
||||
|
||||
}, 2000);
|
||||
|
||||
})
|
||||
|
||||
$("#savedata").on("click", function()
|
||||
{
|
||||
|
||||
var headerContent = $('#summernote-header').summernote('code');
|
||||
var footerContent = $('#summernote-footer').summernote('code');
|
||||
formData ={
|
||||
business_id : $('#business_id').val(),
|
||||
business_name : $('#business_name').val(),
|
||||
header_html : headerContent,
|
||||
footer_html : footerContent,
|
||||
email : $('#email').val(),
|
||||
smtp_host : $('#host').val(),
|
||||
smtp_user : $('#user_name').val(),
|
||||
smtp_pass : $('#password').val(),
|
||||
smtp_port : $('#port').val(),
|
||||
};
|
||||
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 footerContent = $('#summernote-footer').summernote('code');
|
||||
formData ={
|
||||
business_id : $('#business_id').val(),
|
||||
business_name : $('#business_name').val(),
|
||||
header_html : headerContent,
|
||||
footer_html : footerContent,
|
||||
email : $('#email').val(),
|
||||
smtp_host : $('#host').val(),
|
||||
smtp_user : $('#user_name').val(),
|
||||
smtp_pass : $('#password').val(),
|
||||
smtp_port : $('#port').val(),
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url()."add_business"; ?>',
|
||||
|
||||
@ -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>
|
||||
@ -414,6 +410,8 @@
|
||||
$('#email').prop('required', false);
|
||||
$('#mobile_no').prop('required', false);
|
||||
}else{
|
||||
$('.branch_hide_edit').show();
|
||||
$('#individual').val('');
|
||||
$('#branch_name').val(response.name);
|
||||
$('#gst_no').val(response.gst_no);
|
||||
$('#email').val(response.email);
|
||||
|
||||
@ -54,9 +54,14 @@
|
||||
<div class="col-8">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"><?php echo $docData->service_name; ?>
|
||||
<a class="download-btnn" style="color:#000;">
|
||||
<a class="download-btnn" style="color:#000;" title="Download">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
|
||||
<?php if(isset($_SESSION['is_staff_logged_in']) && $_SESSION['is_staff_logged_in']) { ?>
|
||||
<i class="mdi mdi-link-variant-plus" title="Create Share Link" data-id="<?php echo $docData->doc_id; ?>" onclick="createSharedLink(this)"></i>
|
||||
<?php } ?>
|
||||
|
||||
</h4>
|
||||
<div class="page-title-right">
|
||||
<!-- <a onclick="window.history.back()" class="btn btn-secondary waves-effect waves-light" > Close </a> -->
|
||||
@ -190,6 +195,22 @@
|
||||
</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>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
@ -432,10 +453,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) {
|
||||
@ -448,6 +489,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);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
75
app/Views/email_templates.php
Normal file
75
app/Views/email_templates.php
Normal 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: #38414a; margin: 0; padding: 20px;"
|
||||
align="center" bgcolor="#71b6f9" 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>
|
||||
@ -160,22 +160,34 @@
|
||||
|
||||
|
||||
</style>
|
||||
<style>
|
||||
.dropdown-menu-right {
|
||||
right: auto !important;
|
||||
top: auto !important;
|
||||
/* left: auto !important; */
|
||||
}
|
||||
<style>
|
||||
.dropdown-menu-right {
|
||||
right: auto !important;
|
||||
top: auto !important;
|
||||
/* left: auto !important; */
|
||||
}
|
||||
|
||||
.modal-xg {
|
||||
max-width: 70%; /* Adjust the percentage as needed */
|
||||
}
|
||||
</style>
|
||||
.modal-xg {
|
||||
max-width: 70%; /* Adjust the percentage as needed */
|
||||
}
|
||||
</style>
|
||||
|
||||
</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}'>
|
||||
|
||||
<!-- <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 -->
|
||||
<div id="wrapper">
|
||||
|
||||
|
||||
@ -77,13 +77,12 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="width:10px">Client Name</th>
|
||||
<th>Client Branch Name</th>
|
||||
<th style="width:10px">Client</th>
|
||||
<th>Service Group</th>
|
||||
<th>Service Name</th>
|
||||
<th>Document Name</th>
|
||||
<th>Service</th>
|
||||
<th>Document</th>
|
||||
<th>Doc Status</th>
|
||||
<th>Approve Date</th>
|
||||
<th>Approval Date</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -94,8 +93,7 @@
|
||||
<?php foreach ($doc_list as $key => $value) { ?>
|
||||
|
||||
<tr>
|
||||
<td style="width:10px"> <?php echo $value['client_name']; ?></td>
|
||||
<td> <?php echo $value['client_branch_name']; ?></td>
|
||||
<td style="width:10px"> <?= $value['client_name']; ?> <?php if (!empty($value['client_branch_name'])): ?>- <?= $value['client_branch_name']; ?><?php endif; ?> </td>
|
||||
<td> <?php echo $value['group_name']; ?></td>
|
||||
<td> <?php echo $value['service_name']; ?></td>
|
||||
<td> <?php echo $value['document_name']; ?></td>
|
||||
@ -133,7 +131,7 @@
|
||||
</a>
|
||||
<?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
|
||||
</a>
|
||||
|
||||
@ -146,7 +144,16 @@
|
||||
<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
|
||||
</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
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -297,6 +304,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>
|
||||
|
||||
|
||||
<!-- ============================================================== -->
|
||||
@ -593,6 +615,8 @@
|
||||
if(status == 1){
|
||||
var is_active= 0;
|
||||
}else{
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var is_active= 1;
|
||||
}
|
||||
|
||||
@ -606,9 +630,30 @@
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
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 Sent To '+response.mail, 'Success');
|
||||
} else {
|
||||
toastr.success(response.data, 'Success');
|
||||
toastr.warning('Failed to sent mail to '+response.mail, 'Warning');
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
toastr.success(response.data, 'Success');
|
||||
}
|
||||
|
||||
setTimeout(function() { window.location.reload(); }, 2000);
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -622,7 +667,8 @@
|
||||
|
||||
function rememberNotification(params) {
|
||||
var doc_id = params.getAttribute('data-id');
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var formData = {
|
||||
doc_id: doc_id,
|
||||
};
|
||||
@ -631,6 +677,93 @@
|
||||
url: '<?php echo base_url()."rememeber_notification"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
|
||||
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
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
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) {
|
||||
@ -646,7 +779,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -680,6 +812,9 @@
|
||||
}else if(item.status == "Rejected"){
|
||||
reason_or_ip = ' - Reason(';
|
||||
reason_or_ip_end = ')';
|
||||
}else if(item.status == "Mail Success" || item.status == "Mail Failed"){
|
||||
reason_or_ip = ' - Email-Id(';
|
||||
reason_or_ip_end = ')';
|
||||
}else{
|
||||
reason_or_ip = '';
|
||||
reason_or_ip_end = '';
|
||||
|
||||
BIN
public/assets/images/Dox-old.png
Normal file
BIN
public/assets/images/Dox-old.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 7.1 KiB |
Loading…
Reference in New Issue
Block a user